WIP - test fail - locating issues with age commitment

age commitment hash wrong
This commit is contained in:
Özgür Kesim 2022-02-13 15:55:02 +01:00
parent bfc1c45bab
commit 3714ba9462
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7
6 changed files with 31 additions and 9 deletions

View File

@ -638,16 +638,25 @@ TALER_EXCHANGE_deposit (
&denom_pub_hash);
if (NULL != age_commitment)
{
TALER_age_commitment_hash (age_commitment, &ach);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"XXXXXX deposit WITH age commitment %s\n",
GNUNET_h2s ((struct GNUNET_HashCode *) &ach.shash));
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"XXXXXX deposit with NO age commitment\n");
}
if (GNUNET_OK !=
verify_signatures (dki,
amount,
&h_wire,
h_contract_terms,
(NULL != extension_details)
? &ech
: NULL,
(NULL != extension_details) ? &ech : NULL,
coin_pub,
(NULL != age_commitment) ? &ach : NULL,
denom_sig,

View File

@ -194,8 +194,7 @@ TALER_EXCHANGE_withdraw (
wh->ps = *ps;
wh->ach = ach;
GNUNET_assert ( (age_restricted && (NULL != ach)) ||
(! age_restricted && (NULL == ach)));
GNUNET_assert (age_restricted == (NULL != ach));
if (GNUNET_OK !=
TALER_planchet_prepare (&pk->key,

View File

@ -403,6 +403,11 @@ deposit_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"XZXZXZXZ pac is %sNULL\n",
(NULL == pac)? "" : "NOT ");
ds->deposit_fee = denom_pub->fee_deposit;
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin_pub.eddsa_pub);

View File

@ -549,8 +549,6 @@ withdraw_traits (void *cls,
TALER_TESTING_make_trait_reserve_history (&ws->reserve_history),
TALER_TESTING_make_trait_coin_priv (index /* only one coin */,
&ws->ps.coin_priv),
TALER_TESTING_make_trait_age_commitment (index, ws->age_commitment),
TALER_TESTING_make_trait_h_age_commitment (index, ws->h_age_commitment),
TALER_TESTING_make_trait_blinding_key (index /* only one coin */,
&ws->ps.blinding_key),
TALER_TESTING_make_trait_denom_pub (index /* only one coin */,
@ -565,6 +563,8 @@ withdraw_traits (void *cls,
(const char **) &ws->reserve_payto_uri),
TALER_TESTING_make_trait_exchange_url (
(const char **) &ws->exchange_url),
TALER_TESTING_make_trait_age_commitment (index, ws->age_commitment),
TALER_TESTING_make_trait_h_age_commitment (index, ws->h_age_commitment),
TALER_TESTING_trait_end ()
};
@ -601,17 +601,19 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
ws = GNUNET_new (struct WithdrawState);
ws->age = age;
if (age > 0)
if (0 < age)
{
struct TALER_AgeCommitment *ac;
struct TALER_AgeCommitmentHash *hac;
uint32_t seed;
struct TALER_AgeMask mask;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "AAAAAAA age is %d\n", age);
ac = GNUNET_new (struct TALER_AgeCommitment);
hac = GNUNET_new (struct TALER_AgeCommitmentHash);
seed = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
mask.mask = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK;
mask = TALER_extensions_age_restriction_ageMask ();
if (GNUNET_OK !=
TALER_age_restriction_commit (

View File

@ -313,6 +313,9 @@ sign_keys_for_exchange (void *cls,
char *exchange_master_pub;
int ret;
/* Load the age restriction mask from the configuration */
TALER_extensions_load_taler_config (cfg);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"exchange",

View File

@ -93,7 +93,11 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info,
&coin_public_info->age_commitment_hash;
if (TALER_AgeCommitmentHash_isNullOrZero (pahc))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"ZZZZZZZZ AgeCommitmentHash isNUllOrZero!!\n");
pahc = NULL;
}
TALER_coin_pub_hash (&coin_public_info->coin_pub,
pahc,