summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-08 18:18:20 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-08 18:18:20 +0200
commit50bc862a684f8c5d4e3ece2712322bf078fe604f (patch)
tree54d4facce006a8437c58e64e7f2106a3487cba83 /src/lib
parentb22ec7570e830a3f71ed7c33b23879b2c3385387 (diff)
downloadexchange-50bc862a684f8c5d4e3ece2712322bf078fe604f.tar.gz
exchange-50bc862a684f8c5d4e3ece2712322bf078fe604f.tar.bz2
exchange-50bc862a684f8c5d4e3ece2712322bf078fe604f.zip
adapt to new GNUnet sign API (#6164)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/auditor_api_deposit_confirmation.c84
-rw-r--r--src/lib/exchange_api_common.c14
-rw-r--r--src/lib/exchange_api_deposit.c4
-rw-r--r--src/lib/exchange_api_deposits_get.c9
-rw-r--r--src/lib/exchange_api_handle.c8
-rw-r--r--src/lib/exchange_api_link.c2
-rw-r--r--src/lib/exchange_api_melt.c4
-rw-r--r--src/lib/exchange_api_recoup.c8
-rw-r--r--src/lib/exchange_api_refreshes_reveal.c8
-rw-r--r--src/lib/exchange_api_refund.c9
-rw-r--r--src/lib/exchange_api_transfers_get.c2
-rw-r--r--src/lib/exchange_api_withdraw.c7
12 files changed, 80 insertions, 79 deletions
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,