diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index 81ee67436..1d41918f8 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -588,19 +588,24 @@ TALER_EXCHANGE_verify_coin_history ( } } - if (GNUNET_OK != - TALER_wallet_melt_verify (&amount, - &fee, - &rc, - h_denom_pub, - TALER_AgeCommitmentHash_isNullOrZero ( - &h_age_commitment) ? - NULL : &h_age_commitment, - coin_pub, - &sig)) { - GNUNET_break_op (0); - return GNUNET_SYSERR; + const struct TALER_AgeCommitmentHash *ahc = &h_age_commitment; + + if (TALER_AgeCommitmentHash_isNullOrZero (ahc)) + ahc = NULL; + + if (GNUNET_OK != + TALER_wallet_melt_verify (&amount, + &fee, + &rc, + h_denom_pub, + ahc, + coin_pub, + &sig)) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } } add = GNUNET_YES; } diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h index 1c037d966..4f76d6058 100644 --- a/src/lib/exchange_api_refresh_common.h +++ b/src/lib/exchange_api_refresh_common.h @@ -107,6 +107,12 @@ struct MeltData * coins to be created, for each cut-and-choose dimension. */ struct TALER_PlanchetSecretsP *fresh_coins[TALER_CNC_KAPPA]; + + /** + * Arrays of @e num_fresh_coins with age commitments. The + * coins to be created, for each cut-and-choose dimension. + */ + struct TALER_AgeCommitmentHash **ach[TALER_CNC_KAPPA]; }; diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index 653368d6d..d94fbea21 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -359,7 +359,7 @@ TALER_EXCHANGE_refreshes_reveal ( if (GNUNET_OK != TALER_planchet_prepare (&md->fresh_pks[i], &md->fresh_coins[noreveal_index][i], - NULL, /* FIXME-oec: struct TALER_AgeCommitmentHash * */ + NULL, /* FIXME-oec */ &c_hash, &pd)) { diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index 901faadfd..de8a4d538 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -186,7 +186,7 @@ TALER_EXCHANGE_withdraw ( if (GNUNET_OK != TALER_planchet_prepare (&pk->key, ps, - NULL, /* FIXME-oec: struct TALER_AgeCommitmentHash * */ + NULL, /* FIXME-oec */ &wh->c_hash, &pd)) { diff --git a/src/util/crypto.c b/src/util/crypto.c index 1c45df35e..6cd521bd1 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -88,12 +88,18 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info, GNUNET_memcmp (&d_hash, &coin_public_info->denom_pub_hash)); #endif - // FIXME-Oec: replace with function that - // also hashes the age vector if we have - // one! - GNUNET_CRYPTO_hash (&coin_public_info->coin_pub, - sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), - &c_hash.hash); + { + const struct TALER_AgeCommitmentHash *pahc = + &coin_public_info->age_commitment_hash; + + if (TALER_AgeCommitmentHash_isNullOrZero (pahc)) + pahc = NULL; + + TALER_coin_pub_hash (&coin_public_info->coin_pub, + pahc, + &c_hash); + } + if (GNUNET_OK != TALER_denom_pub_verify (denom_pub, &coin_public_info->denom_sig, @@ -328,7 +334,7 @@ TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_AgeCommitmentHash *ach, struct TALER_CoinPubHash *coin_h) { - if (NULL == ach) + if (TALER_AgeCommitmentHash_isNullOrZero (ach)) { /* No age commitment was set */ GNUNET_CRYPTO_hash (&coin_pub->eddsa_pub, @@ -393,7 +399,7 @@ TALER_age_restriction_derive ( const uint32_t seed, const struct TALER_AgeCommitment *derived) { - /* TODO */ + /* TODO oec */ } @@ -404,7 +410,7 @@ TALER_age_restriction_commit ( const uint32_t seed, struct TALER_AgeCommitment *commitment) { - /* TODO */ + /* TODO oec */ }