diff options
Diffstat (limited to 'src/exchange')
-rw-r--r-- | src/exchange/taler-exchange-httpd_refund.c | 36 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.c | 22 |
2 files changed, 18 insertions, 40 deletions
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index a3b066280..9cc019a14 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -209,31 +209,19 @@ verify_and_execute_refund (struct MHD_Connection *connection, .refund = refund }; - // FIXME: move to libtalerutil! + if (GNUNET_OK != + TALER_merchant_refund_verify (&refund->coin.coin_pub, + &refund->details.h_contract_terms, + refund->details.rtransaction_id, + &refund->details.refund_amount, + &refund->details.merchant_pub, + &refund->details.merchant_sig)) { - struct TALER_RefundRequestPS rr = { - .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND), - .purpose.size = htonl (sizeof (rr)), - .h_contract_terms = refund->details.h_contract_terms, - .coin_pub = refund->coin.coin_pub, - .merchant = refund->details.merchant_pub, - .rtransaction_id = GNUNET_htonll (refund->details.rtransaction_id) - }; - - TALER_amount_hton (&rr.refund_amount, - &refund->details.refund_amount); - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, - &rr, - &refund->details.merchant_sig.eddsa_sig, - &refund->details.merchant_pub.eddsa_pub)) - { - TALER_LOG_WARNING ("Invalid signature on refund request\n"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_FORBIDDEN, - TALER_EC_EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID, - NULL); - } + TALER_LOG_WARNING ("Invalid signature on refund request\n"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_FORBIDDEN, + TALER_EC_EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID, + NULL); } /* Fetch the coin's denomination (hash) */ diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 5739e6709..66a3b0af9 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -165,25 +165,15 @@ TEH_RESPONSE_compile_transaction_history ( const struct TALER_EXCHANGEDB_RefundListEntry *refund = pos->details.refund; struct TALER_Amount value; - // FIXME: move to libtalerutil! - struct TALER_RefundRequestPS rr = { - .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND), - .purpose.size = htonl (sizeof (rr)), - .h_contract_terms = refund->h_contract_terms, - .coin_pub = *coin_pub, - .merchant = refund->merchant_pub, - .rtransaction_id = GNUNET_htonll (refund->rtransaction_id) - }; - TALER_amount_hton (&rr.refund_amount, - &refund->refund_amount); #if ENABLE_SANITY_CHECKS - /* internal sanity check before we hand out a bogus sig... */ if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, - &rr, - &refund->merchant_sig.eddsa_sig, - &refund->merchant_pub.eddsa_pub)) + TALER_merchant_refund_verify (coin_pub, + &refund->h_contract_terms, + refund->rtransaction_id, + &refund->refund_amount, + &refund->merchant_pub, + &refund->merchant_sig)) { GNUNET_break (0); json_decref (history); |