-work on FTBFS;

This commit is contained in:
Christian Grothoff 2021-10-25 17:19:41 +02:00 committed by Christian Grothoff
parent 58ea04167c
commit f7d08e8c2b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 61 additions and 44 deletions

View File

@ -1677,7 +1677,7 @@ struct TALER_ReserveCloseConfirmationPS
/** /**
* Hash of the receiver's bank account. * Hash of the receiver's bank account.
*/ */
struct TALER_PaytoHash h_wire; struct TALER_PaytoHash h_payto;
/** /**
* Wire transfer subject. * Wire transfer subject.

View File

@ -327,6 +327,17 @@ char *
TALER_payto_get_method (const char *payto_uri); TALER_payto_get_method (const char *payto_uri);
/**
* Compute the hash of a payto URI.
*
* @param payto URI to hash
* @param[out] h_payto where to write the hash
*/
void
TALER_payto_hash (const char *payto,
struct TALER_PaytoHash *h_payto);
/** /**
* Obtain the account name from a payto URL. * Obtain the account name from a payto URL.
* *

View File

@ -340,10 +340,8 @@ TALER_EXCHANGE_parse_reserve_history (
} }
TALER_amount_hton (&rcc.closing_amount, TALER_amount_hton (&rcc.closing_amount,
&amount); &amount);
GNUNET_CRYPTO_hash ( TALER_payto_hash (rh->details.close_details.receiver_account_details,
rh->details.close_details.receiver_account_details, &rcc.h_payto);
strlen (rh->details.close_details.receiver_account_details) + 1,
&rcc.h_wire);
rcc.wtid = rh->details.close_details.wtid; rcc.wtid = rh->details.close_details.wtid;
rcc.purpose.size = htonl (sizeof (rcc)); rcc.purpose.size = htonl (sizeof (rcc));
rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED); rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);

View File

@ -502,6 +502,7 @@ TALER_EXCHANGE_deposit_permission_sign (
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHash *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct GNUNET_TIME_Absolute wallet_timestamp, struct GNUNET_TIME_Absolute wallet_timestamp,
@ -520,6 +521,7 @@ TALER_EXCHANGE_deposit_permission_sign (
.merchant = *merchant_pub .merchant = *merchant_pub
}; };
// FIXME: sign also over h_extensions!
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&wallet_timestamp)); GNUNET_TIME_round_abs (&wallet_timestamp));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
@ -541,8 +543,9 @@ TALER_EXCHANGE_deposit (
struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute wire_deadline, struct GNUNET_TIME_Absolute wire_deadline,
json_t *wire_details, const json_t *wire_details,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHash *h_contract_terms,
const json_t *extension_details,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
@ -642,7 +645,7 @@ TALER_EXCHANGE_deposit (
TALER_JSON_pack_amount ("contribution", TALER_JSON_pack_amount ("contribution",
amount), amount),
GNUNET_JSON_pack_object_incref ("wire", GNUNET_JSON_pack_object_incref ("wire",
wire_details), (json_t *) wire_details),
GNUNET_JSON_pack_data_auto ("h_wire", GNUNET_JSON_pack_data_auto ("h_wire",
&h_wire), &h_wire),
GNUNET_JSON_pack_data_auto ("h_contract_terms", GNUNET_JSON_pack_data_auto ("h_contract_terms",

View File

@ -64,7 +64,7 @@ struct TALER_EXCHANGE_KycCheckHandle
/** /**
* Hash of the payto:// URL that is being KYC'ed. * 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 * struct TALER_EXCHANGE_KycCheckHandle *
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
uint64_t payment_target, uint64_t payment_target,
const struct GNUNET_HashCode *h_payto, const struct TALER_PaytoHash *h_payto,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
TALER_EXCHANGE_KycStatusCallback cb, TALER_EXCHANGE_KycStatusCallback cb,
void *cb_cls) void *cb_cls)

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER 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 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 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 TALER_DenominationPublicKey *pub)
{ {
struct GNUNET_CRYPTO_RsaSignature *bsig; struct GNUNET_CRYPTO_RsaSignature *bsig;
struct GNUNET_CRYPTO_RsaPublicKey *rpub; struct TALER_DenominationPublicKey rpub;
struct TALER_CoinSpendSignatureP link_sig; struct TALER_CoinSpendSignatureP link_sig;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_rsa_public_key ("denom_pub", &rpub), TALER_JSON_spec_denomination_public_key ("denom_pub",
GNUNET_JSON_spec_rsa_signature ("ev_sig", &bsig), &rpub),
GNUNET_JSON_spec_fixed_auto ("link_sig", &link_sig), GNUNET_JSON_spec_rsa_signature ("ev_sig",
&bsig),
GNUNET_JSON_spec_fixed_auto ("link_sig",
&link_sig),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct TALER_TransferSecretP secret; struct TALER_TransferSecretP secret;
@ -121,21 +124,21 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
/* extract coin and signature */ /* extract coin and signature */
*coin_priv = fc.coin_priv; *coin_priv = fc.coin_priv;
sig->rsa_signature sig->cipher = TALER_DENOMINATION_RSA;
sig->details.rsa_signature
= TALER_rsa_unblind (bsig, = TALER_rsa_unblind (bsig,
&fc.blinding_key.bks, &fc.blinding_key.bks,
rpub); rpub.details.rsa_public_key);
/* verify link_sig */ /* verify link_sig */
{ {
struct TALER_PlanchetDetail pd; struct TALER_PlanchetDetail pd;
struct GNUNET_HashCode c_hash; struct TALER_CoinPubHash c_hash;
struct TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_CoinSpendPublicKeyP old_coin_pub;
GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv,
&old_coin_pub.eddsa_pub); &old_coin_pub.eddsa_pub);
pub->rsa_public_key = rpub;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_prepare (pub, TALER_planchet_prepare (&rpub,
&fc, &fc,
&c_hash, &c_hash,
&pd)) &pd))
@ -161,7 +164,8 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
} }
/* clean up */ /* 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); GNUNET_JSON_parse_free (spec);
return GNUNET_OK; return GNUNET_OK;
} }
@ -323,10 +327,8 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
GNUNET_assert (off_coin <= num_coins); GNUNET_assert (off_coin <= num_coins);
for (i = 0; i<off_coin; i++) for (i = 0; i<off_coin; i++)
{ {
if (NULL != sigs[i].rsa_signature) TALER_denom_sig_free (&sigs[i]);
GNUNET_CRYPTO_rsa_signature_free (sigs[i].rsa_signature); TALER_denom_pub_free (&pubs[i]);
if (NULL != pubs[i].rsa_public_key)
GNUNET_CRYPTO_rsa_public_key_free (pubs[i].rsa_public_key);
} }
} }
return ret; return ret;

View File

@ -179,8 +179,8 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
&denom_key->expire_deposit), &denom_key->expire_deposit),
TALER_JSON_spec_absolute_time ("stamp_expire_legal", TALER_JSON_spec_absolute_time ("stamp_expire_legal",
&denom_key->expire_legal), &denom_key->expire_legal),
GNUNET_JSON_spec_rsa_public_key ("denom_pub", TALER_JSON_spec_denomination_public_key ("denom_pub",
&denom_key->key.rsa_public_key), &denom_key->key),
TALER_JSON_spec_amount_any ("fee_withdraw", TALER_JSON_spec_amount_any ("fee_withdraw",
&denom_key->fee_withdraw), &denom_key->fee_withdraw),
TALER_JSON_spec_amount_any ("fee_deposit", TALER_JSON_spec_amount_any ("fee_deposit",
@ -212,15 +212,15 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
} }
{ {
struct TALER_DenominationHash h_denom_pub;
struct GNUNET_TIME_Relative duration struct GNUNET_TIME_Relative duration
= GNUNET_TIME_absolute_get_difference (denom_key->valid_from, = GNUNET_TIME_absolute_get_difference (denom_key->valid_from,
denom_key->withdraw_valid_until); denom_key->withdraw_valid_until);
struct GNUNET_HashCode h_denom_pub;
GNUNET_CRYPTO_rsa_public_key_hash (denom_key->key.rsa_public_key, TALER_denom_pub_hash (&denom_key->key,
&h_denom_pub); &h_denom_pub);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_exchange_secmod_rsa_verify (&h_denom_pub, TALER_exchange_secmod_denom_verify (&h_denom_pub,
section_name, section_name,
denom_key->valid_from, denom_key->valid_from,
duration, duration,
@ -246,14 +246,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
&fk); &fk);
} }
for (unsigned int i = 0; i<fk.num_denom_keys; i++) for (unsigned int i = 0; i<fk.num_denom_keys; i++)
{ TALER_denom_pub_free (&fk.denom_keys[i].key);
if (NULL != fk.denom_keys[i].key.rsa_public_key)
{
GNUNET_CRYPTO_rsa_public_key_free (
fk.denom_keys[i].key.rsa_public_key);
fk.denom_keys[i].key.rsa_public_key = NULL;
}
}
GNUNET_free (fk.sign_keys); GNUNET_free (fk.sign_keys);
GNUNET_free (fk.denom_keys); GNUNET_free (fk.denom_keys);
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);

View File

@ -125,7 +125,7 @@ struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *
TALER_EXCHANGE_management_revoke_denomination_key ( TALER_EXCHANGE_management_revoke_denomination_key (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
const struct GNUNET_HashCode *h_denom_pub, const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterSignatureP *master_sig, const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb, TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb,
void *cb_cls) void *cb_cls)

View File

@ -254,3 +254,13 @@ TALER_payto_validate (const char *payto_uri)
return NULL; return NULL;
} }
void
TALER_payto_hash (const char *payto,
struct TALER_PaytoHash *h_payto)
{
GNUNET_CRYPTO_hash (payto,
strlen (payto) + 1,
&h_payto->hash);
}