From 464c1f806cd1518ebd87b598c7d8232e9f234ac2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 24 Oct 2021 12:25:57 +0200 Subject: -more changes towards fixing FTBFS --- src/exchange/taler-exchange-aggregator.c | 4 ++-- src/exchange/taler-exchange-closer.c | 7 ++++--- src/include/taler_exchange_service.h | 2 +- src/lib/auditor_api_exchanges.c | 15 ++++++++------- src/lib/exchange_api_deposit.c | 33 ++++++++++++++++---------------- src/lib/exchange_api_deposits_get.c | 27 +++++++++++--------------- src/lib/exchange_api_handle.c | 6 +++--- src/lib/exchange_api_melt.c | 8 ++++---- src/lib/exchange_api_refresh_common.c | 2 +- 9 files changed, 50 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index afedd7e37..22bc3c7bb 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -363,7 +363,7 @@ deposit_cb (void *cls, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, const json_t *wire) { struct AggregationUnit *au = cls; @@ -528,7 +528,7 @@ aggregate_cb (void *cls, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, - const struct GNUNET_HashCode *h_contract_terms) + const struct TALER_PrivateContractHash *h_contract_terms) { struct AggregationUnit *au = cls; struct TALER_Amount old; diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c index 91ececc85..a206cea80 100644 --- a/src/exchange/taler-exchange-closer.c +++ b/src/exchange/taler-exchange-closer.c @@ -217,7 +217,7 @@ expired_reserve_cb (void *cls, struct TALER_WireTransferIdentifierRawP wtid; struct TALER_Amount amount_without_fee; struct TALER_Amount closing_fee; - int ret; + enum TALER_AmountArithmeticResult ret; enum GNUNET_DB_QueryStatus qs; const struct TALER_EXCHANGEDB_AccountInfo *wa; @@ -273,8 +273,8 @@ expired_reserve_cb (void *cls, ret = TALER_amount_subtract (&amount_without_fee, left, &closing_fee); - if ( (GNUNET_SYSERR == ret) || - (GNUNET_NO == ret) ) + if ( (TALER_AAR_INVALID_NEGATIVE_RESULT == ret) || + (TALER_AAR_RESULT_ZERO == ret) ) { /* Closing fee higher than or equal to remaining balance, close without wire transfer. */ @@ -283,6 +283,7 @@ expired_reserve_cb (void *cls, TALER_amount_set_zero (left->currency, &amount_without_fee)); } + GNUNET_assert (TALER_AAR_RESULT_POSITIVE == ret); /* round down to enable transfer */ if (GNUNET_SYSERR == TALER_amount_round_down (&amount_without_fee, diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index d82e4b096..8020eae44 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -558,7 +558,7 @@ TALER_EXCHANGE_get_keys_raw (struct TALER_EXCHANGE_Handle *exchange); * @param pub claimed current online signing key for the exchange * @return #GNUNET_OK if @a pub is (according to /keys) a current signing key */ -int +enum GNUNET_GenericReturnValue TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys, const struct TALER_ExchangePublicKeyP *pub); diff --git a/src/lib/auditor_api_exchanges.c b/src/lib/auditor_api_exchanges.c index 0fe4ce287..136212258 100644 --- a/src/lib/auditor_api_exchanges.c +++ b/src/lib/auditor_api_exchanges.c @@ -122,9 +122,9 @@ handle_exchanges_finished (void *cls, } { struct TALER_AUDITOR_ExchangeInfo ei[ja_len]; - int ok; + bool ok; - ok = GNUNET_YES; + ok = true; for (unsigned int i = 0; icb (leh->cb_cls, &hr, @@ -220,7 +220,8 @@ TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor, leh->auditor = auditor; leh->cb = cb; leh->cb_cls = cb_cls; - leh->url = TALER_AUDITOR_path_to_url_ (auditor, "/exchanges"); + leh->url = TALER_AUDITOR_path_to_url_ (auditor, + "/exchanges"); if (NULL == leh->url) { GNUNET_free (leh); @@ -253,8 +254,8 @@ TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor, * @param leh the list exchanges request handle */ void -TALER_AUDITOR_list_exchanges_cancel (struct - TALER_AUDITOR_ListExchangesHandle *leh) +TALER_AUDITOR_list_exchanges_cancel ( + struct TALER_AUDITOR_ListExchangesHandle *leh) { if (NULL != leh->job) { diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 35e09bd07..d153a2733 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -420,12 +420,12 @@ handle_deposit_finished (void *cls, static enum GNUNET_GenericReturnValue verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki, const struct TALER_Amount *amount, - const struct GNUNET_HashCode *h_wire, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_MerchantWireHash *h_wire, + const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationPublicKey *denom_pub, - const struct GNUNET_HashCode *denom_pub_hash, + const struct TALER_DenominationHash *denom_pub_hash, struct GNUNET_TIME_Absolute timestamp, const struct TALER_MerchantPublicKeyP *merchant_pub, struct GNUNET_TIME_Absolute refund_deadline, @@ -500,9 +500,9 @@ void TALER_EXCHANGE_deposit_permission_sign ( const struct TALER_Amount *amount, const struct TALER_Amount *deposit_fee, - const struct GNUNET_HashCode *h_wire, - const struct GNUNET_HashCode *h_contract_terms, - const struct GNUNET_HashCode *h_denom_pub, + const struct TALER_MerchantWireHash *h_wire, + const struct TALER_PrivateContractHash *h_contract_terms, + const struct TALER_DenominationHash *h_denom_pub, const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct GNUNET_TIME_Absolute wallet_timestamp, const struct TALER_MerchantPublicKeyP *merchant_pub, @@ -510,10 +510,8 @@ TALER_EXCHANGE_deposit_permission_sign ( struct TALER_CoinSpendSignatureP *coin_sig) { struct TALER_DepositRequestPS dr = { - .purpose.size = htonl - (sizeof (dr)), - .purpose.purpose = htonl - (TALER_SIGNATURE_WALLET_COIN_DEPOSIT), + .purpose.size = htonl (sizeof (dr)), + .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT), .h_contract_terms = *h_contract_terms, .h_wire = *h_wire, .h_denom_pub = *h_denom_pub, @@ -543,7 +541,8 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_Amount *amount, struct GNUNET_TIME_Absolute wire_deadline, json_t *wire_details, - const struct GNUNET_HashCode *h_contract_terms, + const struct + TALER_PrivateContractHash *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationPublicKey *denom_pub, @@ -561,8 +560,8 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, struct GNUNET_CURL_Context *ctx; json_t *deposit_obj; CURL *eh; - struct GNUNET_HashCode h_wire; - struct GNUNET_HashCode denom_pub_hash; + struct TALER_MerchantWireHash h_wire; + struct TALER_DenominationHash denom_pub_hash; struct TALER_Amount amount_without_fee; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; @@ -678,10 +677,10 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, json_decref (deposit_obj); return NULL; } - dh->depconf.purpose.size = htonl (sizeof (struct - TALER_DepositConfirmationPS)); - dh->depconf.purpose.purpose = htonl ( - TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT); + dh->depconf.purpose.size + = htonl (sizeof (struct TALER_DepositConfirmationPS)); + dh->depconf.purpose.purpose + = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT); dh->depconf.h_contract_terms = *h_contract_terms; dh->depconf.h_wire = h_wire; /* dh->depconf.exchange_timestamp; -- initialized later from exchange reply! */ diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c index e449aefbe..843b00ff3 100644 --- a/src/lib/exchange_api_deposits_get.c +++ b/src/lib/exchange_api_deposits_get.c @@ -278,8 +278,8 @@ struct TALER_EXCHANGE_DepositGetHandle * TALER_EXCHANGE_deposits_get ( struct TALER_EXCHANGE_Handle *exchange, const struct TALER_MerchantPrivateKeyP *merchant_priv, - const struct GNUNET_HashCode *h_wire, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_MerchantWireHash *h_wire, + const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_CoinSpendPublicKeyP *coin_pub, TALER_EXCHANGE_DepositGetCallback cb, void *cb_cls) @@ -290,9 +290,9 @@ TALER_EXCHANGE_deposits_get ( struct GNUNET_CURL_Context *ctx; CURL *eh; char arg_str[(sizeof (struct TALER_CoinSpendPublicKeyP) - + sizeof (struct GNUNET_HashCode) + + sizeof (struct TALER_MerchantWireHash) + sizeof (struct TALER_MerchantPublicKeyP) - + sizeof (struct GNUNET_HashCode) + + sizeof (struct TALER_PrivateContractHash) + sizeof (struct TALER_MerchantSignatureP)) * 2 + 48]; if (GNUNET_YES != @@ -316,37 +316,32 @@ TALER_EXCHANGE_deposits_get ( char cpub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char mpub_str[sizeof (struct TALER_MerchantPublicKeyP) * 2]; char msig_str[sizeof (struct TALER_MerchantSignatureP) * 2]; - char chash_str[sizeof (struct GNUNET_HashCode) * 2]; - char whash_str[sizeof (struct GNUNET_HashCode) * 2]; + char chash_str[sizeof (struct TALER_PrivateContractHash) * 2]; + char whash_str[sizeof (struct TALER_MerchantWireHash) * 2]; char *end; end = GNUNET_STRINGS_data_to_string (h_wire, - sizeof (struct - GNUNET_HashCode), + sizeof (*h_wire), whash_str, sizeof (whash_str)); *end = '\0'; end = GNUNET_STRINGS_data_to_string (&dtp.merchant, - sizeof (struct - TALER_MerchantPublicKeyP), + sizeof (dtp.merchant), mpub_str, sizeof (mpub_str)); *end = '\0'; end = GNUNET_STRINGS_data_to_string (h_contract_terms, - sizeof (struct - GNUNET_HashCode), + sizeof (*h_contract_terms), chash_str, sizeof (chash_str)); *end = '\0'; end = GNUNET_STRINGS_data_to_string (coin_pub, - sizeof (struct - TALER_CoinSpendPublicKeyP), + sizeof (*coin_pub), cpub_str, sizeof (cpub_str)); *end = '\0'; end = GNUNET_STRINGS_data_to_string (&merchant_sig, - sizeof (struct - TALER_MerchantSignatureP), + sizeof (merchant_sig), msig_str, sizeof (msig_str)); *end = '\0'; diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 215f122be..0b19c795d 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -445,7 +445,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, off = 0; json_array_foreach (keys, i, key) { struct TALER_AuditorSignatureP auditor_sig; - struct GNUNET_HashCode denom_h; + struct TALER_DenominationHash denom_h; const struct TALER_EXCHANGE_DenomPublicKey *dk; unsigned int dk_off; struct GNUNET_JSON_Specification kspec[] = { @@ -2010,7 +2010,7 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange) * @param pub claimed current online signing key for the exchange * @return #GNUNET_OK if @a pub is (according to /keys) a current signing key */ -int +enum GNUNET_GenericReturnValue TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys, const struct TALER_ExchangePublicKeyP *pub) { @@ -2114,7 +2114,7 @@ TALER_EXCHANGE_destroy_denomination_key ( const struct TALER_EXCHANGE_DenomPublicKey * TALER_EXCHANGE_get_denomination_key_by_hash ( const struct TALER_EXCHANGE_Keys *keys, - const struct GNUNET_HashCode *hc) + const struct TALER_DenominationHash *hc) { for (unsigned int i = 0; inum_denom_keys; i++) if (0 == GNUNET_memcmp (hc, diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index dcee66a8b..56475bf2f 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -141,8 +141,8 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh, /* verify signature by exchange */ confirm.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT); - confirm.purpose.size = htonl (sizeof (struct - TALER_RefreshMeltConfirmationPS)); + confirm.purpose.size + = htonl (sizeof (struct TALER_RefreshMeltConfirmationPS)); confirm.rc = mh->md->rc; confirm.noreveal_index = htonl (*noreveal_index); if (GNUNET_OK != @@ -167,14 +167,14 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh, * @param json json reply with the signature(s) and transaction history * @return #GNUNET_OK if the signature(s) is valid, #GNUNET_SYSERR if not */ -static int +static enum GNUNET_GenericReturnValue verify_melt_signature_denom_conflict (struct TALER_EXCHANGE_MeltHandle *mh, const json_t *json) { json_t *history; struct TALER_Amount total; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; memset (&h_denom_pub, 0, diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index 00d01e4e5..048cf60e6 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -579,7 +579,7 @@ TALER_EXCHANGE_refresh_prepare ( struct TALER_PlanchetSecretsP *fc = &md.fresh_coins[i][j]; struct TALER_RefreshCoinData *rcd = &rce[i].new_coins[j]; struct TALER_PlanchetDetail pd; - struct GNUNET_HashCode c_hash; + struct TALER_CoinPubHash c_hash; TALER_planchet_setup_refresh (&trans_sec[i], j, -- cgit v1.2.3