summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-08-11 23:28:33 +0200
committerChristian Grothoff <christian@grothoff.org>2016-08-11 23:28:33 +0200
commit5a6a3da8e42e2021c2cf7888e102b4c70634e2b7 (patch)
treea62652bb458fcb59cf2d03213b7890b60782bea8 /src/exchangedb
parentdd724c009dcc6cbc2be1e5431f59917036f0784b (diff)
downloadexchange-5a6a3da8e42e2021c2cf7888e102b4c70634e2b7.tar.gz
exchange-5a6a3da8e42e2021c2cf7888e102b4c70634e2b7.tar.bz2
exchange-5a6a3da8e42e2021c2cf7888e102b4c70634e2b7.zip
updating DB schema to profit from new KDF-based refresh variant
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/perf_taler_exchangedb_interpreter.c4
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c36
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c126
-rw-r--r--src/exchangedb/test_exchangedb.c194
4 files changed, 78 insertions, 282 deletions
diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.c b/src/exchangedb/perf_taler_exchangedb_interpreter.c
index 3b858d1bf..b869ad413 100644
--- a/src/exchangedb/perf_taler_exchangedb_interpreter.c
+++ b/src/exchangedb/perf_taler_exchangedb_interpreter.c
@@ -1620,7 +1620,6 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
state->session,
state->cmd[hash_index].exposed.data.session_hash,
1,
- 1,
refresh_commit);
GNUNET_assert (GNUNET_OK == ret);
}
@@ -1636,7 +1635,6 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
state->session,
state->cmd[hash_index].exposed.data.session_hash,
1,
- 1,
&refresh_commit);
}
@@ -1656,12 +1654,12 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
unsigned int hash_index;
struct TALER_EXCHANGEDB_RefreshCommitCoin commit_coin;
+ // FIXME: this should go after the public key!
hash_index = state->cmd[state->i].details.get_refresh_commit_link.index_hash;
ret = state->plugin->get_refresh_commit_coins(state->plugin->cls,
state->session,
state->cmd[hash_index].exposed.data.session_hash,
1,
- 1,
&commit_coin);
GNUNET_assert (GNUNET_SYSERR != ret);
}
diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c
index bb6801e80..1aa77a481 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -132,40 +132,4 @@ common_free_coin_transaction_list (void *cls,
}
-/**
- * Free melt commitment data.
- *
- * @param cls the @e cls of this struct with the plugin-specific state (unused)
- * @param mc data structure to free
- */
-static void
-common_free_melt_commitment (void *cls,
- struct TALER_EXCHANGEDB_MeltCommitment *mc)
-{
- unsigned int i;
- unsigned int k;
-
- if (NULL != mc->denom_pubs)
- {
- for (i=0;i<mc->num_newcoins;i++)
- if (NULL != mc->denom_pubs[i].rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (mc->denom_pubs[i].rsa_public_key);
- GNUNET_free (mc->denom_pubs);
- }
- for (k=0;k<TALER_CNC_KAPPA;k++)
- {
- if (NULL != mc->commit_coins[k])
- {
- for (i=0;i<mc->num_newcoins;i++)
- {
- /* NOTE: 'non_null' because this API is used also
- internally to clean up the struct on failures! */
- GNUNET_free_non_null (mc->commit_coins[k][i].coin_ev);
- }
- GNUNET_free (mc->commit_coins[k]);
- }
- }
- GNUNET_free (mc);
-}
-
/* end of plugin_exchangedb_common.c */
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 0c4f908c3..bd8670eb7 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -386,29 +386,24 @@ postgres_create_tables (void *cls)
as well as the actual link data (the transfer public key and the encrypted
link secret) */
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_transfer_public_key "
- "(session_hash BYTEA NOT NULL REFERENCES refresh_sessions (session_hash) ON DELETE CASCADE"
+ "(session_hash BYTEA NOT NULL PRIMARY KEY REFERENCES refresh_sessions (session_hash) ON DELETE CASCADE"
",transfer_pub BYTEA NOT NULL CHECK(LENGTH(transfer_pub)=32)"
- ",cnc_index INT2 NOT NULL"
- ",UNIQUE (session_hash, cnc_index)"
")");
- SQLEXEC_INDEX("CREATE INDEX refresh_transfer_public_key_index "
- "ON refresh_transfer_public_key(session_hash, cnc_index)");
/* Table with the commitments for the new coins that are to be created
during a melting session. Includes the session, the cut-and-choose
index and the index of the new coin, and the envelope of the new
coin to be signed, as well as the encrypted information about the
private key and the blinding factor for the coin (for verification
- in case this cnc_index is chosen to be revealed) */
+ in case this newcoin_index is chosen to be revealed) */
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_commit_coin "
"(session_hash BYTEA NOT NULL REFERENCES refresh_sessions (session_hash) ON DELETE CASCADE"
- ",cnc_index INT2 NOT NULL"
",newcoin_index INT2 NOT NULL"
",coin_ev BYTEA NOT NULL"
- ",UNIQUE (session_hash, cnc_index, newcoin_index)"
+ ",UNIQUE (session_hash, newcoin_index)"
")");
SQLEXEC_INDEX("CREATE INDEX refresh_commit_coin_session_hash_index "
- "ON refresh_commit_coin(session_hash, cnc_index, newcoin_index)");
+ "ON refresh_commit_coin(session_hash, newcoin_index)");
/* Table with the signatures over coins generated during a refresh
@@ -831,9 +826,8 @@ postgres_prepare (PGconn *db_conn)
"INSERT INTO refresh_transfer_public_key "
"(session_hash"
",transfer_pub"
- ",cnc_index"
") VALUES "
- "($1, $2, $3);",
+ "($1, $2);",
3, NULL);
/* Used in #postgres_get_refresh_transfer_public_key() to
@@ -842,20 +836,19 @@ postgres_prepare (PGconn *db_conn)
"SELECT"
" transfer_pub"
" FROM refresh_transfer_public_key"
- " WHERE session_hash=$1 AND cnc_index=$2",
- 2, NULL);
+ " WHERE session_hash=$1",
+ 1, NULL);
/* Used in #postgres_insert_refresh_commit_coins() to
store coin commitments. */
PREPARE ("insert_refresh_commit_coin",
"INSERT INTO refresh_commit_coin "
"(session_hash"
- ",cnc_index"
",newcoin_index"
",coin_ev"
") VALUES "
- "($1, $2, $3, $4);",
- 4, NULL);
+ "($1, $2, $3);",
+ 3, NULL);
/* Used in #postgres_get_refresh_commit_coins() to
retrieve the original coin envelopes, to either be
@@ -864,8 +857,8 @@ postgres_prepare (PGconn *db_conn)
"SELECT"
" coin_ev"
" FROM refresh_commit_coin"
- " WHERE session_hash=$1 AND cnc_index=$2 AND newcoin_index=$3",
- 3, NULL);
+ " WHERE session_hash=$1 AND newcoin_index=$2",
+ 2, NULL);
/* Store information about a /deposit the exchange is to execute.
Used in #postgres_insert_deposit(). */
@@ -1081,8 +1074,7 @@ postgres_prepare (PGconn *db_conn)
" JOIN refresh_out rc USING (session_hash)"
" WHERE ro.session_hash=$1"
" AND ro.newcoin_index=rcc.newcoin_index"
- " AND ro.newcoin_index=rc.newcoin_index"
- " AND rcc.cnc_index=rs.noreveal_index",
+ " AND ro.newcoin_index=rc.newcoin_index",
1, NULL);
/* Used in #postgres_get_transfer(). Given the public key of a
@@ -1096,8 +1088,7 @@ postgres_prepare (PGconn *db_conn)
"SELECT transfer_pub,session_hash"
" FROM refresh_sessions rs"
" JOIN refresh_transfer_public_key rcl USING (session_hash)"
- " WHERE rs.old_coin_pub=$1"
- " AND rcl.cnc_index=rs.noreveal_index",
+ " WHERE rs.old_coin_pub=$1",
1, NULL);
/* Used in #postgres_lookup_wire_transfer */
@@ -3045,7 +3036,6 @@ postgres_get_refresh_order (void *cls,
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection to use
* @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose index (1st dimension)
* @param num_newcoins coin index size of the @a commit_coins array
* @param commit_coins array of coin commitments to store
* @return #GNUNET_OK on success
@@ -3055,7 +3045,6 @@ static int
postgres_insert_refresh_commit_coins (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
uint16_t num_newcoins,
const struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins)
{
@@ -3069,7 +3058,6 @@ postgres_insert_refresh_commit_coins (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (session_hash),
- GNUNET_PQ_query_param_uint16 (&cnc_index),
GNUNET_PQ_query_param_uint16 (&coin_off),
GNUNET_PQ_query_param_fixed_size (commit_coins[i].coin_ev,
commit_coins[i].coin_ev_size),
@@ -3128,7 +3116,6 @@ postgres_free_refresh_commit_coins (void *cls,
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection to use
* @param session_hash hash to identify refresh session
- * @param cnc_index set index (1st dimension)
* @param num_newcoins size of the @a commit_coins array
* @param[out] commit_coins array of coin commitments to return
* @return #GNUNET_OK on success
@@ -3139,7 +3126,6 @@ static int
postgres_get_refresh_commit_coins (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
uint16_t num_newcoins,
struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins)
{
@@ -3150,7 +3136,6 @@ postgres_get_refresh_commit_coins (void *cls,
uint16_t newcoin_off = (uint16_t) i;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (session_hash),
- GNUNET_PQ_query_param_uint16 (&cnc_index),
GNUNET_PQ_query_param_uint16 (&newcoin_off),
GNUNET_PQ_query_param_end
};
@@ -3205,7 +3190,6 @@ postgres_get_refresh_commit_coins (void *cls,
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection to use
* @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose index (1st dimension)
* @param tp transfer public key to store
* @return #GNUNET_SYSERR on internal error, #GNUNET_OK on success
*/
@@ -3213,13 +3197,11 @@ static int
postgres_insert_refresh_transfer_public_key (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
const struct TALER_TransferPublicKeyP *tp)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (session_hash),
GNUNET_PQ_query_param_auto_from_type (tp),
- GNUNET_PQ_query_param_uint16 (&cnc_index),
GNUNET_PQ_query_param_end
};
@@ -3252,7 +3234,6 @@ postgres_insert_refresh_transfer_public_key (void *cls,
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection to use
* @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose index (1st dimension)
* @param[out] tp information to return
* @return #GNUNET_SYSERR on internal error,
* #GNUNET_NO if commitment was not found
@@ -3262,12 +3243,10 @@ static int
postgres_get_refresh_transfer_public_key (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
struct TALER_TransferPublicKeyP *tp)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (session_hash),
- GNUNET_PQ_query_param_uint16 (&cnc_index),
GNUNET_PQ_query_param_end
};
PGresult *result;
@@ -3306,83 +3285,6 @@ postgres_get_refresh_transfer_public_key (void *cls,
/**
- * Get all of the information from the given melt commit operation.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param session database connection to use
- * @param session_hash hash to identify refresh session
- * @return NULL if the @a session_hash does not correspond to any known melt
- * operation
- */
-static struct TALER_EXCHANGEDB_MeltCommitment *
-postgres_get_melt_commitment (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash)
-{
- struct TALER_EXCHANGEDB_RefreshSession rs;
- struct TALER_EXCHANGEDB_MeltCommitment *mc;
- uint16_t cnc_index;
-
- if (GNUNET_OK !=
- postgres_get_refresh_session (cls,
- session,
- session_hash,
- &rs))
- return NULL;
- /* we don't care about most of 'rs' */
- GNUNET_CRYPTO_rsa_public_key_free (rs.melt.coin.denom_pub.rsa_public_key);
- GNUNET_CRYPTO_rsa_signature_free (rs.melt.coin.denom_sig.rsa_signature);
- mc = GNUNET_new (struct TALER_EXCHANGEDB_MeltCommitment);
- mc->num_newcoins = rs.num_newcoins;
- mc->denom_pubs = GNUNET_new_array (mc->num_newcoins,
- struct TALER_DenominationPublicKey);
- if (GNUNET_OK !=
- postgres_get_refresh_order (cls,
- session,
- session_hash,
- mc->num_newcoins,
- mc->denom_pubs))
- {
- GNUNET_break (0);
- goto cleanup;
- }
- for (cnc_index=0;cnc_index<TALER_CNC_KAPPA;cnc_index++)
- {
- mc->commit_coins[cnc_index]
- = GNUNET_new_array (mc->num_newcoins,
- struct TALER_EXCHANGEDB_RefreshCommitCoin);
- if (GNUNET_OK !=
- postgres_get_refresh_commit_coins (cls,
- session,
- session_hash,
- cnc_index,
- mc->num_newcoins,
- mc->commit_coins[cnc_index]))
- {
- GNUNET_break (0);
- goto cleanup;
- }
- if (GNUNET_OK !=
- postgres_get_refresh_transfer_public_key (cls,
- session,
- session_hash,
- cnc_index,
- &mc->transfer_pubs[cnc_index]))
- {
- GNUNET_break (0);
- goto cleanup;
- }
- }
- return mc;
-
- cleanup:
- common_free_melt_commitment (cls, mc);
- GNUNET_break (0);
- return NULL;
-}
-
-
-/**
* Insert signature of a new coin generated during refresh into
* the database indexed by the refresh session and the index
* of the coin. This data is later used should an old coin
@@ -4410,8 +4312,6 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->free_refresh_commit_coins = &postgres_free_refresh_commit_coins;
plugin->insert_refresh_transfer_public_key = &postgres_insert_refresh_transfer_public_key;
plugin->get_refresh_transfer_public_key = &postgres_get_refresh_transfer_public_key;
- plugin->get_melt_commitment = &postgres_get_melt_commitment;
- plugin->free_melt_commitment = &common_free_melt_commitment;
plugin->insert_refresh_out = &postgres_insert_refresh_out;
plugin->get_link_data_list = &postgres_get_link_data_list;
plugin->free_link_data_list = &common_free_link_data_list;
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index a053c87f4..828659ba3 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -298,28 +298,6 @@ static struct TALER_Amount amount_with_fee;
/**
- * Compare two coin commitments.
- *
- * @param rc1 first commitment
- * @param rc2 second commitment
- * @return 0 if they are equal
- */
-static int
-commit_coin_cmp (struct TALER_EXCHANGEDB_RefreshCommitCoin *rc1,
- struct TALER_EXCHANGEDB_RefreshCommitCoin *rc2)
-{
- FAILIF (rc1->coin_ev_size != rc2->coin_ev_size);
- FAILIF (0 != memcmp (rc1->coin_ev,
- rc2->coin_ev,
- rc2->coin_ev_size));
- return 0;
- drop:
- GNUNET_break (0);
- return 1;
-}
-
-
-/**
* Number of newly minted coins to use in the test.
*/
#define MELT_NEW_COINS 5
@@ -330,7 +308,7 @@ commit_coin_cmp (struct TALER_EXCHANGEDB_RefreshCommitCoin *rc1,
#define MELT_NOREVEAL_INDEX 1
-static struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins[TALER_CNC_KAPPA];
+static struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins;
/**
* Test APIs related to the "insert_refresh_commit_coins" function.
@@ -349,61 +327,54 @@ test_refresh_commit_coins (struct TALER_EXCHANGEDB_Session *session,
struct TALER_EXCHANGEDB_RefreshCommitCoin *a_ccoin;
struct TALER_EXCHANGEDB_RefreshCommitCoin *b_ccoin;
unsigned int cnt;
- uint16_t cnc_index;
int ret;
#define COIN_ENC_MAX_SIZE 512
ret = GNUNET_SYSERR;
ret_commit_coins = NULL;
- for (cnc_index=0;cnc_index < TALER_CNC_KAPPA; cnc_index++)
+ commit_coins
+ = GNUNET_new_array (MELT_NEW_COINS,
+ struct TALER_EXCHANGEDB_RefreshCommitCoin);
+ for (cnt=0; cnt < MELT_NEW_COINS; cnt++)
{
- commit_coins[cnc_index]
- = GNUNET_new_array (MELT_NEW_COINS,
- struct TALER_EXCHANGEDB_RefreshCommitCoin);
- for (cnt=0; cnt < MELT_NEW_COINS; cnt++)
- {
- struct TALER_EXCHANGEDB_RefreshCommitCoin *ccoin;
-
- ccoin = &commit_coins[cnc_index][cnt];
- ccoin->coin_ev_size = GNUNET_CRYPTO_random_u64
- (GNUNET_CRYPTO_QUALITY_WEAK, COIN_ENC_MAX_SIZE);
- ccoin->coin_ev = GNUNET_malloc (ccoin->coin_ev_size);
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- ccoin->coin_ev,
- ccoin->coin_ev_size);
- }
- FAILIF (GNUNET_OK !=
- plugin->insert_refresh_commit_coins (plugin->cls,
- session,
- session_hash,
- cnc_index,
- MELT_NEW_COINS,
- commit_coins[cnc_index]));
- ret_commit_coins = GNUNET_new_array (MELT_NEW_COINS,
- struct TALER_EXCHANGEDB_RefreshCommitCoin);
- FAILIF (GNUNET_OK !=
- plugin->get_refresh_commit_coins (plugin->cls,
- session,
- session_hash,
- cnc_index,
- MELT_NEW_COINS,
- ret_commit_coins));
- /* compare the refresh commit coin arrays */
- for (cnt = 0; cnt < MELT_NEW_COINS; cnt++)
- {
- a_ccoin = &commit_coins[cnc_index][cnt];
- b_ccoin = &ret_commit_coins[cnt];
- FAILIF (a_ccoin->coin_ev_size != b_ccoin->coin_ev_size);
- FAILIF (0 != memcmp (a_ccoin->coin_ev,
- a_ccoin->coin_ev,
- a_ccoin->coin_ev_size));
- GNUNET_free (ret_commit_coins[cnt].coin_ev);
- }
- GNUNET_free (ret_commit_coins);
- ret_commit_coins = NULL;
+ struct TALER_EXCHANGEDB_RefreshCommitCoin *ccoin;
+
+ ccoin = &commit_coins[cnt];
+ ccoin->coin_ev_size = GNUNET_CRYPTO_random_u64
+ (GNUNET_CRYPTO_QUALITY_WEAK, COIN_ENC_MAX_SIZE);
+ ccoin->coin_ev = GNUNET_malloc (ccoin->coin_ev_size);
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ ccoin->coin_ev,
+ ccoin->coin_ev_size);
+ }
+ FAILIF (GNUNET_OK !=
+ plugin->insert_refresh_commit_coins (plugin->cls,
+ session,
+ session_hash,
+ MELT_NEW_COINS,
+ commit_coins));
+ ret_commit_coins = GNUNET_new_array (MELT_NEW_COINS,
+ struct TALER_EXCHANGEDB_RefreshCommitCoin);
+ FAILIF (GNUNET_OK !=
+ plugin->get_refresh_commit_coins (plugin->cls,
+ session,
+ session_hash,
+ MELT_NEW_COINS,
+ ret_commit_coins));
+ /* compare the refresh commit coin arrays */
+ for (cnt = 0; cnt < MELT_NEW_COINS; cnt++)
+ {
+ a_ccoin = &commit_coins[cnt];
+ b_ccoin = &ret_commit_coins[cnt];
+ FAILIF (a_ccoin->coin_ev_size != b_ccoin->coin_ev_size);
+ FAILIF (0 != memcmp (a_ccoin->coin_ev,
+ a_ccoin->coin_ev,
+ a_ccoin->coin_ev_size));
+ GNUNET_free (ret_commit_coins[cnt].coin_ev);
}
+ GNUNET_free (ret_commit_coins);
+ ret_commit_coins = NULL;
ret = GNUNET_OK;
-
drop:
if (NULL != ret_commit_coins)
{
@@ -433,37 +404,31 @@ test_refresh_commit_links (struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *session_hash)
{
int ret;
- unsigned int i;
struct TALER_TransferPublicKeyP tp;
+ unsigned int i;
ret = GNUNET_SYSERR;
FAILIF (GNUNET_NO !=
plugin->get_refresh_transfer_public_key (plugin->cls,
session,
session_hash,
- MELT_NOREVEAL_INDEX,
&tp));
for (i=0;i<TALER_CNC_KAPPA;i++)
- {
RND_BLK (&rctp[i]);
- FAILIF (GNUNET_OK !=
- plugin->insert_refresh_transfer_public_key (plugin->cls,
- session,
- session_hash,
- i,
- &rctp[i]));
-
- FAILIF (GNUNET_OK !=
- plugin->get_refresh_transfer_public_key (plugin->cls,
- session,
- session_hash,
- i,
- &tp));
- FAILIF (0 !=
- memcmp (&rctp[i],
- &tp,
- sizeof (struct TALER_TransferPublicKeyP)));
- }
+ FAILIF (GNUNET_OK !=
+ plugin->insert_refresh_transfer_public_key (plugin->cls,
+ session,
+ session_hash,
+ &rctp[MELT_NOREVEAL_INDEX]));
+ FAILIF (GNUNET_OK !=
+ plugin->get_refresh_transfer_public_key (plugin->cls,
+ session,
+ session_hash,
+ &tp));
+ FAILIF (0 !=
+ memcmp (&rctp[MELT_NOREVEAL_INDEX],
+ &tp,
+ sizeof (struct TALER_TransferPublicKeyP)));
ret = GNUNET_OK;
drop:
return ret;
@@ -519,12 +484,10 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
struct TALER_EXCHANGEDB_RefreshMelt *meltp;
struct TALER_DenominationPublicKey *new_denom_pubs;
struct TALER_DenominationPublicKey *ret_denom_pubs;
- struct TALER_EXCHANGEDB_MeltCommitment *mc;
struct TALER_EXCHANGEDB_LinkDataList *ldl;
struct TALER_EXCHANGEDB_LinkDataList *ldlp;
struct TALER_DenominationSignature ev_sigs[MELT_NEW_COINS];
unsigned int cnt;
- unsigned int i;
int ret;
ret = GNUNET_SYSERR;
@@ -648,34 +611,6 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
&refresh_session,
&session_hash));
- /* checking 'get_melt_commitment' API */
- mc = plugin->get_melt_commitment (plugin->cls,
- session,
- &session_hash);
- FAILIF (NULL == mc);
- FAILIF (MELT_NEW_COINS != mc->num_newcoins);
- for (cnt=0; cnt < MELT_NEW_COINS; cnt++)
- {
- FAILIF (0 !=
- GNUNET_CRYPTO_rsa_public_key_cmp (new_dkp[cnt]->pub.rsa_public_key,
- mc->denom_pubs[cnt].rsa_public_key));
- for (i=0;i<TALER_CNC_KAPPA;i++)
- {
- FAILIF (0 !=
- commit_coin_cmp (&mc->commit_coins[i][cnt],
- &commit_coins[i][cnt]));
- }
- }
- for (i=0;i<TALER_CNC_KAPPA;i++)
- {
- FAILIF (0 !=
- memcmp (&rctp[i],
- &mc->transfer_pubs[i],
- sizeof (struct TALER_TransferPublicKeyP)));
- }
- plugin->free_melt_commitment (plugin->cls,
- mc);
-
for (cnt=0; cnt < MELT_NEW_COINS; cnt++)
{
struct GNUNET_HashCode hc;
@@ -738,15 +673,14 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
drop:
for (cnt=0; cnt < MELT_NEW_COINS; cnt++)
GNUNET_CRYPTO_rsa_signature_free (ev_sigs[cnt].rsa_signature);
- for (cnt=0;cnt<TALER_CNC_KAPPA;cnt++)
- if (NULL != commit_coins[cnt])
- {
- plugin->free_refresh_commit_coins (plugin->cls,
- MELT_NEW_COINS,
- commit_coins[cnt]);
- GNUNET_free (commit_coins[cnt]);
- commit_coins[cnt] = NULL;
- }
+ if (NULL != commit_coins)
+ {
+ plugin->free_refresh_commit_coins (plugin->cls,
+ MELT_NEW_COINS,
+ commit_coins);
+ GNUNET_free (commit_coins);
+ commit_coins = NULL;
+ }
destroy_denom_key_pair (dkp);
GNUNET_CRYPTO_rsa_signature_free (meltp->coin.denom_sig.rsa_signature);
for (cnt = 0;