From a72337a5f39b4e826055974fbc5a3261759ebbec Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 21 Apr 2022 06:16:33 -0400 Subject: Add abstractions: TALER_exchange_deposit_{sign,verify} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change also removes ‘struct TALER_DepositTrackPS’ from the public API. * src/include/taler_signatures.h (struct TALER_DepositTrackPS): Delete. * src/util/exchange_signatures.c (struct TALER_DepositTrackPS): New. (TALER_exchange_deposit_sign): New func. (TALER_exchange_deposit_verify): New func. * src/include/taler_crypto_lib.h (TALER_exchange_deposit_sign): New func decl. (TALER_exchange_deposit_verify): New func decl. * src/exchange/taler-exchange-httpd_deposits_get.c (TEH_handler_deposits_get): Rework to use ‘TALER_exchange_deposit_verify’. * src/lib/exchange_api_deposits_get.c (TALER_EXCHANGE_deposits_get): Rework to use ‘taler_exchange_deposit_sign’. --- src/lib/exchange_api_deposits_get.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/lib/exchange_api_deposits_get.c') diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c index 32c60f1f..6a212de3 100644 --- a/src/lib/exchange_api_deposits_get.c +++ b/src/lib/exchange_api_deposits_get.c @@ -301,7 +301,7 @@ TALER_EXCHANGE_deposits_get ( TALER_EXCHANGE_DepositGetCallback cb, void *cb_cls) { - struct TALER_DepositTrackPS dtp; + struct TALER_MerchantPublicKeyP merchant; struct TALER_MerchantSignatureP merchant_sig; struct TALER_EXCHANGE_DepositGetHandle *dwh; struct GNUNET_CURL_Context *ctx; @@ -318,18 +318,14 @@ TALER_EXCHANGE_deposits_get ( GNUNET_break (0); return NULL; } - // FIXME: move to helper! - dtp.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION); - dtp.purpose.size = htonl (sizeof (dtp)); - dtp.h_contract_terms = *h_contract_terms; - dtp.h_wire = *h_wire; GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv->eddsa_priv, - &dtp.merchant.eddsa_pub); - - dtp.coin_pub = *coin_pub; - GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, - &dtp, - &merchant_sig.eddsa_sig); + &merchant.eddsa_pub); + TALER_exchange_deposit_sign (h_contract_terms, + h_wire, + coin_pub, + &merchant, + merchant_priv, + &merchant_sig); { char cpub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char mpub_str[sizeof (struct TALER_MerchantPublicKeyP) * 2]; @@ -343,8 +339,8 @@ TALER_EXCHANGE_deposits_get ( whash_str, sizeof (whash_str)); *end = '\0'; - end = GNUNET_STRINGS_data_to_string (&dtp.merchant, - sizeof (dtp.merchant), + end = GNUNET_STRINGS_data_to_string (&merchant, + sizeof (merchant), mpub_str, sizeof (mpub_str)); *end = '\0'; -- cgit v1.2.3