From f0951d34ddd525a04bcb9daabbc55bd1ced2575e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 25 Oct 2021 18:02:27 +0200 Subject: -fix more FTBFS --- src/lib/exchange_api_melt.c | 12 +++++++----- src/lib/exchange_api_recoup.c | 12 +++++++----- src/lib/exchange_api_refresh_common.c | 8 +++----- src/lib/exchange_api_refreshes_reveal.c | 30 ++++++++++++++++-------------- src/lib/exchange_api_refund.c | 2 +- src/lib/exchange_api_transfers_get.c | 2 +- src/lib/exchange_api_withdraw.c | 16 +++++----------- src/lib/exchange_api_withdraw2.c | 2 +- 8 files changed, 41 insertions(+), 43 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index 56475bf2f..5b6dd96ef 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -226,7 +226,7 @@ verify_melt_signature_spend_conflict (struct TALER_EXCHANGE_MeltHandle *mh, }; const struct MeltedCoin *mc; enum TALER_ErrorCode ec; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; /* parse JSON reply */ if (GNUNET_OK != @@ -486,8 +486,8 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, &md->melted_coin.fee_melt); GNUNET_CRYPTO_eddsa_key_get_public (&md->melted_coin.coin_priv.eddsa_priv, &melt.coin_pub.eddsa_pub); - GNUNET_CRYPTO_rsa_public_key_hash (md->melted_coin.pub_key.rsa_public_key, - &melt.h_denom_pub); + TALER_denom_pub_hash (&md->melted_coin.pub_key, + &melt.h_denom_pub); GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, &melt, &confirm_sig.eddsa_signature); @@ -529,8 +529,10 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, mh->exchange = exchange; mh->coin_pub = melt.coin_pub; mh->dki = *dki; - mh->dki.key.rsa_public_key = NULL; /* lifetime not warranted, so better - not copy the pointer */ + memset (&mh->dki.key, + 0, + sizeof (mh->dki.key)); /* lifetime not warranted, so better + not copy the pointers */ mh->melt_cb = melt_cb; mh->melt_cb_cls = melt_cb_cls; mh->md = md; diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c index 09d99b236..3a6fd87f2 100644 --- a/src/lib/exchange_api_recoup.c +++ b/src/lib/exchange_api_recoup.c @@ -187,7 +187,7 @@ handle_recoup_finished (void *cls, /* Insufficient funds, proof attached */ json_t *history; struct TALER_Amount total; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; const struct TALER_EXCHANGE_DenomPublicKey *dki; enum TALER_ErrorCode ec; @@ -313,7 +313,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, struct GNUNET_CURL_Context *ctx; struct TALER_RecoupRequestPS pr; struct TALER_CoinSpendSignatureP coin_sig; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; json_t *recoup_obj; CURL *eh; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; @@ -324,8 +324,8 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, pr.purpose.size = htonl (sizeof (struct TALER_RecoupRequestPS)); GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv, &pr.coin_pub.eddsa_pub); - GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, - &h_denom_pub); + TALER_denom_pub_hash (&pk->key, + &h_denom_pub); pr.h_denom_pub = pk->h_key; pr.coin_blind = ps->blinding_key; GNUNET_CRYPTO_eddsa_sign (&ps->coin_priv.eddsa_priv, @@ -362,7 +362,9 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, ph->coin_pub = pr.coin_pub; ph->exchange = exchange; ph->pk = *pk; - ph->pk.key.rsa_public_key = NULL; /* zero out, as lifetime cannot be warranted */ + memset (&ph->pk.key, + 0, + sizeof (ph->pk.key)); /* zero out, as lifetime cannot be warranted */ ph->cb = recoup_cb; ph->cb_cls = recoup_cb_cls; ph->url = TEAH_path_to_url (exchange, diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index 048cf60e6..8f350dc9f 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2015-2020 Taler Systems SA + Copyright (C) 2015-2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -32,10 +32,8 @@ static void free_melted_coin (struct MeltedCoin *mc) { - if (NULL != mc->pub_key.rsa_public_key) - GNUNET_CRYPTO_rsa_public_key_free (mc->pub_key.rsa_public_key); - if (NULL != mc->sig.rsa_signature) - GNUNET_CRYPTO_rsa_signature_free (mc->sig.rsa_signature); + TALER_denom_pub_free (&mc->pub_key); + TALER_denom_sig_free (&mc->sig); } diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index f54487ae3..1cb9eada1 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -98,14 +98,15 @@ struct TALER_EXCHANGE_RefreshesRevealHandle * @param[out] sigs array of length `num_fresh_coins`, initialized to contain RSA signatures * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors */ -static int +static enum GNUNET_GenericReturnValue refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh, const json_t *json, struct TALER_DenominationSignature *sigs) { json_t *jsona; struct GNUNET_JSON_Specification outer_spec[] = { - GNUNET_JSON_spec_json ("ev_sigs", &jsona), + GNUNET_JSON_spec_json ("ev_sigs", + &jsona), GNUNET_JSON_spec_end () }; @@ -138,9 +139,10 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh, json_t *jsonai; struct GNUNET_CRYPTO_RsaSignature *blind_sig; struct TALER_CoinSpendPublicKeyP coin_pub; - struct GNUNET_HashCode coin_hash; + struct TALER_CoinPubHash coin_hash; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig), + GNUNET_JSON_spec_rsa_signature ("ev_sig", + &blind_sig), GNUNET_JSON_spec_end () }; struct TALER_FreshCoin coin; @@ -164,9 +166,8 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh, hence recomputing it here... */ GNUNET_CRYPTO_eddsa_key_get_public (&fc->coin_priv.eddsa_priv, &coin_pub.eddsa_pub); - GNUNET_CRYPTO_hash (&coin_pub.eddsa_pub, - sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), - &coin_hash); + TALER_coin_pub_hash (&coin_pub, + &coin_hash); if (GNUNET_OK != TALER_planchet_to_coin (pk, blind_sig, @@ -218,7 +219,9 @@ handle_refresh_reveal_finished (void *cls, struct TALER_DenominationSignature sigs[rrh->md->num_fresh_coins]; int ret; - memset (sigs, 0, sizeof (sigs)); + memset (sigs, + 0, + sizeof (sigs)); ret = refresh_reveal_ok (rrh, j, sigs); @@ -237,8 +240,7 @@ handle_refresh_reveal_finished (void *cls, rrh->reveal_cb = NULL; } for (unsigned int i = 0; imd->num_fresh_coins; i++) - if (NULL != sigs[i].rsa_signature) - GNUNET_CRYPTO_rsa_signature_free (sigs[i].rsa_signature); + TALER_denom_sig_free (&sigs[i]); TALER_EXCHANGE_refreshes_reveal_cancel (rrh); return; } @@ -342,12 +344,12 @@ TALER_EXCHANGE_refreshes_reveal ( GNUNET_assert (NULL != (link_sigs = json_array ())); for (unsigned int i = 0; inum_fresh_coins; i++) { - struct GNUNET_HashCode denom_hash; + struct TALER_DenominationHash denom_hash; struct TALER_PlanchetDetail pd; - struct GNUNET_HashCode c_hash; + struct TALER_CoinPubHash c_hash; - GNUNET_CRYPTO_rsa_public_key_hash (md->fresh_pks[i].rsa_public_key, - &denom_hash); + TALER_denom_pub_hash (&md->fresh_pks[i], + &denom_hash); GNUNET_assert (0 == json_array_append_new (new_denoms_h, GNUNET_JSON_from_data_auto ( diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index f83a2985a..a73f19fc9 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c @@ -638,7 +638,7 @@ handle_refund_finished (void *cls, struct TALER_EXCHANGE_RefundHandle * TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_Amount *amount, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, uint64_t rtransaction_id, const struct TALER_MerchantPrivateKeyP *merchant_priv, diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c index 1f6e419c9..0002d6af6 100644 --- a/src/lib/exchange_api_transfers_get.c +++ b/src/lib/exchange_api_transfers_get.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2020 Taler Systems SA + Copyright (C) 2014-2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index 85b7e7dbf..8e00cfcdb 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -71,7 +71,7 @@ struct TALER_EXCHANGE_WithdrawHandle /** * Hash of the public key of the coin we are signing. */ - struct GNUNET_HashCode c_hash; + struct TALER_CoinPubHash c_hash; }; @@ -142,7 +142,7 @@ handle_reserve_withdraw_finished ( wh->cb (wh->cb_cls, &wr); if (MHD_HTTP_OK == hr->http_status) - GNUNET_CRYPTO_rsa_signature_free (wr.details.success.sig.rsa_signature); + TALER_denom_sig_free (&wr.details.success.sig); TALER_EXCHANGE_withdraw_cancel (wh); } @@ -193,8 +193,8 @@ TALER_EXCHANGE_withdraw ( GNUNET_free (wh); return NULL; } - wh->pk.key.rsa_public_key - = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key); + TALER_denom_pub_deep_copy (&wh->pk.key, + &pk->key); wh->wh2 = TALER_EXCHANGE_withdraw2 (exchange, &pd, reserve_priv, @@ -205,12 +205,6 @@ TALER_EXCHANGE_withdraw ( } -/** - * Cancel a withdraw status request. This function cannot be used - * on a request handle if a response is already served for it. - * - * @param wh the withdraw sign request handle - */ void TALER_EXCHANGE_withdraw_cancel (struct TALER_EXCHANGE_WithdrawHandle *wh) { @@ -219,6 +213,6 @@ TALER_EXCHANGE_withdraw_cancel (struct TALER_EXCHANGE_WithdrawHandle *wh) TALER_EXCHANGE_withdraw2_cancel (wh->wh2); wh->wh2 = NULL; } - GNUNET_CRYPTO_rsa_public_key_free (wh->pk.key.rsa_public_key); + TALER_denom_pub_free (&wh->pk.key); GNUNET_free (wh); } diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c index 330f93d74..e001a3154 100644 --- a/src/lib/exchange_api_withdraw2.c +++ b/src/lib/exchange_api_withdraw2.c @@ -437,7 +437,7 @@ TALER_EXCHANGE_withdraw2 ( TALER_amount_hton (&req.amount_with_fee, &wh->requested_amount); - GNUNET_CRYPTO_hash (pd->coin_ev, + TALER_coin_ev_hash (pd->coin_ev, pd->coin_ev_size, &req.h_coin_envelope); GNUNET_CRYPTO_eddsa_sign (&reserve_priv->eddsa_priv, -- cgit v1.2.3