From a17781ba8d5f875b5150e524174c5f144aa6c0ba Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 4 Jun 2022 21:59:55 +0200 Subject: -more work on p2p payments and tests thereof --- src/util/wallet_signatures.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'src/util/wallet_signatures.c') diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c index 9c5669650..41e272eb0 100644 --- a/src/util/wallet_signatures.c +++ b/src/util/wallet_signatures.c @@ -1248,20 +1248,9 @@ TALER_wallet_econtract_upload_sign ( } -/** - * Verify a signature over encrypted contract. - * - * @param econtract encrypted contract - * @param econtract_size number of bytes in @a econtract - * @param contract_pub public key for the DH-encryption - * @param purse_pub purse’s public key - * @param purse_sig the signature made with purpose #TALER_SIGNATURE_WALLET_PURSE_CREATE - * @return #GNUNET_OK if the signature is valid - */ enum GNUNET_GenericReturnValue -TALER_wallet_econtract_upload_verify ( - const void *econtract, - size_t econtract_size, +TALER_wallet_econtract_upload_verify2 ( + const struct GNUNET_HashCode *h_econtract, const struct TALER_ContractDiffiePublicP *contract_pub, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_PurseContractSignatureP *purse_sig) @@ -1269,12 +1258,10 @@ TALER_wallet_econtract_upload_verify ( struct TALER_PurseContractPS pc = { .purpose.size = htonl (sizeof (pc)), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_PURSE_ECONTRACT), - .contract_pub = *contract_pub + .contract_pub = *contract_pub, + .h_econtract = *h_econtract }; - GNUNET_CRYPTO_hash (econtract, - econtract_size, - &pc.h_econtract); return GNUNET_CRYPTO_eddsa_verify_ (TALER_SIGNATURE_WALLET_PURSE_ECONTRACT, &pc.purpose, &purse_sig->eddsa_signature, @@ -1282,4 +1269,24 @@ TALER_wallet_econtract_upload_verify ( } +enum GNUNET_GenericReturnValue +TALER_wallet_econtract_upload_verify ( + const void *econtract, + size_t econtract_size, + const struct TALER_ContractDiffiePublicP *contract_pub, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_PurseContractSignatureP *purse_sig) +{ + struct GNUNET_HashCode h_econtract; + + GNUNET_CRYPTO_hash (econtract, + econtract_size, + &h_econtract); + return TALER_wallet_econtract_upload_verify2 (&h_econtract, + contract_pub, + purse_pub, + purse_sig); +} + + /* end of wallet_signatures.c */ -- cgit v1.2.3