diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exchange/taler-exchange-httpd_recoup.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_withdraw.c | 2 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 2 | ||||
-rw-r--r-- | src/include/taler_crypto_lib.h | 2 | ||||
-rw-r--r-- | src/lib/exchange_api_withdraw2.c | 2 | ||||
-rw-r--r-- | src/util/crypto.c | 59 |
6 files changed, 36 insertions, 33 deletions
diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index 388277c4e..1978b58d0 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -266,7 +266,7 @@ verify_and_execute_recoup ( NULL); } if (GNUNET_OK != TALER_coin_ev_hash (&blinded_planchet, - &dk->denom_pub, + &coin->denom_pub_hash, &pc.h_blind)) { GNUNET_break (0); diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index c07250e33..aab1cafdd 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -503,7 +503,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc, wc.wsrd.h_denomination_pub = wc.collectable.denom_pub_hash; if (GNUNET_OK != TALER_coin_ev_hash (&wc.blinded_planchet, - &dk->denom_pub, + &wc.collectable.denom_pub_hash, &wc.wsrd.h_coin_envelope)) { GNUNET_break (0); diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 9dfae7953..ad61d96f7 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -1732,7 +1732,7 @@ run (void *cls) &c_hash, &pd.blinded_planchet)); GNUNET_assert (GNUNET_OK == TALER_coin_ev_hash (&pd.blinded_planchet, - &dkp->pub, + &cbc.denom_pub_hash, &cbc.h_coin_envelope)); GNUNET_assert (GNUNET_OK == TALER_denom_sign_blinded (&cbc.sig, diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 5475a8024..d9565dd71 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -1264,7 +1264,7 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info, */ enum GNUNET_GenericReturnValue TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet, - const struct TALER_DenominationPublicKey *denom_pub, + const struct TALER_DenominationHash *denom_hash, struct TALER_BlindedCoinHash *bch); diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c index 5341055bb..c5a3a66ac 100644 --- a/src/lib/exchange_api_withdraw2.c +++ b/src/lib/exchange_api_withdraw2.c @@ -438,7 +438,7 @@ TALER_EXCHANGE_withdraw2 ( TALER_amount_hton (&req.amount_with_fee, &wh->requested_amount); if (GNUNET_OK != TALER_coin_ev_hash (&pd->blinded_planchet, - &dk->key, + &pd->denom_pub_hash, &req.h_coin_envelope)) { GNUNET_break (0); diff --git a/src/util/crypto.c b/src/util/crypto.c index bed70f3d3..fee3f31ea 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -502,43 +502,46 @@ TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc, enum GNUNET_GenericReturnValue TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet, - const struct TALER_DenominationPublicKey *denom_pub, + const struct TALER_DenominationHash *denom_hash, struct TALER_BlindedCoinHash *bch) { switch (blinded_planchet->cipher) { case TALER_DENOMINATION_RSA: - // FIXME: Include denom_pub into hash - GNUNET_CRYPTO_hash ( - blinded_planchet->details.rsa_blinded_planchet.blinded_msg, - blinded_planchet->details.rsa_blinded_planchet.blinded_msg_size, - &bch->hash); - return GNUNET_OK; - case TALER_DENOMINATION_CS: { - char delim = ':'; - size_t buf_len = sizeof(denom_pub->details.cs_public_key) - + sizeof (blinded_planchet->details.cs_blinded_planchet. - nonce) - + sizeof(delim); - void*buf = GNUNET_malloc (buf_len); - memcpy (buf, - &denom_pub->details.cs_public_key, - sizeof(denom_pub->details.cs_public_key)); - memcpy (buf + sizeof(denom_pub->details.cs_public_key), - &delim, - sizeof(delim)); - memcpy (buf + sizeof(denom_pub->details.cs_public_key) + sizeof(delim), - &blinded_planchet->details.cs_blinded_planchet.nonce, - sizeof (blinded_planchet->details.cs_blinded_planchet.nonce)); - GNUNET_CRYPTO_hash ( - buf, - buf_len, - &bch->hash); - GNUNET_free (buf); + struct GNUNET_HashContext *hash_context; + hash_context = GNUNET_CRYPTO_hash_context_start (); + + // // FIXME: Include denom_pub into hash + // GNUNET_CRYPTO_hash_context_read (hash_context, + // &denom_hash->hash, + // sizeof(denom_hash->hash)); + GNUNET_CRYPTO_hash_context_read (hash_context, + blinded_planchet->details. + rsa_blinded_planchet.blinded_msg, + blinded_planchet->details. + rsa_blinded_planchet.blinded_msg_size); + GNUNET_CRYPTO_hash_context_finish (hash_context, + &bch->hash); return GNUNET_OK; } + case TALER_DENOMINATION_CS: + { + struct GNUNET_HashContext *hash_context; + hash_context = GNUNET_CRYPTO_hash_context_start (); + GNUNET_CRYPTO_hash_context_read (hash_context, + &denom_hash->hash, + sizeof(denom_hash->hash)); + GNUNET_CRYPTO_hash_context_read (hash_context, + &blinded_planchet->details. + cs_blinded_planchet.nonce, + sizeof (blinded_planchet->details. + cs_blinded_planchet.nonce)); + GNUNET_CRYPTO_hash_context_finish (hash_context, + &bch->hash); + return GNUNET_OK; + } default: GNUNET_break (0); return GNUNET_SYSERR; |