From 00350bc228af8f79df56df13aa10e5f86de5a5a5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 12 Apr 2020 16:44:28 +0200 Subject: remove c_hash from planchet detail where it does not logically belong --- src/lib/exchange_api_link.c | 11 +++++++---- src/lib/exchange_api_refresh_common.c | 2 ++ src/lib/exchange_api_refreshes_reveal.c | 2 ++ src/lib/exchange_api_withdraw.c | 10 +++++++++- 4 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index f933edd95..ad0ad85dc 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.c @@ -128,18 +128,21 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, rpub); /* verify link_sig */ { - struct TALER_LinkDataPS ldp; struct TALER_PlanchetDetail pd; + struct GNUNET_HashCode c_hash; + struct TALER_LinkDataPS ldp = { + .purpose.size = htonl (sizeof (ldp)), + .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_LINK), + .transfer_pub = *trans_pub + }; - ldp.purpose.size = htonl (sizeof (ldp)); - ldp.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_LINK); GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv, &ldp.old_coin_pub.eddsa_pub); - ldp.transfer_pub = *trans_pub; pub->rsa_public_key = rpub; if (GNUNET_OK != TALER_planchet_prepare (pub, &fc, + &c_hash, &pd)) { GNUNET_break (0); diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index 3aa72e541..b6656e25e 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -582,6 +582,7 @@ TALER_EXCHANGE_refresh_prepare ( struct TALER_PlanchetSecretsP *fc = &md.fresh_coins[i][j]; struct TALER_RefreshCoinData *rcd = &rce[i].new_coins[j]; struct TALER_PlanchetDetail pd; + struct GNUNET_HashCode c_hash; TALER_planchet_setup_refresh (&trans_sec[i], j, @@ -589,6 +590,7 @@ TALER_EXCHANGE_refresh_prepare ( if (GNUNET_OK != TALER_planchet_prepare (&md.fresh_pks[j], fc, + &c_hash, &pd)) { GNUNET_break_op (0); diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index e82d33a19..6ffbb9a34 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -361,6 +361,7 @@ TALER_EXCHANGE_refreshes_reveal ( { struct GNUNET_HashCode denom_hash; struct TALER_PlanchetDetail pd; + struct GNUNET_HashCode c_hash; GNUNET_CRYPTO_rsa_public_key_hash (md->fresh_pks[i].rsa_public_key, &denom_hash); @@ -372,6 +373,7 @@ TALER_EXCHANGE_refreshes_reveal ( if (GNUNET_OK != TALER_planchet_prepare (&md->fresh_pks[i], &md->fresh_coins[noreveal_index][i], + &c_hash, &pd)) { /* This should have been noticed during the preparation stage. */ diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index 6258053bb..8cd1ac012 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -381,6 +381,7 @@ handle_reserve_withdraw_finished (void *cls, * @param ps secrets of the planchet * caller must have committed this value to disk before the call (with @a pk) * @param pd planchet details matching @a ps + * @param c_hash hash over the coin's public key * @param res_cb the callback to call when the final result for this request is available * @param res_cb_cls closure for @a res_cb * @return NULL @@ -394,6 +395,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetDetail *pd, + const struct GNUNET_HashCode *c_hash, TALER_EXCHANGE_WithdrawCallback res_cb, void *res_cb_cls) { @@ -427,7 +429,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, wh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key); wh->reserve_pub = *reserve_pub; - wh->c_hash = pd->c_hash; + wh->c_hash = *c_hash; GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, &h_denom_pub); withdraw_obj = json_pack ("{s:o, s:o," /* denom_pub_hash and coin_ev */ @@ -510,6 +512,7 @@ TALER_EXCHANGE_withdraw ( struct TALER_WithdrawRequestPS req; struct TALER_PlanchetDetail pd; struct TALER_EXCHANGE_WithdrawHandle *wh; + struct GNUNET_HashCode c_hash; GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv, &req.reserve_pub.eddsa_pub); @@ -531,6 +534,7 @@ TALER_EXCHANGE_withdraw ( if (GNUNET_OK != TALER_planchet_prepare (&pk->key, ps, + &c_hash, &pd)) { GNUNET_break_op (0); @@ -549,6 +553,7 @@ TALER_EXCHANGE_withdraw ( &req.reserve_pub, ps, &pd, + &c_hash, res_cb, res_cb_cls); GNUNET_free (pd.coin_ev); @@ -589,11 +594,13 @@ TALER_EXCHANGE_withdraw2 ( void *res_cb_cls) { struct TALER_EXCHANGE_WithdrawHandle *wh; + struct GNUNET_HashCode c_hash; struct TALER_PlanchetDetail pd; if (GNUNET_OK != TALER_planchet_prepare (&pk->key, ps, + &c_hash, &pd)) { GNUNET_break_op (0); @@ -605,6 +612,7 @@ TALER_EXCHANGE_withdraw2 ( reserve_pub, ps, &pd, + &c_hash, res_cb, res_cb_cls); GNUNET_free (pd.coin_ev); -- cgit v1.2.3