diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-06 16:52:14 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-06 16:52:14 +0100 |
commit | 8175fdfa0f47e74e239190e809eff4dda5565a76 (patch) | |
tree | b8d46fe55fc9de418953eae23bc12f35295f4ba1 /src/exchange/taler-exchange-httpd_deposit.c | |
parent | 938e2ce39c56ae5afc6c12f15be8f49c7edbf2fd (diff) | |
download | exchange-8175fdfa0f47e74e239190e809eff4dda5565a76.tar.gz exchange-8175fdfa0f47e74e239190e809eff4dda5565a76.tar.bz2 exchange-8175fdfa0f47e74e239190e809eff4dda5565a76.zip |
introduce TALER_wallet_deposit_verify
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_deposit.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 8f0ac8218..323a77b55 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -510,37 +510,25 @@ TEH_handler_deposit (struct MHD_Connection *connection, NULL); } - /* check deposit signature */ + if (GNUNET_OK != + TALER_wallet_deposit_verify (&deposit.amount_with_fee, + &deposit.deposit_fee, + &dc.h_wire, + &deposit.h_contract_terms, + NULL /* h_extensions! */, + &deposit.coin.denom_pub_hash, + deposit.timestamp, + &deposit.merchant_pub, + deposit.refund_deadline, + &deposit.coin.coin_pub, + &deposit.csig)) { - struct TALER_DepositRequestPS dr = { - .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT), - .purpose.size = htonl (sizeof (dr)), - .h_contract_terms = deposit.h_contract_terms, - .h_wire = dc.h_wire, - .h_denom_pub = deposit.coin.denom_pub_hash, - .wallet_timestamp = GNUNET_TIME_absolute_hton (deposit.timestamp), - .refund_deadline = GNUNET_TIME_absolute_hton (deposit.refund_deadline), - .merchant = deposit.merchant_pub, - .coin_pub = deposit.coin.coin_pub - }; - - TALER_amount_hton (&dr.amount_with_fee, - &deposit.amount_with_fee); - TALER_amount_hton (&dr.deposit_fee, - &deposit.deposit_fee); - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, - &dr, - &deposit.csig.eddsa_signature, - &deposit.coin.coin_pub.eddsa_pub)) - { - TALER_LOG_WARNING ("Invalid signature on /deposit request\n"); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_UNAUTHORIZED, - TALER_EC_EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID, - NULL); - } + TALER_LOG_WARNING ("Invalid signature on /deposit request\n"); + GNUNET_JSON_parse_free (spec); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_UNAUTHORIZED, + TALER_EC_EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID, + NULL); } /* execute transaction */ |