aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_purse_create_with_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-28 20:25:45 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-28 20:25:45 +0200
commitded7f9ca189d8abbfcb6eb874d68bdc1a644da8f (patch)
treee939971252fa7e25e799063f3f5cbc23e243853d /src/lib/exchange_api_purse_create_with_deposit.c
parent379c580efc9d8da331e1d32dbde28111caf18a9b (diff)
downloadexchange-ded7f9ca189d8abbfcb6eb874d68bdc1a644da8f.tar.xz
-fix issue with missing signature over denomination and age restriction hash in purse deposit
Diffstat (limited to 'src/lib/exchange_api_purse_create_with_deposit.c')
-rw-r--r--src/lib/exchange_api_purse_create_with_deposit.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/lib/exchange_api_purse_create_with_deposit.c b/src/lib/exchange_api_purse_create_with_deposit.c
index fa1de60b3..3a5b7df59 100644
--- a/src/lib/exchange_api_purse_create_with_deposit.c
+++ b/src/lib/exchange_api_purse_create_with_deposit.c
@@ -55,6 +55,11 @@ struct Deposit
struct TALER_DenominationHashP h_denom_pub;
/**
+ * Age restriction hash for the coin.
+ */
+ struct TALER_AgeCommitmentHash ahac;
+
+ /**
* How much did we say the coin contributed.
*/
struct TALER_Amount contribution;
@@ -375,6 +380,8 @@ handle_purse_create_deposit_finished (void *cls,
{
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinSpendSignatureP coin_sig;
+ struct TALER_DenominationHashP h_denom_pub;
+ struct TALER_AgeCommitmentHash phac;
bool found = false;
if (GNUNET_OK !=
@@ -382,6 +389,8 @@ handle_purse_create_deposit_finished (void *cls,
&pch->purse_pub,
pch->exchange->url,
j,
+ &h_denom_pub,
+ &phac,
&coin_pub,
&coin_sig))
{
@@ -398,6 +407,20 @@ handle_purse_create_deposit_finished (void *cls,
GNUNET_memcmp (&coin_pub,
&deposit->coin_pub))
continue;
+ if (0 !=
+ GNUNET_memcmp (&deposit->h_denom_pub,
+ &h_denom_pub))
+ {
+ found = true;
+ break;
+ }
+ if (0 !=
+ GNUNET_memcmp (&deposit->ahac,
+ &phac))
+ {
+ found = true;
+ break;
+ }
if (0 ==
GNUNET_memcmp (&coin_sig,
&deposit->coin_sig))
@@ -571,7 +594,6 @@ TALER_EXCHANGE_purse_create_with_deposit (
const struct TALER_AgeCommitmentProof *acp = deposit->age_commitment_proof;
struct Deposit *d = &pch->deposits[i];
json_t *jdeposit;
- struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHash *aghp = NULL;
struct TALER_AgeAttestation attest;
struct TALER_AgeAttestation *attestp = NULL;
@@ -579,8 +601,8 @@ TALER_EXCHANGE_purse_create_with_deposit (
if (NULL != acp)
{
TALER_age_commitment_hash (&acp->commitment,
- &agh);
- aghp = &agh;
+ &d->ahac);
+ aghp = &d->ahac;
if (GNUNET_OK !=
TALER_age_commitment_attest (acp,
min_age,
@@ -601,6 +623,8 @@ TALER_EXCHANGE_purse_create_with_deposit (
url,
&pch->purse_pub,
&deposit->amount,
+ &d->h_denom_pub,
+ &d->ahac,
&deposit->coin_priv,
&d->coin_sig);
jdeposit = GNUNET_JSON_PACK (