diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-17 15:10:14 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-17 15:18:09 +0100 |
commit | a351bfc4b4ca15ce7fd998cf9691e85cf84dc426 (patch) | |
tree | 88ec3b739914739f05d4c8cae2a2af40d29ebf82 /src/util/crypto.c | |
parent | 8bdf6ab19df70c16d335ecf82f2c3b2117eeb70e (diff) | |
download | exchange-a351bfc4b4ca15ce7fd998cf9691e85cf84dc426.tar.xz |
-fix CS nonce reuse check logic
Diffstat (limited to 'src/util/crypto.c')
-rw-r--r-- | src/util/crypto.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c index 6bea984f3..d3f3cd3fa 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -193,6 +193,7 @@ TALER_transfer_secret_to_planchet_secret ( void TALER_planchet_secret_to_transfer_priv ( const struct TALER_RefreshMasterSecretP *rms, + const struct TALER_CoinSpendPrivateKeyP *old_coin_priv, uint32_t cnc_num, struct TALER_TransferPrivateKeyP *tpriv) { @@ -203,6 +204,8 @@ TALER_planchet_secret_to_transfer_priv ( sizeof (*tpriv), &be_salt, sizeof (be_salt), + old_coin_priv, + sizeof (*old_coin_priv), rms, sizeof (*rms), "taler-transfer-priv-derivation", @@ -337,6 +340,7 @@ TALER_planchet_to_coin ( void TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc, uint32_t kappa, + const struct TALER_RefreshMasterSecretP *rms, uint32_t num_new_coins, const struct TALER_RefreshCommitmentEntry *rcs, const struct TALER_CoinSpendPublicKeyP *coin_pub, @@ -345,6 +349,10 @@ TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc, struct GNUNET_HashContext *hash_context; hash_context = GNUNET_CRYPTO_hash_context_start (); + if (NULL != rms) + GNUNET_CRYPTO_hash_context_read (hash_context, + rms, + sizeof (*rms)); /* first, iterate over transfer public keys for hash_context */ for (unsigned int i = 0; i<kappa; i++) { @@ -391,8 +399,8 @@ TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc, { const struct TALER_RefreshCoinData *rcd = &rce->new_coins[j]; - TALER_blinded_planchet_hash (&rcd->blinded_planchet, - hash_context); + TALER_blinded_planchet_hash_ (&rcd->blinded_planchet, + hash_context); } } @@ -702,9 +710,27 @@ TALER_age_restriction_commmitment_free_inside ( GNUNET_free (commitment->pub); commitment->priv = NULL; } - /* Caller is responsible for commitment itself */ } +enum GNUNET_GenericReturnValue +TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet, + const struct TALER_DenominationHash *denom_hash, + struct TALER_BlindedCoinHash *bch) +{ + struct GNUNET_HashContext *hash_context; + + hash_context = GNUNET_CRYPTO_hash_context_start (); + GNUNET_CRYPTO_hash_context_read (hash_context, + denom_hash, + sizeof(*denom_hash)); + TALER_blinded_planchet_hash_ (blinded_planchet, + hash_context); + GNUNET_CRYPTO_hash_context_finish (hash_context, + &bch->hash); + return GNUNET_OK; +} + + /* end of crypto.c */ |