diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-07-05 11:17:47 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-07-05 11:17:47 +0200 |
commit | 3453126eb7985c6f311597bf4acf3682f3a3dc9b (patch) | |
tree | b12acc5334f6739270b318ad012d2e954902a91d /src | |
parent | 615b4621e3637db8ea32b0a17803101044adb594 (diff) | |
download | exchange-3453126eb7985c6f311597bf4acf3682f3a3dc9b.tar.xz |
-resolve minor FIXMEs
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/exchange_api_deposits_get.c | 90 |
1 files changed, 21 insertions, 69 deletions
diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c index 660323bc4..baa254a83 100644 --- a/src/lib/exchange_api_deposits_get.c +++ b/src/lib/exchange_api_deposits_get.c @@ -80,77 +80,15 @@ struct TALER_EXCHANGE_DepositGetHandle struct TALER_PrivateContractHashP h_contract_terms; /** - * Raw value (binary encoding) of the wire transfer subject. - */ - struct TALER_WireTransferIdentifierRawP wtid; - - /** * The coin's public key. This is the value that must have been * signed (blindly) by the Exchange. */ struct TALER_CoinSpendPublicKeyP coin_pub; - /** - * When did the exchange execute this transfer? Note that the - * timestamp may not be exactly the same on the wire, i.e. - * because the wire has a different timezone or resolution. - */ - struct GNUNET_TIME_Timestamp execution_time; - - /** - * The contribution of @e coin_pub to the total transfer volume. - * This is the value of the deposit minus the fee. - */ - struct TALER_Amount coin_contribution; - }; /** - * Verify that the signature on the "200 OK" response - * from the exchange is valid. - * - * @param dwh deposit wtid handle - * @param exchange_pub the exchange's public key - * @param exchange_sig the exchange's signature - * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not - */ -// FIXME: inline... -static enum GNUNET_GenericReturnValue -verify_deposit_wtid_signature_ok ( - const struct TALER_EXCHANGE_DepositGetHandle *dwh, - const struct TALER_ExchangePublicKeyP *exchange_pub, - const struct TALER_ExchangeSignatureP *exchange_sig) -{ - const struct TALER_EXCHANGE_Keys *key_state; - - key_state = TALER_EXCHANGE_get_keys (dwh->exchange); - if (GNUNET_OK != - TALER_EXCHANGE_test_signing_key (key_state, - exchange_pub)) - { - GNUNET_break_op (0); - return GNUNET_SYSERR; - } - if (GNUNET_OK != - TALER_exchange_online_confirm_wire_verify ( - &dwh->h_wire, - &dwh->h_contract_terms, - &dwh->wtid, - &dwh->coin_pub, - dwh->execution_time, - &dwh->coin_contribution, - exchange_pub, - exchange_sig)) - { - GNUNET_break_op (0); - return GNUNET_SYSERR; - } - return GNUNET_OK; -} - - -/** * Function called when we're done processing the * HTTP /track/transaction request. * @@ -191,7 +129,10 @@ handle_deposit_wtid_finished (void *cls, &dr.details.success.exchange_pub), GNUNET_JSON_spec_end () }; + const struct TALER_EXCHANGE_Keys *key_state; + key_state = TALER_EXCHANGE_get_keys (dwh->exchange); + GNUNET_assert (NULL != key_state); if (GNUNET_OK != GNUNET_JSON_parse (j, spec, @@ -202,14 +143,25 @@ handle_deposit_wtid_finished (void *cls, dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } - // FIXME: remove once we inline function below... - dwh->execution_time = dr.details.success.execution_time; - dwh->wtid = dr.details.success.wtid; - dwh->coin_contribution = dr.details.success.coin_contribution; if (GNUNET_OK != - verify_deposit_wtid_signature_ok (dwh, - &dr.details.success.exchange_pub, - &dr.details.success.exchange_sig)) + TALER_EXCHANGE_test_signing_key (key_state, + &dr.details.success.exchange_pub)) + { + GNUNET_break_op (0); + dr.hr.http_status = 0; + dr.hr.ec = TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE; + break; + } + if (GNUNET_OK != + TALER_exchange_online_confirm_wire_verify ( + &dwh->h_wire, + &dwh->h_contract_terms, + &dr.details.success.wtid, + &dwh->coin_pub, + dr.details.success.execution_time, + &dr.details.success.coin_contribution, + &dr.details.success.exchange_pub, + &dr.details.success.exchange_sig)) { GNUNET_break_op (0); dr.hr.http_status = 0; |