aboutsummaryrefslogtreecommitdiff
path: root/src/util/denom.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-02-17 15:10:14 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-17 15:18:09 +0100
commita351bfc4b4ca15ce7fd998cf9691e85cf84dc426 (patch)
tree88ec3b739914739f05d4c8cae2a2af40d29ebf82 /src/util/denom.c
parent8bdf6ab19df70c16d335ecf82f2c3b2117eeb70e (diff)
-fix CS nonce reuse check logic
Diffstat (limited to 'src/util/denom.c')
-rw-r--r--src/util/denom.c93
1 files changed, 8 insertions, 85 deletions
diff --git a/src/util/denom.c b/src/util/denom.c
index 7c2c42c9e..7afc7f408 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -652,8 +652,8 @@ TALER_blinded_denom_sig_cmp (
void
-TALER_blinded_planchet_hash (const struct TALER_BlindedPlanchet *bp,
- struct GNUNET_HashContext *hash_context)
+TALER_blinded_planchet_hash_ (const struct TALER_BlindedPlanchet *bp,
+ struct GNUNET_HashContext *hash_context)
{
uint32_t cipher = htonl (bp->cipher);
@@ -771,97 +771,20 @@ TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet)
{
switch (blinded_planchet->cipher)
{
+ case TALER_DENOMINATION_INVALID:
+ GNUNET_break (0);
+ return;
case TALER_DENOMINATION_RSA:
GNUNET_free (blinded_planchet->details.rsa_blinded_planchet.blinded_msg);
- break;
+ return;
case TALER_DENOMINATION_CS:
memset (blinded_planchet,
0,
sizeof (*blinded_planchet));
/* nothing to do for CS */
- break;
- default:
- GNUNET_break (0);
- }
-}
-
-
-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));
- switch (blinded_planchet->cipher)
- {
- case TALER_DENOMINATION_RSA:
- GNUNET_CRYPTO_hash_context_read (
- hash_context,
- blinded_planchet->details.rsa_blinded_planchet.blinded_msg,
- blinded_planchet->details.rsa_blinded_planchet.blinded_msg_size);
- break;
- case TALER_DENOMINATION_CS:
- // FIXME: c-values MUST NOT be included in idempotency check
- // during withdraw (or recoup), but right now they are!!!
- GNUNET_CRYPTO_hash_context_read (
- hash_context,
- &blinded_planchet->details.cs_blinded_planchet.c[0],
- sizeof (struct GNUNET_CRYPTO_CsC) * 2);
- GNUNET_CRYPTO_hash_context_read (
- hash_context,
- &blinded_planchet->details.cs_blinded_planchet.nonce,
- sizeof (struct TALER_CsNonce));
- break;
- default:
- GNUNET_break (0);
- GNUNET_CRYPTO_hash_context_abort (hash_context);
- return GNUNET_SYSERR;
- }
- GNUNET_CRYPTO_hash_context_finish (hash_context,
- &bch->hash);
- return GNUNET_OK;
-}
-
-
-enum GNUNET_GenericReturnValue
-TALER_withdraw_request_hash (
- const struct TALER_BlindedPlanchet *blinded_planchet,
- const struct TALER_DenominationHash *denom_hash,
- struct TALER_WithdrawIdentificationHash *wih)
-{
- struct GNUNET_HashContext *hash_context;
-
- hash_context = GNUNET_CRYPTO_hash_context_start ();
- GNUNET_CRYPTO_hash_context_read (hash_context,
- denom_hash,
- sizeof(*denom_hash));
- switch (blinded_planchet->cipher)
- {
- case TALER_DENOMINATION_RSA:
- GNUNET_CRYPTO_hash_context_read (
- hash_context,
- blinded_planchet->details.rsa_blinded_planchet.blinded_msg,
- blinded_planchet->details.rsa_blinded_planchet.blinded_msg_size);
- break;
- case TALER_DENOMINATION_CS:
- GNUNET_CRYPTO_hash_context_read (
- hash_context,
- &blinded_planchet->details.cs_blinded_planchet.nonce,
- sizeof (struct TALER_CsNonce));
- break;
- default:
- GNUNET_break (0);
- GNUNET_CRYPTO_hash_context_abort (hash_context);
- return GNUNET_SYSERR;
+ return;
}
- GNUNET_CRYPTO_hash_context_finish (hash_context,
- &wih->hash);
- return GNUNET_OK;
+ GNUNET_assert (0);
}