From bd77bcb52dcad4b761f3db0acaa6b71b112a31c2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 14 Feb 2022 23:02:25 +0100 Subject: -towards fixing the protocol --- src/lib/exchange_api_link.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/lib/exchange_api_link.c') diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index 6ebb72271..a44ccdcea 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.c @@ -92,6 +92,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, struct TALER_CoinSpendSignatureP link_sig; union TALER_DenominationBlindingKeyP bks; struct TALER_ExchangeWithdrawValues alg_values; + struct TALER_CsNonce nonce; uint32_t coin_idx; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_denom_pub ("denom_pub", @@ -104,6 +105,9 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, &link_sig), GNUNET_JSON_spec_uint32 ("coin_idx", &coin_idx), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ("cs_nonce", + &nonce)), GNUNET_JSON_spec_end () }; struct TALER_TransferSecretP secret; @@ -111,6 +115,9 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, struct TALER_CoinPubHash c_hash; /* parse reply */ + memset (&nonce, + 0, + sizeof (nonce)); if (GNUNET_OK != GNUNET_JSON_parse (json, spec, @@ -143,6 +150,16 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } + if (TALER_DENOMINATION_CS == alg_values.cipher) + { + if (GNUNET_is_zero (&nonce)) + { + GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); + return GNUNET_SYSERR; + } + pd.blinded_planchet.details.cs_blinded_planchet.nonce = nonce; + } /* extract coin and signature */ if (GNUNET_OK != TALER_denom_sig_unblind (&lci->sig, -- cgit v1.2.3