From f7d08e8c2bbd6c5eaa73f339f551683c9d93ebeb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 25 Oct 2021 17:19:41 +0200 Subject: -work on FTBFS; --- src/lib/exchange_api_common.c | 6 ++-- src/lib/exchange_api_deposit.c | 7 +++-- src/lib/exchange_api_kyc_check.c | 4 +-- src/lib/exchange_api_link.c | 32 ++++++++++++---------- src/lib/exchange_api_management_get_keys.c | 31 ++++++++------------- ...change_api_management_revoke_denomination_key.c | 2 +- 6 files changed, 39 insertions(+), 43 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index 143ceddae..1cb11f1be 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -340,10 +340,8 @@ TALER_EXCHANGE_parse_reserve_history ( } TALER_amount_hton (&rcc.closing_amount, &amount); - GNUNET_CRYPTO_hash ( - rh->details.close_details.receiver_account_details, - strlen (rh->details.close_details.receiver_account_details) + 1, - &rcc.h_wire); + TALER_payto_hash (rh->details.close_details.receiver_account_details, + &rcc.h_payto); rcc.wtid = rh->details.close_details.wtid; rcc.purpose.size = htonl (sizeof (rcc)); rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED); diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 461a282cf..e8fe5faf6 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -502,6 +502,7 @@ TALER_EXCHANGE_deposit_permission_sign ( const struct TALER_Amount *deposit_fee, const struct TALER_MerchantWireHash *h_wire, const struct TALER_PrivateContractHash *h_contract_terms, + const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_DenominationHash *h_denom_pub, const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct GNUNET_TIME_Absolute wallet_timestamp, @@ -520,6 +521,7 @@ TALER_EXCHANGE_deposit_permission_sign ( .merchant = *merchant_pub }; + // FIXME: sign also over h_extensions! GNUNET_assert (GNUNET_OK == GNUNET_TIME_round_abs (&wallet_timestamp)); GNUNET_assert (GNUNET_OK == @@ -541,8 +543,9 @@ TALER_EXCHANGE_deposit ( struct TALER_EXCHANGE_Handle *exchange, const struct TALER_Amount *amount, struct GNUNET_TIME_Absolute wire_deadline, - json_t *wire_details, + const json_t *wire_details, const struct TALER_PrivateContractHash *h_contract_terms, + const json_t *extension_details, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationPublicKey *denom_pub, @@ -642,7 +645,7 @@ TALER_EXCHANGE_deposit ( TALER_JSON_pack_amount ("contribution", amount), GNUNET_JSON_pack_object_incref ("wire", - wire_details), + (json_t *) wire_details), GNUNET_JSON_pack_data_auto ("h_wire", &h_wire), GNUNET_JSON_pack_data_auto ("h_contract_terms", diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c index 82fddd455..f64dfe4ea 100644 --- a/src/lib/exchange_api_kyc_check.c +++ b/src/lib/exchange_api_kyc_check.c @@ -64,7 +64,7 @@ struct TALER_EXCHANGE_KycCheckHandle /** * Hash of the payto:// URL that is being KYC'ed. */ - struct GNUNET_HashCode h_payto; + struct TALER_PaytoHash h_payto; }; @@ -216,7 +216,7 @@ handle_kyc_check_finished (void *cls, struct TALER_EXCHANGE_KycCheckHandle * TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange, uint64_t payment_target, - const struct GNUNET_HashCode *h_payto, + const struct TALER_PaytoHash *h_payto, struct GNUNET_TIME_Relative timeout, TALER_EXCHANGE_KycStatusCallback cb, void *cb_cls) diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index ceb318841..e36ffcd93 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.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 @@ -92,12 +92,15 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, struct TALER_DenominationPublicKey *pub) { struct GNUNET_CRYPTO_RsaSignature *bsig; - struct GNUNET_CRYPTO_RsaPublicKey *rpub; + struct TALER_DenominationPublicKey rpub; struct TALER_CoinSpendSignatureP link_sig; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_rsa_public_key ("denom_pub", &rpub), - GNUNET_JSON_spec_rsa_signature ("ev_sig", &bsig), - GNUNET_JSON_spec_fixed_auto ("link_sig", &link_sig), + TALER_JSON_spec_denomination_public_key ("denom_pub", + &rpub), + GNUNET_JSON_spec_rsa_signature ("ev_sig", + &bsig), + GNUNET_JSON_spec_fixed_auto ("link_sig", + &link_sig), GNUNET_JSON_spec_end () }; struct TALER_TransferSecretP secret; @@ -121,21 +124,21 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, /* extract coin and signature */ *coin_priv = fc.coin_priv; - sig->rsa_signature + sig->cipher = TALER_DENOMINATION_RSA; + sig->details.rsa_signature = TALER_rsa_unblind (bsig, &fc.blinding_key.bks, - rpub); + rpub.details.rsa_public_key); /* verify link_sig */ { struct TALER_PlanchetDetail pd; - struct GNUNET_HashCode c_hash; + struct TALER_CoinPubHash c_hash; struct TALER_CoinSpendPublicKeyP old_coin_pub; GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv, &old_coin_pub.eddsa_pub); - pub->rsa_public_key = rpub; if (GNUNET_OK != - TALER_planchet_prepare (pub, + TALER_planchet_prepare (&rpub, &fc, &c_hash, &pd)) @@ -161,7 +164,8 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, } /* clean up */ - pub->rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (rpub); + TALER_denom_pub_deep_copy (pub, + &rpub); GNUNET_JSON_parse_free (spec); return GNUNET_OK; } @@ -323,10 +327,8 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh, GNUNET_assert (off_coin <= num_coins); for (i = 0; iexpire_deposit), TALER_JSON_spec_absolute_time ("stamp_expire_legal", &denom_key->expire_legal), - GNUNET_JSON_spec_rsa_public_key ("denom_pub", - &denom_key->key.rsa_public_key), + TALER_JSON_spec_denomination_public_key ("denom_pub", + &denom_key->key), TALER_JSON_spec_amount_any ("fee_withdraw", &denom_key->fee_withdraw), TALER_JSON_spec_amount_any ("fee_deposit", @@ -212,20 +212,20 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh, } { + struct TALER_DenominationHash h_denom_pub; struct GNUNET_TIME_Relative duration = GNUNET_TIME_absolute_get_difference (denom_key->valid_from, denom_key->withdraw_valid_until); - struct GNUNET_HashCode h_denom_pub; - GNUNET_CRYPTO_rsa_public_key_hash (denom_key->key.rsa_public_key, - &h_denom_pub); + TALER_denom_pub_hash (&denom_key->key, + &h_denom_pub); if (GNUNET_OK != - TALER_exchange_secmod_rsa_verify (&h_denom_pub, - section_name, - denom_key->valid_from, - duration, - &fk.denom_secmod_public_key, - &denom_key->denom_secmod_sig)) + TALER_exchange_secmod_denom_verify (&h_denom_pub, + section_name, + denom_key->valid_from, + duration, + &fk.denom_secmod_public_key, + &denom_key->denom_secmod_sig)) { GNUNET_break_op (0); ok = false; @@ -246,14 +246,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh, &fk); } for (unsigned int i = 0; i