adapt to new GNUnet sign API (#6164)

This commit is contained in:
Christian Grothoff 2020-04-08 18:18:20 +02:00
parent b22ec7570e
commit 50bc862a68
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
34 changed files with 218 additions and 190 deletions

View File

@ -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))
{

View File

@ -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)

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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);
}

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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));

View File

@ -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); \
})
/**

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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,

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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;
{
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
};
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");
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)
{

View File

@ -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))
{

View File

@ -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))
{

View File

@ -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];

View File

@ -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));
}

View File

@ -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))
{

View File

@ -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);

View File

@ -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 */

View File

@ -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 (

View File

@ -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,

View File

@ -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))
{

View File

@ -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,

View File

@ -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,

View File

@ -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);
}