From 50bc862a684f8c5d4e3ece2712322bf078fe604f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 8 Apr 2020 18:18:20 +0200 Subject: adapt to new GNUnet sign API (#6164) --- .../taler-auditor-httpd_deposit-confirmation.c | 4 +- src/auditor/taler-auditor-sign.c | 7 +- src/auditor/taler-helper-auditor-aggregation.c | 2 +- src/auditor/taler-helper-auditor-coins.c | 10 +-- src/auditor/taler-helper-auditor-reserves.c | 6 +- src/exchange-tools/taler-exchange-keycheck.c | 4 +- src/exchange-tools/taler-exchange-keyup.c | 21 +++--- src/exchange/taler-exchange-httpd_deposit.c | 4 +- src/exchange/taler-exchange-httpd_deposits_get.c | 4 +- src/exchange/taler-exchange-httpd_keystate.c | 26 +++---- src/exchange/taler-exchange-httpd_keystate.h | 36 +++++++++- src/exchange/taler-exchange-httpd_melt.c | 16 ++--- src/exchange/taler-exchange-httpd_recoup.c | 2 +- .../taler-exchange-httpd_refreshes_reveal.c | 10 +-- src/exchange/taler-exchange-httpd_refund.c | 4 +- src/exchange/taler-exchange-httpd_responses.c | 16 ++--- src/exchange/taler-exchange-httpd_transfers_get.c | 2 +- src/exchange/taler-exchange-httpd_withdraw.c | 4 +- src/exchangedb/exchangedb_denomkeys.c | 9 ++- src/exchangedb/test_exchangedb_fees.c | 9 ++- src/lib/auditor_api_deposit_confirmation.c | 84 ++++++++++++---------- src/lib/exchange_api_common.c | 14 ++-- src/lib/exchange_api_deposit.c | 4 +- src/lib/exchange_api_deposits_get.c | 9 ++- src/lib/exchange_api_handle.c | 8 +-- src/lib/exchange_api_link.c | 2 +- src/lib/exchange_api_melt.c | 4 +- src/lib/exchange_api_recoup.c | 8 +-- src/lib/exchange_api_refreshes_reveal.c | 8 +-- src/lib/exchange_api_refund.c | 9 ++- src/lib/exchange_api_transfers_get.c | 2 +- src/lib/exchange_api_withdraw.c | 7 +- src/testing/testing_api_cmd_deposit.c | 7 +- src/util/crypto_wire.c | 46 ++++++------ 34 files changed, 218 insertions(+), 190 deletions(-) diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c index 45be222af..fd48ff93b 100644 --- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c +++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c @@ -112,7 +112,7 @@ verify_and_execute_deposit_confirmation ( /* Not in cache, need to verify the signature, persist it, and possibly cache it */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY, - &skv.purpose, + &skv, &es->master_sig.eddsa_signature, &es->master_public_key.eddsa_pub)) { @@ -165,7 +165,7 @@ verify_and_execute_deposit_confirmation ( &dc->amount_without_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT, - &dcs.purpose, + &dcs, &dc->exchange_sig.eddsa_signature, &dc->exchange_pub.eddsa_pub)) { diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c index 62f565907..e8491fabe 100644 --- a/src/auditor/taler-auditor-sign.c +++ b/src/auditor/taler-auditor-sign.c @@ -350,10 +350,9 @@ main (int argc, kv.denom_hash = dk->denom_hash; /* Finally sign ... */ - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (eddsa_priv, - &kv.purpose, - &sigs[i].eddsa_sig)); + GNUNET_CRYPTO_eddsa_sign (eddsa_priv, + &kv, + &sigs[i].eddsa_sig); } if (NULL == output_file) diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c index 190b7260e..09376a799 100644 --- a/src/auditor/taler-helper-auditor-aggregation.c +++ b/src/auditor/taler-helper-auditor-aggregation.c @@ -1028,7 +1028,7 @@ get_wire_fee (struct AggregationContext *ac, &wfi->closing_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES, - &wf.purpose, + &wf, &master_sig.eddsa_signature, &TALER_ARL_master_pub.eddsa_pub)) { diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index fb50c8dbf..8acc874c9 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c @@ -743,7 +743,7 @@ init_denomination (const struct GNUNET_HashCode *denom_hash, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED, - &rm.purpose, + &rm, &msig.eddsa_signature, &TALER_ARL_master_pub.eddsa_pub)) { @@ -1312,7 +1312,7 @@ refresh_session_cb (void *cls, amount_with_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT, - &rmc.purpose, + &rmc, &coin_sig->eddsa_signature, &coin_pub->eddsa_pub)) { @@ -1679,7 +1679,7 @@ deposit_cb (void *cls, auditor performance! */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, - &dr.purpose, + &dr, &coin_sig->eddsa_signature, &coin_pub->eddsa_pub)) { @@ -1850,7 +1850,7 @@ refund_cb (void *cls, amount_with_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, - &rr.purpose, + &rr, &merchant_sig->eddsa_sig, &merchant_pub->eddsa_pub)) { @@ -2017,7 +2017,7 @@ check_recoup (struct CoinContext *cc, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP, - &pr.purpose, + &pr, &coin_sig->eddsa_signature, &coin->coin_pub.eddsa_pub)) { diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c index 4917ef0a1..76713192f 100644 --- a/src/auditor/taler-helper-auditor-reserves.c +++ b/src/auditor/taler-helper-auditor-reserves.c @@ -559,7 +559,7 @@ handle_reserve_out (void *cls, amount_with_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW, - &wsrd.purpose, + &wsrd, &reserve_sig->eddsa_signature, &reserve_pub->eddsa_pub)) { @@ -686,7 +686,7 @@ handle_recoup_by_reserve ( if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP, - &pr.purpose, + &pr, &coin_sig->eddsa_signature, &coin->coin_pub.eddsa_pub)) { @@ -743,7 +743,7 @@ handle_recoup_by_reserve ( if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED, - &kr.purpose, + &kr, &msig.eddsa_signature, &TALER_ARL_master_pub.eddsa_pub)) { diff --git a/src/exchange-tools/taler-exchange-keycheck.c b/src/exchange-tools/taler-exchange-keycheck.c index 6b6ce9eb9..917ca879f 100644 --- a/src/exchange-tools/taler-exchange-keycheck.c +++ b/src/exchange-tools/taler-exchange-keycheck.c @@ -92,7 +92,7 @@ signkeys_iter (void *cls, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY, - &ski->issue.purpose, + &ski->issue, &ski->master_sig.eddsa_signature, &ski->issue.master_public_key.eddsa_pub)) { @@ -171,7 +171,7 @@ denomkeys_iter (void *cls, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, - &dki->issue.properties.purpose, + &dki->issue.properties, &dki->issue.signature.eddsa_signature, &dki->issue.properties.master.eddsa_pub)) { diff --git a/src/exchange-tools/taler-exchange-keyup.c b/src/exchange-tools/taler-exchange-keyup.c index f4d389752..5472f5e0e 100644 --- a/src/exchange-tools/taler-exchange-keyup.c +++ b/src/exchange-tools/taler-exchange-keyup.c @@ -497,10 +497,9 @@ create_signkey_issue_priv ( issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY); issue->purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &issue->purpose, - &pi->master_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, + issue, + &pi->master_sig.eddsa_signature); } @@ -796,10 +795,9 @@ create_denomkey_issue ( = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); dki->issue.properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS)); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &dki->issue.properties.purpose, - &dki->issue.signature.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, + &dki->issue.properties, + &dki->issue.signature.eddsa_signature); } @@ -948,10 +946,9 @@ sign_af (struct TALER_EXCHANGEDB_AggregateFees *af, TALER_EXCHANGEDB_fees_2_wf (method, af, &wf); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (priv, - &wf.purpose, - &af->master_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (priv, + &wf, + &af->master_sig.eddsa_signature); } diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 193101c08..ac854de68 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -79,7 +79,7 @@ reply_deposit_success (struct MHD_Connection *connection, TALER_amount_hton (&dc.amount_without_fee, amount_without_fee); if (GNUNET_OK != - TEH_KS_sign (&dc.purpose, + TEH_KS_sign (&dc, &pub, &sig)) { @@ -508,7 +508,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, &deposit.deposit_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, - &dr.purpose, + &dr, &deposit.csig.eddsa_signature, &deposit.coin.coin_pub.eddsa_pub)) { diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index 1c9c58d11..f2b364caa 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c @@ -69,7 +69,7 @@ reply_deposit_details (struct MHD_Connection *connection, TALER_amount_hton (&cw.coin_contribution, coin_contribution); if (GNUNET_OK != - TEH_KS_sign (&cw.purpose, + TEH_KS_sign (&cw, &pub, &sig)) { @@ -381,7 +381,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, return MHD_YES; /* parse error */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION, - &tps.purpose, + &tps, &merchant_sig.eddsa_sig, &tps.merchant.eddsa_pub)) { diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index 1c56b7a0f..acdec8d7f 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -593,7 +593,7 @@ store_in_map (struct GNUNET_CONTAINER_MultiHashMap *map, if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, - &denom_key_issue.purpose, + &denom_key_issue, &dkip->signature.eddsa_signature, &TEH_master_public_key.eddsa_pub)) { @@ -1489,12 +1489,10 @@ build_keys_response (const struct ResponseFactoryContext *rfc, GNUNET_CRYPTO_hash_context_finish (rbc.hash_context, &ks.hc); rbc.hash_context = NULL; - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign ( - &rfc->key_state->current_sign_key_issue.signkey_priv. - eddsa_priv, - &ks.purpose, - &sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign ( + &rfc->key_state->current_sign_key_issue.signkey_priv.eddsa_priv, + &ks, + &sig.eddsa_signature); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (TEH_cfg, "exchangedb", @@ -2399,16 +2397,20 @@ TEH_KS_free (void) /** * Sign the message in @a purpose with the exchange's signing key. * + * The @a purpose data is the beginning of the data of which the signature is + * to be created. The `size` field in @a purpose must correctly indicate the + * number of bytes of the data structure, including its header. Use + * #TEH_KS_sign() instead of calling this function directly! + * * @param purpose the message to sign * @param[out] pub set to the current public signing key of the exchange * @param[out] sig signature over purpose using current signing key * @return #GNUNET_OK on success, #GNUNET_SYSERR if we lack key material */ int -TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct TALER_ExchangePublicKeyP *pub, - struct TALER_ExchangeSignatureP *sig) - +TEH_KS_sign_ (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + struct TALER_ExchangePublicKeyP *pub, + struct TALER_ExchangeSignatureP *sig) { struct TEH_KS_StateHandle *key_state; @@ -2424,7 +2426,7 @@ TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, } *pub = key_state->current_sign_key_issue.issue.signkey_pub; GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign ( + GNUNET_CRYPTO_eddsa_sign_ ( &key_state->current_sign_key_issue.signkey_priv.eddsa_priv, purpose, &sig->eddsa_signature)); diff --git a/src/exchange/taler-exchange-httpd_keystate.h b/src/exchange/taler-exchange-httpd_keystate.h index 671652387..65a006bbe 100644 --- a/src/exchange/taler-exchange-httpd_keystate.h +++ b/src/exchange/taler-exchange-httpd_keystate.h @@ -171,15 +171,45 @@ TEH_KS_loop (void); * Sign the message in @a purpose with the exchange's signing * key. * + * The @a purpose data is the beginning of the data of which the signature is + * to be created. The `size` field in @a purpose must correctly indicate the + * number of bytes of the data structure, including its header. Use + * #TEH_KS_sign() instead of calling this function directly! + * * @param purpose the message to sign * @param[out] pub set to the current public signing key of the exchange * @param[out] sig signature over purpose using current signing key * @return #GNUNET_OK on success, #GNUNET_SYSERR if we lack key material */ int -TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct TALER_ExchangePublicKeyP *pub, - struct TALER_ExchangeSignatureP *sig); +TEH_KS_sign_ (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + struct TALER_ExchangePublicKeyP *pub, + struct TALER_ExchangeSignatureP *sig); + +/** + * @ingroup crypto + * @brief EdDSA sign a given block. + * + * The @a ps data must be a fixed-size struct for which the signature is to be + * created. The `size` field in @a ps->purpose must correctly indicate the + * number of bytes of the data structure, including its header. + * + * @param ps packed struct with what to sign, MUST begin with a purpose + * @param[out] pub where to store the public key to use for the signing + * @param[out] sig where to write the signature + */ +#define TEH_KS_sign(ps,pub,sig) \ + ({ \ + /* check size is set correctly */ \ + GNUNET_assert (htonl ((ps)->purpose.size) == \ + sizeof (*ps)); \ + /* check 'ps' begins with the purpose */ \ + GNUNET_static_assert (((void*) (ps)) == \ + ((void*) &(ps)->purpose)); \ + TEH_KS_sign_ (&(ps)->purpose, \ + pub, \ + sig); \ + }) /** diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index f5bd0b5aa..fab0f106b 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -109,7 +109,7 @@ reply_melt_success (struct MHD_Connection *connection, }; if (GNUNET_OK != - TEH_KS_sign (&body.purpose, + TEH_KS_sign (&body, &pub, &sig)) { @@ -376,22 +376,22 @@ handle_melt (struct MHD_Connection *connection, { /* verify signature of coin for melt operation */ { - struct TALER_RefreshMeltCoinAffirmationPS body; + struct TALER_RefreshMeltCoinAffirmationPS body = { + .purpose.size = htonl (sizeof (body)), + .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT), + .rc = rmc->refresh_session.rc, + .coin_pub = rmc->refresh_session.coin.coin_pub + }; - body.purpose.size = htonl (sizeof (struct - TALER_RefreshMeltCoinAffirmationPS)); - body.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT); - body.rc = rmc->refresh_session.rc; TALER_amount_hton (&body.amount_with_fee, &rmc->refresh_session.amount_with_fee); TALER_amount_hton (&body.melt_fee, &rmc->coin_refresh_fee); - body.coin_pub = rmc->refresh_session.coin.coin_pub; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_WALLET_COIN_MELT, - &body.purpose, + &body, &rmc->refresh_session.coin_sig.eddsa_signature, &rmc->refresh_session.coin.coin_pub.eddsa_pub)) { diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index d8e7d189f..ccb75622e 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -414,7 +414,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP, - &pr.purpose, + &pr, &coin_sig->eddsa_signature, &coin->coin_pub.eddsa_pub)) { diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index b7db0a4b4..5b6ca2d32 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -676,11 +676,11 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, rcds[i].coin_ev_size, &ldp.coin_envelope_hash); if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_LINK, - &ldp.purpose, - &link_sigs[i].eddsa_signature, - &melt.session.coin.coin_pub. - eddsa_pub)) + GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_WALLET_COIN_LINK, + &ldp, + &link_sigs[i].eddsa_signature, + &melt.session.coin.coin_pub.eddsa_pub)) { GNUNET_break_op (0); res = TALER_MHD_reply_with_error (connection, diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 9fd9575f9..036a04739 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -64,7 +64,7 @@ reply_refund_success (struct MHD_Connection *connection, TALER_amount_hton (&rc.refund_fee, &refund->refund_fee); if (GNUNET_OK != - TEH_KS_sign (&rc.purpose, + TEH_KS_sign (&rc, &pub, &sig)) { @@ -365,7 +365,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, &refund->details.refund_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, - &rr.purpose, + &rr, &refund->details.merchant_sig.eddsa_sig, &refund->details.merchant_pub.eddsa_pub)) { diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 452841190..4ddd9cd89 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -81,7 +81,7 @@ TEH_RESPONSE_compile_transaction_history ( /* internal sanity check before we hand out a bogus sig... */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, - &dr.purpose, + &dr, &deposit->csig.eddsa_signature, &coin_pub->eddsa_pub)) { @@ -139,7 +139,7 @@ TEH_RESPONSE_compile_transaction_history ( /* internal sanity check before we hand out a bogus sig... */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT, - &ms.purpose, + &ms, &melt->coin_sig.eddsa_signature, &coin_pub->eddsa_pub)) { @@ -191,7 +191,7 @@ TEH_RESPONSE_compile_transaction_history ( /* internal sanity check before we hand out a bogus sig... */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, - &rr.purpose, + &rr, &refund->merchant_sig.eddsa_sig, &refund->merchant_pub.eddsa_pub)) { @@ -253,7 +253,7 @@ TEH_RESPONSE_compile_transaction_history ( TALER_amount_hton (&pc.recoup_amount, &pr->value); if (GNUNET_OK != - TEH_KS_sign (&pc.purpose, + TEH_KS_sign (&pc, &epub, &esig)) { @@ -306,7 +306,7 @@ TEH_RESPONSE_compile_transaction_history ( TALER_amount_hton (&pc.recoup_amount, &recoup->value); if (GNUNET_OK != - TEH_KS_sign (&pc.purpose, + TEH_KS_sign (&pc, &epub, &esig)) { @@ -355,7 +355,7 @@ TEH_RESPONSE_compile_transaction_history ( TALER_amount_hton (&pc.recoup_amount, &pr->value); if (GNUNET_OK != - TEH_KS_sign (&pc.purpose, + TEH_KS_sign (&pc, &epub, &esig)) { @@ -593,7 +593,7 @@ TEH_RESPONSE_compile_reserve_history ( TALER_amount_hton (&pc.recoup_amount, &recoup->value); if (GNUNET_OK != - TEH_KS_sign (&pc.purpose, + TEH_KS_sign (&pc, &pub, &sig)) { @@ -669,7 +669,7 @@ TEH_RESPONSE_compile_reserve_history ( strlen (closing->receiver_account_details) + 1, &rcc.h_wire); if (GNUNET_OK != - TEH_KS_sign (&rcc.purpose, + TEH_KS_sign (&rcc, &pub, &sig)) { diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 9407ad791..4cc855d7e 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -159,7 +159,7 @@ reply_transfer_details (struct MHD_Connection *connection, GNUNET_CRYPTO_hash_context_finish (hash_context, &wdp.h_details); if (GNUNET_OK != - TEH_KS_sign (&wdp.purpose, + TEH_KS_sign (&wdp, &pub, &sig)) { diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index bbd926a5c..58ef97bae 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -442,7 +442,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, /* verify signature! */ wc.wsrd.purpose.size - = htonl (sizeof (struct TALER_WithdrawRequestPS)); + = htonl (sizeof (wc.wsrd)); wc.wsrd.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW); wc.wsrd.h_denomination_pub @@ -452,7 +452,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, &wc.wsrd.h_coin_envelope); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW, - &wc.wsrd.purpose, + &wc.wsrd, &wc.signature.eddsa_signature, &wc.wsrd.reserve_pub.eddsa_pub)) { diff --git a/src/exchangedb/exchangedb_denomkeys.c b/src/exchangedb/exchangedb_denomkeys.c index fe74d1560..ec77d7f0b 100644 --- a/src/exchangedb/exchangedb_denomkeys.c +++ b/src/exchangedb/exchangedb_denomkeys.c @@ -75,10 +75,9 @@ TALER_EXCHANGEDB_denomination_key_revoke ( .h_denom_pub = *denom_hash }; - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&mpriv->eddsa_priv, - &rm.purpose, - &rd.msig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&mpriv->eddsa_priv, + &rm, + &rd.msig.eddsa_signature); } GNUNET_asprintf (&fn, "%s" DIR_SEPARATOR_STR @@ -476,7 +475,7 @@ revocations_iterate_cb (void *cls, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED, - &rm.purpose, + &rm, &rf.msig.eddsa_signature, &ric->master_pub->eddsa_pub)) { diff --git a/src/exchangedb/test_exchangedb_fees.c b/src/exchangedb/test_exchangedb_fees.c index 7cd890eb3..55f34bd6f 100644 --- a/src/exchangedb/test_exchangedb_fees.c +++ b/src/exchangedb/test_exchangedb_fees.c @@ -39,10 +39,9 @@ sign_af (struct TALER_EXCHANGEDB_AggregateFees *af, TALER_EXCHANGEDB_fees_2_wf ("test", af, &wf); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (priv, - &wf.purpose, - &af->master_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (priv, + &wf, + &af->master_sig.eddsa_signature); } @@ -136,7 +135,7 @@ main (int argc, &wf); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES, - &wf.purpose, + &wf, &p->master_sig.eddsa_signature, &master_pub.eddsa_pub)) { diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c index 045102087..cddfe8b14 100644 --- a/src/lib/auditor_api_deposit_confirmation.c +++ b/src/lib/auditor_api_deposit_confirmation.c @@ -178,49 +178,57 @@ verify_signatures (const struct GNUNET_HashCode *h_wire, struct GNUNET_TIME_Absolute ep_end, const struct TALER_MasterSignatureP *master_sig) { - struct TALER_DepositConfirmationPS dc; - struct TALER_ExchangeSigningKeyValidityPS sv; - - dc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT); - dc.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS)); - dc.h_contract_terms = *h_contract_terms; - dc.h_wire = *h_wire; - dc.timestamp = GNUNET_TIME_absolute_hton (timestamp); - dc.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline); - TALER_amount_hton (&dc.amount_without_fee, - amount_without_fee); - dc.coin_pub = *coin_pub; - dc.merchant = *merchant_pub; - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT, - &dc.purpose, - &exchange_sig->eddsa_signature, - &exchange_pub->eddsa_pub)) { - GNUNET_break_op (0); - TALER_LOG_WARNING ("Invalid signature on /deposit-confirmation request!\n"); + struct TALER_DepositConfirmationPS dc = { + .purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT), + .purpose.size = htonl (sizeof (dc)), + .h_contract_terms = *h_contract_terms, + .h_wire = *h_wire, + .timestamp = GNUNET_TIME_absolute_hton (timestamp), + .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline), + .coin_pub = *coin_pub, + .merchant = *merchant_pub + }; + + TALER_amount_hton (&dc.amount_without_fee, + amount_without_fee); + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT, + &dc, + &exchange_sig->eddsa_signature, + &exchange_pub->eddsa_pub)) { - TALER_LOG_DEBUG ("... amount_without_fee was %s\n", - TALER_amount2s (amount_without_fee)); + GNUNET_break_op (0); + TALER_LOG_WARNING ( + "Invalid signature on /deposit-confirmation request!\n"); + { + TALER_LOG_DEBUG ("... amount_without_fee was %s\n", + TALER_amount2s (amount_without_fee)); + } + return GNUNET_SYSERR; } - return GNUNET_SYSERR; } - sv.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY); - sv.purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)); - sv.master_public_key = *master_pub; - sv.start = GNUNET_TIME_absolute_hton (ep_start); - sv.expire = GNUNET_TIME_absolute_hton (ep_expire); - sv.end = GNUNET_TIME_absolute_hton (ep_end); - sv.signkey_pub = *exchange_pub; - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY, - &sv.purpose, - &master_sig->eddsa_signature, - &master_pub->eddsa_pub)) { - GNUNET_break (0); - TALER_LOG_WARNING ("Invalid signature on exchange signing key!\n"); - return GNUNET_SYSERR; + struct TALER_ExchangeSigningKeyValidityPS sv = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY), + .purpose.size = htonl (sizeof (sv)), + .master_public_key = *master_pub, + .start = GNUNET_TIME_absolute_hton (ep_start), + .expire = GNUNET_TIME_absolute_hton (ep_expire), + .end = GNUNET_TIME_absolute_hton (ep_end), + .signkey_pub = *exchange_pub + }; + + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY, + &sv, + &master_sig->eddsa_signature, + &master_pub->eddsa_pub)) + { + GNUNET_break (0); + TALER_LOG_WARNING ("Invalid signature on exchange signing key!\n"); + return GNUNET_SYSERR; + } } if (0 == GNUNET_TIME_absolute_get_remaining (ep_end).rel_value_us) { diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index af77d29e5..d441807aa 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -177,7 +177,7 @@ TALER_EXCHANGE_parse_reserve_history ( /* Check that the signature is a valid withdraw request */ if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW, - &withdraw_purpose.purpose, + &withdraw_purpose, &sig.eddsa_signature, &reserve_pub->eddsa_pub)) { @@ -294,7 +294,7 @@ TALER_EXCHANGE_parse_reserve_history ( if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP, - &pc.purpose, + &pc, &rh->details.recoup_details.exchange_sig.eddsa_signature, &rh->details.recoup_details.exchange_pub.eddsa_pub)) { @@ -371,7 +371,7 @@ TALER_EXCHANGE_parse_reserve_history ( if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED, - &rcc.purpose, + &rcc, &rh->details.close_details.exchange_sig.eddsa_signature, &rh->details.close_details.exchange_pub.eddsa_pub)) { @@ -551,7 +551,7 @@ TALER_EXCHANGE_verify_coin_history ( dr.coin_pub = *coin_pub; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, - &dr.purpose, + &dr, &sig.eddsa_signature, &coin_pub->eddsa_pub)) { @@ -606,7 +606,7 @@ TALER_EXCHANGE_verify_coin_history ( rm.coin_pub = *coin_pub; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT, - &rm.purpose, + &rm, &sig.eddsa_signature, &coin_pub->eddsa_pub)) { @@ -665,7 +665,7 @@ TALER_EXCHANGE_verify_coin_history ( &amount); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, - &rr.purpose, + &rr, &sig.eddsa_sig, &rr.merchant.eddsa_pub)) { @@ -731,7 +731,7 @@ TALER_EXCHANGE_verify_coin_history ( &amount); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP, - &pc.purpose, + &pc, &exchange_sig.eddsa_signature, &exchange_pub.eddsa_pub)) { diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index e01a3c580..38f15246c 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -219,7 +219,7 @@ verify_deposit_signature_ok (struct TALER_EXCHANGE_DepositHandle *dh, } if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT, - &dh->depconf.purpose, + &dh->depconf, &exchange_sig->eddsa_signature, &exchange_pub->eddsa_pub)) { @@ -441,7 +441,7 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki, &dki->fee_deposit); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT, - &dr.purpose, + &dr, &coin_sig->eddsa_signature, &coin_pub->eddsa_pub)) { diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c index 053f3ac87..aecd88240 100644 --- a/src/lib/exchange_api_deposits_get.c +++ b/src/lib/exchange_api_deposits_get.c @@ -119,7 +119,7 @@ verify_deposit_wtid_signature_ok ( } if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE, - &dwh->depconf.purpose, + &dwh->depconf, &exchange_sig.eddsa_signature, &exchange_pub->eddsa_pub)) { @@ -315,10 +315,9 @@ TALER_EXCHANGE_deposits_get ( &dtp.merchant.eddsa_pub); dtp.coin_pub = *coin_pub; - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, - &dtp.purpose, - &merchant_sig.eddsa_sig)); + GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, + &dtp, + &merchant_sig.eddsa_sig); { char cpub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char mpub_str[sizeof (struct TALER_MerchantPublicKeyP) * 2]; diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index ed12f6aff..86edc0707 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -407,7 +407,7 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY, - &sign_key_issue.purpose, + &sign_key_issue, &sign_key_issue_sig.eddsa_signature, &master_key->eddsa_pub)) { @@ -508,7 +508,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, EXITIF (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, - &denom_key_issue.purpose, + &denom_key_issue, &denom_key->master_sig.eddsa_signature, &master_key->eddsa_pub)); } @@ -635,7 +635,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS, - &kv.purpose, + &kv, &auditor_sig.eddsa_sig, &auditor->auditor_pub.eddsa_pub)) { @@ -1096,7 +1096,7 @@ decode_keys_json (const json_t *resp_obj, &pub)); EXITIF (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_KEY_SET, - &ks.purpose, + &ks, &sig.eddsa_signature, &pub.eddsa_pub)); } diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index c05b2e563..f933edd95 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.c @@ -154,7 +154,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_LINK, - &ldp.purpose, + &ldp, &link_sig.eddsa_signature, &ldp.old_coin_pub.eddsa_pub)) { diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index 4d0d21b37..0217757b0 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -142,7 +142,7 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh, confirm.noreveal_index = htonl (*noreveal_index); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT, - &confirm.purpose, + &confirm, &exchange_sig.eddsa_signature, &exchange_pub->eddsa_pub)) { @@ -416,7 +416,7 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, GNUNET_CRYPTO_eddsa_key_get_public (&md->melted_coin.coin_priv.eddsa_priv, &melt.coin_pub.eddsa_pub); GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, - &melt.purpose, + &melt, &confirm_sig.eddsa_signature); GNUNET_CRYPTO_rsa_public_key_hash (md->melted_coin.pub_key.rsa_public_key, &h_denom_pub); diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c index 484d27536..723b41789 100644 --- a/src/lib/exchange_api_recoup.c +++ b/src/lib/exchange_api_recoup.c @@ -303,11 +303,9 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, &h_denom_pub); pr.h_denom_pub = pk->h_key; pr.coin_blind = ps->blinding_key; - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&ps->coin_priv.eddsa_priv, - &pr.purpose, - &coin_sig.eddsa_signature)); - + GNUNET_CRYPTO_eddsa_sign (&ps->coin_priv.eddsa_priv, + &pr, + &coin_sig.eddsa_signature); recoup_obj = json_pack ("{s:o, s:o," /* denom pub/sig */ " s:o," /* sig */ " s:o, s:o}", /* coin_bks */ diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index f8071f5c5..4ef2e3d04 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -399,11 +399,9 @@ TALER_EXCHANGE_refreshes_reveal ( GNUNET_CRYPTO_hash (pd.coin_ev, pd.coin_ev_size, &ldp.coin_envelope_hash); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign ( - &md->melted_coin.coin_priv.eddsa_priv, - &ldp.purpose, - &link_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, + &ldp, + &link_sig.eddsa_signature); GNUNET_assert (0 == json_array_append_new (link_sigs, GNUNET_JSON_from_data_auto ( diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index 81127c5a7..7ece7eb10 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c @@ -117,7 +117,7 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh, } if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND, - &rh->depconf.purpose, + &rh->depconf, &exchange_sig.eddsa_signature, &exchange_pub->eddsa_pub)) { @@ -289,10 +289,9 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, amount); TALER_amount_hton (&rr.refund_fee, refund_fee); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, - &rr.purpose, - &merchant_sig.eddsa_sig)); + GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv, + &rr, + &merchant_sig.eddsa_sig); return TALER_EXCHANGE_refund2 (exchange, amount, refund_fee, diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c index 2f1e32898..aa4abfa5d 100644 --- a/src/lib/exchange_api_transfers_get.c +++ b/src/lib/exchange_api_transfers_get.c @@ -207,7 +207,7 @@ check_transfers_get_response_ok ( if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT, - &wdp.purpose, + &wdp, &exchange_sig.eddsa_signature, &exchange_pub.eddsa_pub)) { diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index 6f7928c65..c72454e2c 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -540,10 +540,9 @@ TALER_EXCHANGE_withdraw ( GNUNET_CRYPTO_hash (pd.coin_ev, pd.coin_ev_size, &req.h_coin_envelope); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&reserve_priv->eddsa_priv, - &req.purpose, - &reserve_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&reserve_priv->eddsa_priv, + &req, + &reserve_sig.eddsa_signature); wh = reserve_withdraw_internal (exchange, pk, &reserve_sig, diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c index c11c49ac6..c251aada3 100644 --- a/src/testing/testing_api_cmd_deposit.c +++ b/src/testing/testing_api_cmd_deposit.c @@ -409,10 +409,9 @@ deposit_run (void *cls, &denom_pub->fee_deposit); dr.merchant = merchant_pub; dr.coin_pub = coin_pub; - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&coin_priv->eddsa_priv, - &dr.purpose, - &coin_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&coin_priv->eddsa_priv, + &dr, + &coin_sig.eddsa_signature); } ds->dh = TALER_EXCHANGE_deposit (is->exchange, &ds->amount, diff --git a/src/util/crypto_wire.c b/src/util/crypto_wire.c index 6fdf65511..7aaf7d15d 100644 --- a/src/util/crypto_wire.c +++ b/src/util/crypto_wire.c @@ -59,14 +59,15 @@ TALER_exchange_wire_signature_check ( const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig) { - struct TALER_MasterWireDetailsPS wd; + struct TALER_MasterWireDetailsPS wd = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS), + .purpose.size = htonl (sizeof (wd)) + }; - wd.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS); - wd.purpose.size = htonl (sizeof (wd)); TALER_exchange_wire_signature_hash (payto_uri, &wd.h_wire_details); return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_DETAILS, - &wd.purpose, + &wd, &master_sig->eddsa_signature, &master_pub->eddsa_pub); } @@ -85,16 +86,16 @@ TALER_exchange_wire_signature_make ( const struct TALER_MasterPrivateKeyP *master_priv, struct TALER_MasterSignatureP *master_sig) { - struct TALER_MasterWireDetailsPS wd; + struct TALER_MasterWireDetailsPS wd = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS), + .purpose.size = htonl (sizeof (wd)) + }; - wd.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS); - wd.purpose.size = htonl (sizeof (wd)); TALER_exchange_wire_signature_hash (payto_uri, &wd.h_wire_details); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv, - &wd.purpose, - &master_sig->eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv, + &wd, + &master_sig->eddsa_signature); } @@ -149,15 +150,16 @@ TALER_merchant_wire_signature_check ( const struct TALER_MerchantPublicKeyP *merch_pub, const struct TALER_MerchantSignatureP *merch_sig) { - struct TALER_MasterWireDetailsPS wd; + struct TALER_MasterWireDetailsPS wd = { + .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS), + .purpose.size = htonl (sizeof (wd)) + }; - wd.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS); - wd.purpose.size = htonl (sizeof (wd)); TALER_merchant_wire_signature_hash (payto_uri, salt, &wd.h_wire_details); return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS, - &wd.purpose, + &wd, &merch_sig->eddsa_sig, &merch_pub->eddsa_pub); } @@ -178,17 +180,17 @@ TALER_merchant_wire_signature_make ( const struct TALER_MerchantPrivateKeyP *merch_priv, struct TALER_MerchantSignatureP *merch_sig) { - struct TALER_MasterWireDetailsPS wd; + struct TALER_MasterWireDetailsPS wd = { + .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS), + .purpose.size = htonl (sizeof (wd)) + }; - wd.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS); - wd.purpose.size = htonl (sizeof (wd)); TALER_merchant_wire_signature_hash (payto_uri, salt, &wd.h_wire_details); - GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&merch_priv->eddsa_priv, - &wd.purpose, - &merch_sig->eddsa_sig)); + GNUNET_CRYPTO_eddsa_sign (&merch_priv->eddsa_priv, + &wd, + &merch_sig->eddsa_sig); } -- cgit v1.2.3