aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/perf_taler_exchangedb_init.c28
-rw-r--r--src/exchangedb/perf_taler_exchangedb_interpreter.c5
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c10
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c82
-rw-r--r--src/exchangedb/test_exchangedb.c28
5 files changed, 62 insertions, 91 deletions
diff --git a/src/exchangedb/perf_taler_exchangedb_init.c b/src/exchangedb/perf_taler_exchangedb_init.c
index 789aaea00..089536a45 100644
--- a/src/exchangedb/perf_taler_exchangedb_init.c
+++ b/src/exchangedb/perf_taler_exchangedb_init.c
@@ -263,9 +263,7 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi
&deposit_fee));
{
deposit->coin.coin_pub = coin->public_info.coin_pub;
- deposit->coin.denom_pub.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (
- coin->public_info.denom_pub.rsa_public_key);
- GNUNET_assert (NULL != coin->public_info.denom_pub.rsa_public_key);
+ deposit->coin.denom_pub_hash = coin->public_info.denom_pub_hash;
deposit->coin.denom_sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_dup (
coin->public_info.denom_sig.rsa_signature);
GNUNET_assert (NULL != coin->public_info.denom_sig.rsa_signature);
@@ -298,8 +296,6 @@ PERF_TALER_EXCHANGEDB_deposit_copy (const struct TALER_EXCHANGEDB_Deposit *depos
copy = GNUNET_new (struct TALER_EXCHANGEDB_Deposit);
*copy = *deposit;
copy->receiver_wire_account = json_incref (deposit->receiver_wire_account);
- copy->coin.denom_pub.rsa_public_key =
- GNUNET_CRYPTO_rsa_public_key_dup (deposit->coin.denom_pub.rsa_public_key);
copy->coin.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (deposit->coin.denom_sig.rsa_signature);
return copy;
@@ -315,7 +311,6 @@ PERF_TALER_EXCHANGEDB_deposit_free (struct TALER_EXCHANGEDB_Deposit *deposit)
{
if (NULL == deposit)
return GNUNET_OK;
- GNUNET_CRYPTO_rsa_public_key_free (deposit->coin.denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_signature_free (deposit->coin.denom_sig.rsa_signature);
json_decref (deposit->receiver_wire_account);
GNUNET_free (deposit);
@@ -350,24 +345,21 @@ PERF_TALER_EXCHANGEDB_coin_init (
/* public_info */
GNUNET_CRYPTO_eddsa_key_get_public (&coin->priv,
&coin->public_info.coin_pub.eddsa_pub);
- coin->public_info.denom_pub.rsa_public_key =
- GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key);
+ GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
+ &coin->public_info.denom_pub_hash);
GNUNET_CRYPTO_hash (&coin->public_info.coin_pub,
sizeof (struct TALER_CoinSpendPublicKeyP),
&hc);
coin->public_info.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_sign_fdh (dki->denom_priv.rsa_private_key,
&hc);
- GNUNET_assert (NULL != coin->public_info.denom_pub.rsa_public_key);
GNUNET_assert (NULL != coin->public_info.denom_sig.rsa_signature);
/* blind */
coin->blind.sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->public_info.denom_sig.rsa_signature);
- coin->blind.denom_pub.rsa_public_key =
- GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key);
+ coin->blind.denom_pub_hash = coin->public_info.denom_pub_hash;
GNUNET_assert (NULL != coin->blind.sig.rsa_signature);
- GNUNET_assert (NULL != coin->blind.denom_pub.rsa_public_key);
TALER_amount_ntoh (&coin->blind.amount_with_fee,
&dki->issue.properties.value);
TALER_amount_ntoh (&coin->blind.withdraw_fee,
@@ -396,16 +388,14 @@ PERF_TALER_EXCHANGEDB_coin_copy (const struct PERF_TALER_EXCHANGEDB_Coin *coin)
copy->priv = coin->priv;
/* public_info */
copy->public_info.coin_pub = coin->public_info.coin_pub;
- copy->public_info.denom_pub.rsa_public_key =
- GNUNET_CRYPTO_rsa_public_key_dup (coin->public_info.denom_pub.rsa_public_key);
+ copy->public_info.denom_pub_hash = coin->public_info.denom_pub_hash;
copy->public_info.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->public_info.denom_sig.rsa_signature);
/* blind */
copy->blind.sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->blind.sig.rsa_signature);
- copy->blind.denom_pub.rsa_public_key =
- GNUNET_CRYPTO_rsa_public_key_dup (coin->blind.denom_pub.rsa_public_key);
+ copy->blind.denom_pub_hash = coin->blind.denom_pub_hash;
copy->blind.amount_with_fee = coin->blind.amount_with_fee;
copy->blind.withdraw_fee = coin->blind.withdraw_fee;
copy->blind.reserve_pub = coin->blind.reserve_pub;
@@ -426,10 +416,8 @@ PERF_TALER_EXCHANGEDB_coin_free (struct PERF_TALER_EXCHANGEDB_Coin *coin)
{
if (NULL == coin)
return GNUNET_OK;
- GNUNET_CRYPTO_rsa_public_key_free (coin->public_info.denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_signature_free (coin->public_info.denom_sig.rsa_signature);
GNUNET_CRYPTO_rsa_signature_free (coin->blind.sig.rsa_signature);
- GNUNET_CRYPTO_rsa_public_key_free (coin->blind.denom_pub.rsa_public_key);
GNUNET_free (coin);
return GNUNET_OK;
}
@@ -475,9 +463,7 @@ PERF_TALER_EXCHANGEDB_refresh_melt_init (struct TALER_RefreshCommitmentP *rc,
melt->session.coin.coin_pub = coin->public_info.coin_pub;
melt->session.coin.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_signature_dup (coin->public_info.denom_sig.rsa_signature);
- melt->session.coin.denom_pub.rsa_public_key =
- GNUNET_CRYPTO_rsa_public_key_dup (coin->public_info.denom_pub.rsa_public_key);
- GNUNET_assert (NULL != melt->session.coin.denom_pub.rsa_public_key);
+ melt->session.coin.denom_pub_hash = coin->public_info.denom_pub_hash;
GNUNET_assert (NULL != melt->session.coin.denom_sig.rsa_signature);
melt->session.coin_sig = coin_sig;
melt->session.rc = *rc;
diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.c b/src/exchangedb/perf_taler_exchangedb_interpreter.c
index cdd5a5fc1..6c968410b 100644
--- a/src/exchangedb/perf_taler_exchangedb_interpreter.c
+++ b/src/exchangedb/perf_taler_exchangedb_interpreter.c
@@ -1342,12 +1342,15 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
unsigned int denom_index;
enum GNUNET_DB_QueryStatus qs;
struct PERF_TALER_EXCHANGEDB_Data *data;
+ struct GNUNET_HashCode hc;
denom_index = state->cmd[state->i].details.get_denomination.index_denom;
data = &state->cmd[denom_index].exposed;
+ GNUNET_CRYPTO_rsa_public_key_hash (data->data.dki->denom_pub.rsa_public_key,
+ &hc);
qs = state->plugin->get_denomination_info (state->plugin->cls,
state->session,
- &data->data.dki->denom_pub,
+ &hc,
&data->data.dki->issue);
GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
}
diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c
index 26515670a..fd2620c7b 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -49,13 +49,11 @@ common_free_reserve_history (void *cls,
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
cbc = rh->details.withdraw;
GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
- GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub.rsa_public_key);
GNUNET_free (cbc);
break;
case TALER_EXCHANGEDB_RO_PAYBACK_COIN:
payback = rh->details.payback;
GNUNET_CRYPTO_rsa_signature_free (payback->coin.denom_sig.rsa_signature);
- GNUNET_CRYPTO_rsa_public_key_free (payback->coin.denom_pub.rsa_public_key);
GNUNET_free (payback);
break;
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
@@ -92,29 +90,21 @@ common_free_coin_transaction_list (void *cls,
case TALER_EXCHANGEDB_TT_DEPOSIT:
if (NULL != list->details.deposit->receiver_wire_account)
json_decref (list->details.deposit->receiver_wire_account);
- if (NULL != list->details.deposit->coin.denom_pub.rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (list->details.deposit->coin.denom_pub.rsa_public_key);
if (NULL != list->details.deposit->coin.denom_sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (list->details.deposit->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.deposit);
break;
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
- if (NULL != list->details.melt->session.coin.denom_pub.rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (list->details.melt->session.coin.denom_pub.rsa_public_key);
if (NULL != list->details.melt->session.coin.denom_sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (list->details.melt->session.coin.denom_sig.rsa_signature);
GNUNET_free (list->details.melt);
break;
case TALER_EXCHANGEDB_TT_REFUND:
- if (NULL != list->details.refund->coin.denom_pub.rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (list->details.refund->coin.denom_pub.rsa_public_key);
if (NULL != list->details.refund->coin.denom_sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (list->details.refund->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.refund);
break;
case TALER_EXCHANGEDB_TT_PAYBACK:
- if (NULL != list->details.payback->coin.denom_pub.rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (list->details.payback->coin.denom_pub.rsa_public_key);
if (NULL != list->details.payback->coin.denom_sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (list->details.payback->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.payback);
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 82308ea86..9dc8eb2f3 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -766,7 +766,7 @@ postgres_prepare (PGconn *db_conn)
make sure /reserve/withdraw requests are idempotent. */
GNUNET_PQ_make_prepare ("get_withdraw_info",
"SELECT"
- " denom.denom_pub"
+ " denom_pub_hash"
",denom_sig"
",reserve_sig"
",reserve_pub"
@@ -790,7 +790,7 @@ postgres_prepare (PGconn *db_conn)
GNUNET_PQ_make_prepare ("get_reserves_out",
"SELECT"
" h_blind_ev"
- ",denom.denom_pub"
+ ",denom_pub_hash"
",denom_sig"
",reserve_sig"
",execution_date"
@@ -838,11 +838,9 @@ postgres_prepare (PGconn *db_conn)
a coin known to the exchange. */
GNUNET_PQ_make_prepare ("get_known_coin",
"SELECT"
- " denom.denom_pub"
+ " denom_pub_hash"
",denom_sig"
" FROM known_coins"
- " JOIN denominations denom"
- " USING (denom_pub_hash)"
" WHERE coin_pub=$1"
" FOR UPDATE;",
1),
@@ -876,7 +874,7 @@ postgres_prepare (PGconn *db_conn)
high-level information about a melt operation */
GNUNET_PQ_make_prepare ("get_melt",
"SELECT"
- " denom.denom_pub"
+ " kc.denom_pub_hash"
",denom.fee_refresh_val"
",denom.fee_refresh_frac"
",denom.fee_refresh_curr"
@@ -1518,6 +1516,7 @@ postgres_prepare (PGconn *db_conn)
",coin_sig"
",coin_blind"
",h_blind_ev"
+ ",coins.denom_pub_hash"
",denoms.denom_pub"
",coins.denom_sig"
",amount_val"
@@ -1526,10 +1525,10 @@ postgres_prepare (PGconn *db_conn)
" FROM payback"
" JOIN known_coins coins"
" USING (coin_pub)"
- " JOIN denominations denoms"
- " USING (denom_pub_hash)"
" JOIN reserves_out ro"
" USING (h_blind_ev)"
+ " JOIN denominations denoms"
+ " ON (coins.denom_pub_hash = denoms.denom_pub_hash)"
" WHERE payback_uuid>=$1"
" ORDER BY payback_uuid ASC;",
1),
@@ -1563,13 +1562,11 @@ postgres_prepare (PGconn *db_conn)
",amount_frac"
",amount_curr"
",timestamp"
- ",denoms.denom_pub"
+ ",coins.denom_pub_hash"
",coins.denom_sig"
" FROM payback"
" JOIN known_coins coins"
" USING (coin_pub)"
- " JOIN denominations denoms"
- " USING (denom_pub_hash)"
" JOIN reserves_out ro"
" USING (h_blind_ev)"
" WHERE ro.reserve_pub=$1"
@@ -1618,13 +1615,11 @@ postgres_prepare (PGconn *db_conn)
",amount_frac"
",amount_curr"
",timestamp"
- ",denoms.denom_pub"
+ ",coins.denom_pub_hash"
",coins.denom_sig"
" FROM payback"
" JOIN known_coins coins"
" USING (coin_pub)"
- " JOIN denominations denoms"
- " USING (denom_pub_hash)"
" JOIN reserves_out ro"
" USING (h_blind_ev)"
" WHERE payback.coin_pub=$1;",
@@ -1947,20 +1942,19 @@ postgres_insert_denomination_info (void *cls,
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param session connection to use
- * @param denom_pub the public key used for signing coins of this denomination
+ * @param denom_pub_hash hash of the public key used for signing coins of this denomination
* @param[out] issue set to issue information with value, fees and other info about the coin
* @return transaction status code
*/
static enum GNUNET_DB_QueryStatus
postgres_get_denomination_info (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_DenominationPublicKey *denom_pub,
+ const struct GNUNET_HashCode *denom_pub_hash,
struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_HashCode dph;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (&dph),
+ GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1989,8 +1983,6 @@ postgres_get_denomination_info (void *cls,
GNUNET_PQ_result_spec_end
};
- GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
- &dph);
qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn,
"denomination_get",
params,
@@ -1999,8 +1991,7 @@ postgres_get_denomination_info (void *cls,
return qs;
issue->properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
issue->properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
- GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
- &issue->properties.denom_hash);
+ issue->properties.denom_hash = *denom_pub_hash;
return qs;
}
@@ -2394,10 +2385,10 @@ postgres_get_withdraw_info (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &collectable->denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &collectable->denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &collectable->sig.rsa_signature),
+ &collectable->sig.rsa_signature),
GNUNET_PQ_result_spec_auto_from_type ("reserve_sig",
&collectable->reserve_sig),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
@@ -2434,12 +2425,11 @@ postgres_insert_withdraw_info (void *cls,
{
struct PostgresClosure *pg = cls;
struct TALER_EXCHANGEDB_Reserve reserve;
- struct GNUNET_HashCode denom_pub_hash;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute expiry;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&collectable->h_coin_envelope),
- GNUNET_PQ_query_param_auto_from_type (&denom_pub_hash),
+ GNUNET_PQ_query_param_auto_from_type (&collectable->denom_pub_hash),
GNUNET_PQ_query_param_rsa_signature (collectable->sig.rsa_signature),
GNUNET_PQ_query_param_auto_from_type (&collectable->reserve_pub),
GNUNET_PQ_query_param_auto_from_type (&collectable->reserve_sig),
@@ -2451,8 +2441,6 @@ postgres_insert_withdraw_info (void *cls,
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
- GNUNET_CRYPTO_rsa_public_key_hash (collectable->denom_pub.rsa_public_key,
- &denom_pub_hash);
qs = GNUNET_PQ_eval_prepared_non_select (session->conn,
"insert_withdraw_info",
params);
@@ -2638,8 +2626,8 @@ add_withdraw_coin (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("h_blind_ev",
&cbc->h_coin_envelope),
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &cbc->denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &cbc->denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&cbc->sig.rsa_signature),
GNUNET_PQ_result_spec_auto_from_type ("reserve_sig",
@@ -2692,7 +2680,7 @@ add_payback (void *cls,
payback = GNUNET_new (struct TALER_EXCHANGEDB_Payback);
{
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_amount ("amount",
+ TALER_PQ_result_spec_amount ("amount",
&payback->value),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&payback->coin.coin_pub),
@@ -2702,10 +2690,10 @@ add_payback (void *cls,
&payback->coin_sig),
TALER_PQ_result_spec_absolute_time ("timestamp",
&payback->timestamp),
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &payback->coin.denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &payback->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &payback->coin.denom_sig.rsa_signature),
+ &payback->coin.denom_sig.rsa_signature),
GNUNET_PQ_result_spec_end
};
@@ -3291,8 +3279,8 @@ get_known_coin (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &coin_info->denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &coin_info->denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&coin_info->denom_sig.rsa_signature),
GNUNET_PQ_result_spec_end
@@ -3324,10 +3312,9 @@ insert_known_coin (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinPublicInfo *coin_info)
{
- struct GNUNET_HashCode denom_pub_hash;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&coin_info->coin_pub),
- GNUNET_PQ_query_param_auto_from_type (&denom_pub_hash),
+ GNUNET_PQ_query_param_auto_from_type (&coin_info->denom_pub_hash),
GNUNET_PQ_query_param_rsa_signature (coin_info->denom_sig.rsa_signature),
GNUNET_PQ_query_param_end
};
@@ -3335,8 +3322,6 @@ insert_known_coin (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating known coin %s\n",
TALER_B2S (&coin_info->coin_pub));
- GNUNET_CRYPTO_rsa_public_key_hash (coin_info->denom_pub.rsa_public_key,
- &denom_pub_hash);
return GNUNET_PQ_eval_prepared_non_select (session->conn,
"insert_known_coin",
params);
@@ -3407,7 +3392,6 @@ postgres_ensure_coin_known (void *cls,
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
- GNUNET_CRYPTO_rsa_public_key_free (known_coin.denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_signature_free (known_coin.denom_sig.rsa_signature);
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; /* no change! */
}
@@ -3647,8 +3631,8 @@ postgres_get_melt (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &refresh_melt->session.coin.denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &refresh_melt->session.coin.denom_pub_hash),
TALER_PQ_result_spec_amount ("fee_refresh",
&refresh_melt->melt_fee),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
@@ -4470,8 +4454,8 @@ add_coin_payback (void *cls,
&payback->coin_sig),
TALER_PQ_result_spec_absolute_time ("timestamp",
&payback->timestamp),
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &payback->coin.denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &payback->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&payback->coin.denom_sig.rsa_signature),
GNUNET_PQ_result_spec_end
@@ -6356,6 +6340,7 @@ payback_serial_helper_cb (void *cls,
struct TALER_CoinPublicInfo coin;
struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_DenominationBlindingKeyP coin_blind;
+ struct TALER_DenominationPublicKey denom_pub;
struct TALER_Amount amount;
struct GNUNET_HashCode h_blind_ev;
struct GNUNET_TIME_Absolute timestamp;
@@ -6374,8 +6359,10 @@ payback_serial_helper_cb (void *cls,
&coin_blind),
GNUNET_PQ_result_spec_auto_from_type ("h_blind_ev",
&h_blind_ev),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &coin.denom_pub.rsa_public_key),
+ &denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&coin.denom_sig.rsa_signature),
TALER_PQ_result_spec_amount ("amount",
@@ -6399,6 +6386,7 @@ payback_serial_helper_cb (void *cls,
&amount,
&reserve_pub,
&coin,
+ &denom_pub,
&coin_sig,
&coin_blind);
GNUNET_PQ_cleanup_result (rs);
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index c8d4fa041..66ccb4c79 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -271,7 +271,7 @@ create_denom_key_pair (unsigned int size,
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_denomination_info (plugin->cls,
session,
- &dki.denom_pub,
+ &dki.issue.properties.denom_hash,
&issue2))
{
GNUNET_break(0);
@@ -574,7 +574,8 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
&hc);
GNUNET_assert (NULL != refresh_session.coin.denom_sig.rsa_signature);
- refresh_session.coin.denom_pub = dkp->pub;
+ GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
+ &refresh_session.coin.denom_pub_hash);
refresh_session.amount_with_fee = amount_with_fee;
}
@@ -616,10 +617,9 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
&ret_refresh_session.session.coin.coin_pub,
sizeof (refresh_session.coin.coin_pub)));
FAILIF (0 !=
- GNUNET_CRYPTO_rsa_public_key_cmp (refresh_session.coin.denom_pub.rsa_public_key,
- ret_refresh_session.session.coin.denom_pub.rsa_public_key));
+ GNUNET_memcmp (&refresh_session.coin.denom_pub_hash,
+ &ret_refresh_session.session.coin.denom_pub_hash));
GNUNET_CRYPTO_rsa_signature_free (ret_refresh_session.session.coin.denom_sig.rsa_signature);
- GNUNET_CRYPTO_rsa_public_key_free (ret_refresh_session.session.coin.denom_pub.rsa_public_key);
/* test 'select_refreshs_above_serial_id' */
auditor_row_cnt = 0;
@@ -1057,6 +1057,7 @@ test_gc (struct TALER_EXCHANGEDB_Session *session)
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute past;
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue2;
+ struct GNUNET_HashCode denom_hash;
now = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&now);
@@ -1079,10 +1080,13 @@ test_gc (struct TALER_EXCHANGEDB_Session *session)
destroy_denom_key_pair (dkp);
return GNUNET_SYSERR;
}
+ GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
+ &denom_hash);
+
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->get_denomination_info (plugin->cls,
session,
- &dkp->pub,
+ &denom_hash,
&issue2))
{
GNUNET_break(0);
@@ -1376,6 +1380,7 @@ payback_cb (void *cls,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
+ const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_DenominationBlindingKeyP *coin_blind)
{
@@ -1700,7 +1705,7 @@ run (void *cls)
&dkp_pub_hash);
RND_BLK(&cbc.h_coin_envelope);
RND_BLK(&cbc.reserve_sig);
- cbc.denom_pub = dkp->pub;
+ cbc.denom_pub_hash = dkp_pub_hash;
cbc.sig.rsa_signature
= GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
&cbc.h_coin_envelope);
@@ -1732,7 +1737,6 @@ run (void *cls)
session,
&cbc.h_coin_envelope,
&cbc2));
- FAILIF (NULL == cbc2.denom_pub.rsa_public_key);
FAILIF(0 != GNUNET_memcmp(&cbc2.reserve_sig, &cbc.reserve_sig));
FAILIF(0 != GNUNET_memcmp(&cbc2.reserve_pub, &cbc.reserve_pub));
result = 6;
@@ -1745,7 +1749,8 @@ run (void *cls)
RND_BLK (&coin_sig);
RND_BLK (&coin_blind);
RND_BLK (&deposit.coin.coin_pub);
- deposit.coin.denom_pub = dkp->pub;
+ GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
+ &deposit.coin.denom_pub_hash);
deposit.coin.denom_sig = cbc.sig;
deadline = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&deadline);
@@ -1885,7 +1890,8 @@ run (void *cls)
0,
sizeof (deposit));
RND_BLK (&deposit.coin.coin_pub);
- deposit.coin.denom_pub = dkp->pub;
+ GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
+ &deposit.coin.denom_pub_hash);
deposit.coin.denom_sig = cbc.sig;
RND_BLK (&deposit.csig);
RND_BLK (&deposit.merchant_pub);
@@ -2259,8 +2265,6 @@ run (void *cls)
destroy_denom_key_pair (dkp);
if (NULL != cbc.sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (cbc.sig.rsa_signature);
- if (NULL != cbc2.denom_pub.rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (cbc2.denom_pub.rsa_public_key);
if (NULL != cbc2.sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (cbc2.sig.rsa_signature);
dkp = NULL;