added prefixes to functions in init

This commit is contained in:
Fournier Nicolas 2015-06-12 12:09:14 +02:00
parent ec56e47809
commit b1210fa824
3 changed files with 61 additions and 22 deletions

View File

@ -32,7 +32,7 @@
* @return a randomly generated CollectableBlindcoin * @return a randomly generated CollectableBlindcoin
*/ */
struct TALER_MINTDB_CollectableBlindcoin * struct TALER_MINTDB_CollectableBlindcoin *
collectable_blindcoin_init () PERF_TALER_MINTDB_collectable_blindcoin_init ()
{ {
uint32_t random_int; uint32_t random_int;
struct GNUNET_CRYPTO_rsa_PrivateKey *denomination_key; struct GNUNET_CRYPTO_rsa_PrivateKey *denomination_key;
@ -85,7 +85,7 @@ collectable_blindcoin_init ()
* Liberate memory of @a coin * Liberate memory of @a coin
*/ */
int int
collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *coin) PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *coin)
{ {
if (NULL == coin) if (NULL == coin)
return GNUNET_OK; return GNUNET_OK;
@ -101,7 +101,7 @@ collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *coin)
* @return a randomly generated reserve * @return a randomly generated reserve
*/ */
struct TALER_MINTDB_Reserve * struct TALER_MINTDB_Reserve *
reserve_init () PERF_TALER_MINTDB_reserve_init ()
{ {
struct TALER_MINTDB_Reserve *reserve; struct TALER_MINTDB_Reserve *reserve;
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_priv; struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_priv;
@ -124,7 +124,7 @@ reserve_init ()
* Free memory of a reserve * Free memory of a reserve
*/ */
int int
reserve_free (struct TALER_MINTDB_Reserve *reserve) PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve)
{ {
GNUNET_free (reserve); GNUNET_free (reserve);
return GNUNET_OK; return GNUNET_OK;
@ -135,7 +135,7 @@ reserve_free (struct TALER_MINTDB_Reserve *reserve)
* @return a randomly generated refresh session * @return a randomly generated refresh session
*/ */
struct TALER_MINTDB_RefreshSession * struct TALER_MINTDB_RefreshSession *
refresh_session_init () PERF_TALER_MINTDB_refresh_session_init ()
{ {
struct TALER_MINTDB_RefreshSession *refresh_session; struct TALER_MINTDB_RefreshSession *refresh_session;
@ -153,7 +153,7 @@ refresh_session_init ()
* Free a refresh session * Free a refresh session
*/ */
int int
refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session) PERF_TALER_MINTDB_refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session)
{ {
GNUNET_free (refresh_session); GNUNET_free (refresh_session);
return GNUNET_OK; return GNUNET_OK;
@ -164,7 +164,7 @@ refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session)
* Create a randomly generated deposit * Create a randomly generated deposit
*/ */
struct TALER_MINTDB_Deposit * struct TALER_MINTDB_Deposit *
deposit_init () PERF_TALER_MINTDB_deposit_init ()
{ {
static int transaction_id = 0; static int transaction_id = 0;
struct TALER_MINTDB_Deposit *deposit; struct TALER_MINTDB_Deposit *deposit;
@ -257,7 +257,7 @@ deposit_init ()
* Free memory of a deposit * Free memory of a deposit
*/ */
int int
deposit_free (struct TALER_MINTDB_Deposit *deposit) PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit)
{ {
if ( NULL == deposit) if ( NULL == deposit)
return GNUNET_OK; return GNUNET_OK;
@ -273,7 +273,7 @@ deposit_free (struct TALER_MINTDB_Deposit *deposit)
* Generate a randomly generate DenominationKeyInformation * Generate a randomly generate DenominationKeyInformation
*/ */
struct TALER_MINTDB_DenominationKeyIssueInformation * struct TALER_MINTDB_DenominationKeyIssueInformation *
denomination_init () PERF_TALER_MINTDB_denomination_init ()
{ {
struct TALER_MINTDB_DenominationKeyIssueInformation *dki; struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct GNUNET_CRYPTO_EddsaPrivateKey *master_prvt; struct GNUNET_CRYPTO_EddsaPrivateKey *master_prvt;
@ -330,7 +330,7 @@ denomination_init ()
* Free memory for a DenominationKeyIssueInformation * Free memory for a DenominationKeyIssueInformation
*/ */
int int
denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki) PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
{ {
if (NULL ==dki) if (NULL ==dki)
return GNUNET_OK; return GNUNET_OK;
@ -340,3 +340,42 @@ denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
return GNUNET_OK; return GNUNET_OK;
} }
/**
* Generate a random CoinPublicInfo
*/
struct TALER_CoinPublicInfo *
PERF_TALER_MINTDB_coin_public_info_init ()
{
struct GNUNET_CRYPTO_EddsaPrivateKey *coin_spent_prv;
struct GNUNET_CRYPTO_rsa_PrivateKey *denom_prv;
struct TALER_CoinPublicInfo *cpi;
GNUNET_assert (NULL !=
(denom_prv = GNUNET_CRYPTO_rsa_private_key_create (128)));
GNUNET_assert (NULL !=
(coin_spent_prv = GNUNET_CRYPTO_eddsa_key_create ()));
GNUNET_assert (NULL !=
(cpi = GNUNET_new (struct TALER_CoinPublicInfo)));
GNUNET_CRYPTO_eddsa_key_get_public (coin_spent_prv, &cpi->coin_pub.eddsa_pub);
GNUNET_assert (NULL !=
(cpi->denom_pub.rsa_public_key = GNUNET_CRYPTO_rsa_private_key_get_public (denom_prv)));
GNUNET_assert (NULL !=
(cpi->denom_sig.rsa_signature = GNUNET_CRYPTO_rsa_sign (denom_prv,
&cpi->coin_pub,
sizeof (struct TALER_CoinSpendPublicKeyP))));
GNUNET_free (coin_spent_prv);
GNUNET_CRYPTO_rsa_private_key_free (denom_prv);
return cpi;
}
/**
* Free a CoinPublicInfo
*/
int
PERF_TALER_MINTDB_coin_public_info_free (struct TALER_CoinPublicInfo *cpi)
{
GNUNET_free (cpi);
return GNUNET_OK;
}

View File

@ -28,39 +28,39 @@
struct TALER_MINTDB_CollectableBlindcoin * struct TALER_MINTDB_CollectableBlindcoin *
collectable_blindcoin_init (void); PERF_TALER_MINTDB_collectable_blindcoin_init (void);
int int
collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *NAME); PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *NAME);
struct TALER_MINTDB_Reserve * struct TALER_MINTDB_Reserve *
reserve_init (void); PERF_TALER_MINTDB_reserve_init (void);
int int
reserve_free (struct TALER_MINTDB_Reserve *reserve); PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve);
struct TALER_MINTDB_RefreshSession * struct TALER_MINTDB_RefreshSession *
refresh_session_init (void); PERF_TALER_MINTDB_refresh_session_init (void);
struct TALER_MINTDB_Deposit * struct TALER_MINTDB_Deposit *
deposit_init (); PERF_TALER_MINTDB_deposit_init ();
int int
deposit_free (struct TALER_MINTDB_Deposit *deposit); PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit);
struct TALER_MINTDB_DenominationKeyIssueInformation * struct TALER_MINTDB_DenominationKeyIssueInformation *
init_denomination(void); PERF_TALER_MINTDB_init_denomination(void);
int int
denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki); PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
#endif #endif

View File

@ -58,7 +58,7 @@ data_free (union PERF_TALER_MINTDB_Data *data, enum PERF_TALER_MINTDB_Type type)
switch (type) switch (type)
{ {
case PERF_TALER_MINTDB_DEPOSIT: case PERF_TALER_MINTDB_DEPOSIT:
deposit_free (data->deposit); PERF_TALER_MINTDB_deposit_free (data->deposit);
data->deposit = NULL; data->deposit = NULL;
return; return;
@ -153,7 +153,7 @@ cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
} }
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT: case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
deposit_free (cmd[i].exposed.deposit); PERF_TALER_MINTDB_deposit_free (cmd[i].exposed.deposit);
break; break;
case PERF_TALER_MINTDB_CMD_LOAD_ARRAY: case PERF_TALER_MINTDB_CMD_LOAD_ARRAY:
@ -352,7 +352,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT: case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
{ {
struct TALER_MINTDB_Deposit *deposit = deposit_init (-1); struct TALER_MINTDB_Deposit *deposit = PERF_TALER_MINTDB_deposit_init (-1);
state->plugin->insert_deposit (state->plugin->cls, state->session, deposit); state->plugin->insert_deposit (state->plugin->cls, state->session, deposit);
state->cmd[state->i].exposed.deposit = deposit; state->cmd[state->i].exposed.deposit = deposit;