-fix misc FTBFS
This commit is contained in:
parent
201d6ea5c9
commit
58ea04167c
@ -1 +1 @@
|
||||
Subproject commit 8c7d9be40ba627348da3e01b91b4f1d3cc78631f
|
||||
Subproject commit 0272caa8ff8ee7553d035d29fb19d01866df43e4
|
@ -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 Affero General Public License as published by the Free Software
|
||||
@ -254,8 +254,8 @@ typedef void
|
||||
struct TALER_AUDITOR_DepositConfirmationHandle *
|
||||
TALER_AUDITOR_deposit_confirmation (
|
||||
struct TALER_AUDITOR_Handle *auditor,
|
||||
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,
|
||||
struct GNUNET_TIME_Absolute timestamp,
|
||||
struct GNUNET_TIME_Absolute refund_deadline,
|
||||
const struct TALER_Amount *amount_without_fee,
|
||||
|
@ -661,6 +661,30 @@ TALER_denom_pub_hash (const struct TALER_DenominationPublicKey *denom_pub,
|
||||
struct TALER_DenominationHash *denom_hash);
|
||||
|
||||
|
||||
/**
|
||||
* Make a (deep) copy of the given @a denom_src to
|
||||
* @a denom_dst.
|
||||
*
|
||||
* @param[out] denom_dst target to copy to
|
||||
* @param denom_str public key to copy
|
||||
*/
|
||||
void
|
||||
TALER_denom_pub_deep_copy (struct TALER_DenominationPublicKey *denom_dst,
|
||||
const struct TALER_DenominationPublicKey *denom_src);
|
||||
|
||||
|
||||
/**
|
||||
* Compare two denomination public keys.
|
||||
*
|
||||
* @param denom1 first key
|
||||
* @param denom2 second key
|
||||
* @return 0 if the keys are equal, otherwise -1 or 1
|
||||
*/
|
||||
int
|
||||
TALER_denom_pub_cmp (const struct TALER_DenominationPublicKey *denom1,
|
||||
const struct TALER_DenominationPublicKey *denom2);
|
||||
|
||||
|
||||
/**
|
||||
* Obtain denomination public key from a denomination private key.
|
||||
*
|
||||
|
@ -169,8 +169,8 @@ handle_deposit_confirmation_finished (void *cls,
|
||||
* @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_signatures (const struct GNUNET_HashCode *h_wire,
|
||||
const struct GNUNET_HashCode *h_contract_terms,
|
||||
verify_signatures (const struct TALER_MerchantWireHash *h_wire,
|
||||
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||
struct GNUNET_TIME_Absolute exchange_timestamp,
|
||||
struct GNUNET_TIME_Absolute refund_deadline,
|
||||
const struct TALER_Amount *amount_without_fee,
|
||||
@ -273,8 +273,8 @@ verify_signatures (const struct GNUNET_HashCode *h_wire,
|
||||
struct TALER_AUDITOR_DepositConfirmationHandle *
|
||||
TALER_AUDITOR_deposit_confirmation (
|
||||
struct TALER_AUDITOR_Handle *auditor,
|
||||
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,
|
||||
struct GNUNET_TIME_Absolute exchange_timestamp,
|
||||
struct GNUNET_TIME_Absolute refund_deadline,
|
||||
const struct TALER_Amount *amount_without_fee,
|
||||
|
@ -141,7 +141,7 @@ struct TALER_EXCHANGE_AuditorAddDenominationHandle *
|
||||
TALER_EXCHANGE_add_auditor_denomination (
|
||||
struct GNUNET_CURL_Context *ctx,
|
||||
const char *url,
|
||||
const struct GNUNET_HashCode *h_denom_pub,
|
||||
const struct TALER_DenominationHash *h_denom_pub,
|
||||
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||
const struct TALER_AuditorSignatureP *auditor_sig,
|
||||
TALER_EXCHANGE_AuditorAddDenominationCallback cb,
|
||||
|
@ -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
|
||||
@ -451,7 +451,7 @@ TALER_EXCHANGE_verify_coin_history (
|
||||
const char *currency,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
json_t *history,
|
||||
struct GNUNET_HashCode *h_denom_pub,
|
||||
struct TALER_DenominationHash *h_denom_pub,
|
||||
struct TALER_Amount *total)
|
||||
{
|
||||
size_t len;
|
||||
|
@ -194,7 +194,7 @@ verify_deposit_signature_conflict (
|
||||
json_t *history;
|
||||
struct TALER_Amount total;
|
||||
enum TALER_ErrorCode ec;
|
||||
struct GNUNET_HashCode h_denom_pub;
|
||||
struct TALER_DenominationHash h_denom_pub;
|
||||
|
||||
memset (&h_denom_pub,
|
||||
0,
|
||||
@ -537,12 +537,12 @@ TALER_EXCHANGE_deposit_permission_sign (
|
||||
|
||||
|
||||
struct TALER_EXCHANGE_DepositHandle *
|
||||
TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
||||
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
|
||||
TALER_PrivateContractHash *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,
|
||||
@ -617,7 +617,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
||||
GNUNET_break_op (0);
|
||||
return NULL;
|
||||
}
|
||||
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
|
||||
TALER_denom_pub_hash (denom_pub,
|
||||
&denom_pub_hash);
|
||||
if (GNUNET_OK !=
|
||||
verify_signatures (dki,
|
||||
@ -691,8 +691,10 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
||||
dh->depconf.merchant = *merchant_pub;
|
||||
dh->amount_with_fee = *amount;
|
||||
dh->dki = *dki;
|
||||
dh->dki.key.rsa_public_key = NULL; /* lifetime not warranted, so better
|
||||
not copy the pointer */
|
||||
memset (&dh->dki.key,
|
||||
0,
|
||||
sizeof (dh->dki.key)); /* lifetime not warranted, so better
|
||||
not copy the contents! */
|
||||
|
||||
eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);
|
||||
if ( (NULL == eh) ||
|
||||
|
@ -345,8 +345,8 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
|
||||
&denom_key->fee_refresh),
|
||||
TALER_JSON_spec_amount_any ("fee_refund",
|
||||
&denom_key->fee_refund),
|
||||
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),
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
|
||||
@ -359,7 +359,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
GNUNET_CRYPTO_rsa_public_key_hash (denom_key->key.rsa_public_key,
|
||||
TALER_denom_pub_hash (&denom_key->key,
|
||||
&denom_key->h_key);
|
||||
if (NULL != hash_context)
|
||||
GNUNET_CRYPTO_hash_context_read (hash_context,
|
||||
@ -480,7 +480,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Auditor signed denomination %s, which we do not know. Ignoring signature.\n",
|
||||
GNUNET_h2s (&denom_h));
|
||||
GNUNET_h2s (&denom_h.hash));
|
||||
continue;
|
||||
}
|
||||
if (check_sigs)
|
||||
@ -626,36 +626,28 @@ update_auditors (struct TALER_EXCHANGE_Handle *exchange)
|
||||
* the same object), 1 otherwise.
|
||||
*/
|
||||
static unsigned int
|
||||
denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1,
|
||||
struct TALER_EXCHANGE_DenomPublicKey *denom2)
|
||||
denoms_cmp (const struct TALER_EXCHANGE_DenomPublicKey *denom1,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *denom2)
|
||||
{
|
||||
struct GNUNET_CRYPTO_RsaPublicKey *tmp1;
|
||||
struct GNUNET_CRYPTO_RsaPublicKey *tmp2;
|
||||
int r1;
|
||||
int r2;
|
||||
int ret;
|
||||
struct TALER_EXCHANGE_DenomPublicKey tmp1;
|
||||
struct TALER_EXCHANGE_DenomPublicKey tmp2;
|
||||
|
||||
/* First check if pub is the same. */
|
||||
if (0 != GNUNET_CRYPTO_rsa_public_key_cmp
|
||||
(denom1->key.rsa_public_key,
|
||||
denom2->key.rsa_public_key))
|
||||
if (0 !=
|
||||
TALER_denom_pub_cmp (&denom1->key,
|
||||
&denom2->key))
|
||||
return 1;
|
||||
|
||||
tmp1 = denom1->key.rsa_public_key;
|
||||
tmp2 = denom2->key.rsa_public_key;
|
||||
r1 = denom1->revoked;
|
||||
r2 = denom2->revoked;
|
||||
|
||||
denom1->key.rsa_public_key = NULL;
|
||||
denom2->key.rsa_public_key = NULL;
|
||||
/* Then proceed with the rest of the object. */
|
||||
ret = GNUNET_memcmp (denom1,
|
||||
denom2);
|
||||
denom1->revoked = r1;
|
||||
denom2->revoked = r2;
|
||||
denom1->key.rsa_public_key = tmp1;
|
||||
denom2->key.rsa_public_key = tmp2;
|
||||
return ret;
|
||||
tmp1 = *denom1;
|
||||
tmp2 = *denom2;
|
||||
tmp1.revoked = false;
|
||||
tmp2.revoked = false;
|
||||
memset (&tmp1.key,
|
||||
0,
|
||||
sizeof (tmp1.key));
|
||||
memset (&tmp2.key,
|
||||
0,
|
||||
sizeof (tmp2.key));
|
||||
return GNUNET_memcmp (&tmp1,
|
||||
&tmp2);
|
||||
}
|
||||
|
||||
|
||||
@ -844,7 +836,7 @@ decode_keys_json (const json_t *resp_obj,
|
||||
{
|
||||
/* 0:0:0 did not support /keys cherry picking */
|
||||
TALER_LOG_DEBUG ("Skipping denomination key: already know it\n");
|
||||
GNUNET_CRYPTO_rsa_public_key_free (dk.key.rsa_public_key);
|
||||
TALER_denom_pub_free (&dk.key);
|
||||
continue;
|
||||
}
|
||||
if (key_data->denom_keys_size == key_data->num_denom_keys)
|
||||
@ -951,7 +943,7 @@ decode_keys_json (const json_t *resp_obj,
|
||||
EXITIF (JSON_ARRAY != json_typeof (recoup_array));
|
||||
|
||||
json_array_foreach (recoup_array, index, recoup_info) {
|
||||
struct GNUNET_HashCode h_denom_pub;
|
||||
struct TALER_DenominationHash h_denom_pub;
|
||||
struct GNUNET_JSON_Specification spec[] = {
|
||||
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
||||
&h_denom_pub),
|
||||
@ -1019,8 +1011,7 @@ free_key_data (struct TALER_EXCHANGE_Keys *key_data)
|
||||
key_data->num_sign_keys,
|
||||
0);
|
||||
for (unsigned int i = 0; i<key_data->num_denom_keys; i++)
|
||||
GNUNET_CRYPTO_rsa_public_key_free (
|
||||
key_data->denom_keys[i].key.rsa_public_key);
|
||||
TALER_denom_pub_free (&key_data->denom_keys[i].key);
|
||||
|
||||
GNUNET_array_grow (key_data->denom_keys,
|
||||
key_data->denom_keys_size,
|
||||
@ -1167,9 +1158,8 @@ keys_completed_cb (void *cls,
|
||||
TALER_EXCHANGE_DenomPublicKey));
|
||||
|
||||
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
|
||||
kd.denom_keys[i].key.rsa_public_key
|
||||
= GNUNET_CRYPTO_rsa_public_key_dup (
|
||||
kd_old.denom_keys[i].key.rsa_public_key);
|
||||
TALER_denom_pub_deep_copy (&kd.denom_keys[i].key,
|
||||
&kd_old.denom_keys[i].key);
|
||||
|
||||
kd.num_auditors = kd_old.num_auditors;
|
||||
kd.auditors = GNUNET_new_array (kd.num_auditors,
|
||||
@ -1216,7 +1206,7 @@ keys_completed_cb (void *cls,
|
||||
kd.auditors = NULL;
|
||||
kd.num_auditors = 0;
|
||||
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
|
||||
GNUNET_CRYPTO_rsa_public_key_free (kd.denom_keys[i].key.rsa_public_key);
|
||||
TALER_denom_pub_free (&kd.denom_keys[i].key);
|
||||
GNUNET_array_grow (kd.denom_keys,
|
||||
kd.denom_keys_size,
|
||||
0);
|
||||
@ -2060,9 +2050,9 @@ TALER_EXCHANGE_get_denomination_key (
|
||||
const struct TALER_DenominationPublicKey *pk)
|
||||
{
|
||||
for (unsigned int i = 0; i<keys->num_denom_keys; i++)
|
||||
if (0 == GNUNET_CRYPTO_rsa_public_key_cmp (pk->rsa_public_key,
|
||||
keys->denom_keys[i].key.
|
||||
rsa_public_key))
|
||||
if (0 ==
|
||||
TALER_denom_pub_cmp (pk,
|
||||
&keys->denom_keys[i].key))
|
||||
return &keys->denom_keys[i];
|
||||
return NULL;
|
||||
}
|
||||
@ -2082,9 +2072,8 @@ TALER_EXCHANGE_copy_denomination_key (
|
||||
|
||||
copy = GNUNET_new (struct TALER_EXCHANGE_DenomPublicKey);
|
||||
*copy = *key;
|
||||
copy->key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (
|
||||
key->key.rsa_public_key);
|
||||
|
||||
TALER_denom_pub_deep_copy (©->key,
|
||||
&key->key);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@ -2099,7 +2088,7 @@ void
|
||||
TALER_EXCHANGE_destroy_denomination_key (
|
||||
struct TALER_EXCHANGE_DenomPublicKey *key)
|
||||
{
|
||||
GNUNET_CRYPTO_rsa_public_key_free (key->key.rsa_public_key);;
|
||||
TALER_denom_pub_free (&key->key);
|
||||
GNUNET_free (key);
|
||||
}
|
||||
|
||||
|
@ -169,4 +169,58 @@ TALER_denom_sig_free (struct TALER_DenominationSignature *denom_sig)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make a (deep) copy of the given @a denom_src to
|
||||
* @a denom_dst.
|
||||
*
|
||||
* @param[out] denom_dst target to copy to
|
||||
* @param denom_str public key to copy
|
||||
*/
|
||||
void
|
||||
TALER_denom_pub_deep_copy (struct TALER_DenominationPublicKey *denom_dst,
|
||||
const struct TALER_DenominationPublicKey *denom_src)
|
||||
{
|
||||
*denom_dst = *denom_src; /* shallow copy */
|
||||
switch (denom_src->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
denom_dst->details.rsa_public_key
|
||||
= GNUNET_CRYPTO_rsa_public_key_dup (
|
||||
denom_src->details.rsa_public_key);
|
||||
return;
|
||||
// TODO: add case for Clause-Schnorr
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare two denomination public keys.
|
||||
*
|
||||
* @param denom1 first key
|
||||
* @param denom2 second key
|
||||
* @return 0 if the keys are equal, otherwise -1 or 1
|
||||
*/
|
||||
int
|
||||
TALER_denom_pub_cmp (const struct TALER_DenominationPublicKey *denom1,
|
||||
const struct TALER_DenominationPublicKey *denom2)
|
||||
{
|
||||
if (denom1->cipher != denom2->cipher)
|
||||
return (denom1->cipher > denom2->cipher) ? 1 : -1;
|
||||
if (denom1->age_mask != denom2->age_mask)
|
||||
return (denom1->age_mask > denom2->age_mask) ? 1 : -1;
|
||||
switch (denom1->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
return GNUNET_CRYPTO_rsa_public_key_cmp (denom1->details.rsa_public_key,
|
||||
denom2->details.rsa_public_key);
|
||||
// TODO: add case for Clause-Schnorr
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
/* end of denom.c */
|
||||
|
Loading…
Reference in New Issue
Block a user