more stops towards melt/reveal age restriction

This commit is contained in:
Özgür Kesim 2022-01-31 23:26:28 +01:00
parent 53545c667b
commit 31cc3d236a
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7
5 changed files with 40 additions and 23 deletions

View File

@ -588,20 +588,25 @@ TALER_EXCHANGE_verify_coin_history (
} }
} }
{
const struct TALER_AgeCommitmentHash *ahc = &h_age_commitment;
if (TALER_AgeCommitmentHash_isNullOrZero (ahc))
ahc = NULL;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_wallet_melt_verify (&amount, TALER_wallet_melt_verify (&amount,
&fee, &fee,
&rc, &rc,
h_denom_pub, h_denom_pub,
TALER_AgeCommitmentHash_isNullOrZero ( ahc,
&h_age_commitment) ?
NULL : &h_age_commitment,
coin_pub, coin_pub,
&sig)) &sig))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
}
add = GNUNET_YES; add = GNUNET_YES;
} }
else if (0 == strcasecmp (type, else if (0 == strcasecmp (type,

View File

@ -107,6 +107,12 @@ struct MeltData
* coins to be created, for each cut-and-choose dimension. * coins to be created, for each cut-and-choose dimension.
*/ */
struct TALER_PlanchetSecretsP *fresh_coins[TALER_CNC_KAPPA]; 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];
}; };

View File

@ -359,7 +359,7 @@ TALER_EXCHANGE_refreshes_reveal (
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_prepare (&md->fresh_pks[i], TALER_planchet_prepare (&md->fresh_pks[i],
&md->fresh_coins[noreveal_index][i], &md->fresh_coins[noreveal_index][i],
NULL, /* FIXME-oec: struct TALER_AgeCommitmentHash * */ NULL, /* FIXME-oec */
&c_hash, &c_hash,
&pd)) &pd))
{ {

View File

@ -186,7 +186,7 @@ TALER_EXCHANGE_withdraw (
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_prepare (&pk->key, TALER_planchet_prepare (&pk->key,
ps, ps,
NULL, /* FIXME-oec: struct TALER_AgeCommitmentHash * */ NULL, /* FIXME-oec */
&wh->c_hash, &wh->c_hash,
&pd)) &pd))
{ {

View File

@ -88,12 +88,18 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info,
GNUNET_memcmp (&d_hash, GNUNET_memcmp (&d_hash,
&coin_public_info->denom_pub_hash)); &coin_public_info->denom_pub_hash));
#endif #endif
// FIXME-Oec: replace with function that {
// also hashes the age vector if we have const struct TALER_AgeCommitmentHash *pahc =
// one! &coin_public_info->age_commitment_hash;
GNUNET_CRYPTO_hash (&coin_public_info->coin_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), if (TALER_AgeCommitmentHash_isNullOrZero (pahc))
&c_hash.hash); pahc = NULL;
TALER_coin_pub_hash (&coin_public_info->coin_pub,
pahc,
&c_hash);
}
if (GNUNET_OK != if (GNUNET_OK !=
TALER_denom_pub_verify (denom_pub, TALER_denom_pub_verify (denom_pub,
&coin_public_info->denom_sig, &coin_public_info->denom_sig,
@ -328,7 +334,7 @@ TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_AgeCommitmentHash *ach, const struct TALER_AgeCommitmentHash *ach,
struct TALER_CoinPubHash *coin_h) struct TALER_CoinPubHash *coin_h)
{ {
if (NULL == ach) if (TALER_AgeCommitmentHash_isNullOrZero (ach))
{ {
/* No age commitment was set */ /* No age commitment was set */
GNUNET_CRYPTO_hash (&coin_pub->eddsa_pub, GNUNET_CRYPTO_hash (&coin_pub->eddsa_pub,
@ -393,7 +399,7 @@ TALER_age_restriction_derive (
const uint32_t seed, const uint32_t seed,
const struct TALER_AgeCommitment *derived) const struct TALER_AgeCommitment *derived)
{ {
/* TODO */ /* TODO oec */
} }
@ -404,7 +410,7 @@ TALER_age_restriction_commit (
const uint32_t seed, const uint32_t seed,
struct TALER_AgeCommitment *commitment) struct TALER_AgeCommitment *commitment)
{ {
/* TODO */ /* TODO oec */
} }