-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
|
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
|
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
|
terms of the GNU Affero General Public License as published by the Free Software
|
||||||
@ -254,8 +254,8 @@ typedef void
|
|||||||
struct TALER_AUDITOR_DepositConfirmationHandle *
|
struct TALER_AUDITOR_DepositConfirmationHandle *
|
||||||
TALER_AUDITOR_deposit_confirmation (
|
TALER_AUDITOR_deposit_confirmation (
|
||||||
struct TALER_AUDITOR_Handle *auditor,
|
struct TALER_AUDITOR_Handle *auditor,
|
||||||
const struct GNUNET_HashCode *h_wire,
|
const struct TALER_MerchantWireHash *h_wire,
|
||||||
const struct GNUNET_HashCode *h_contract_terms,
|
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||||
struct GNUNET_TIME_Absolute timestamp,
|
struct GNUNET_TIME_Absolute timestamp,
|
||||||
struct GNUNET_TIME_Absolute refund_deadline,
|
struct GNUNET_TIME_Absolute refund_deadline,
|
||||||
const struct TALER_Amount *amount_without_fee,
|
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);
|
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.
|
* 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
|
* @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
verify_signatures (const struct GNUNET_HashCode *h_wire,
|
verify_signatures (const struct TALER_MerchantWireHash *h_wire,
|
||||||
const struct GNUNET_HashCode *h_contract_terms,
|
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||||
struct GNUNET_TIME_Absolute exchange_timestamp,
|
struct GNUNET_TIME_Absolute exchange_timestamp,
|
||||||
struct GNUNET_TIME_Absolute refund_deadline,
|
struct GNUNET_TIME_Absolute refund_deadline,
|
||||||
const struct TALER_Amount *amount_without_fee,
|
const struct TALER_Amount *amount_without_fee,
|
||||||
@ -273,8 +273,8 @@ verify_signatures (const struct GNUNET_HashCode *h_wire,
|
|||||||
struct TALER_AUDITOR_DepositConfirmationHandle *
|
struct TALER_AUDITOR_DepositConfirmationHandle *
|
||||||
TALER_AUDITOR_deposit_confirmation (
|
TALER_AUDITOR_deposit_confirmation (
|
||||||
struct TALER_AUDITOR_Handle *auditor,
|
struct TALER_AUDITOR_Handle *auditor,
|
||||||
const struct GNUNET_HashCode *h_wire,
|
const struct TALER_MerchantWireHash *h_wire,
|
||||||
const struct GNUNET_HashCode *h_contract_terms,
|
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||||
struct GNUNET_TIME_Absolute exchange_timestamp,
|
struct GNUNET_TIME_Absolute exchange_timestamp,
|
||||||
struct GNUNET_TIME_Absolute refund_deadline,
|
struct GNUNET_TIME_Absolute refund_deadline,
|
||||||
const struct TALER_Amount *amount_without_fee,
|
const struct TALER_Amount *amount_without_fee,
|
||||||
|
@ -141,7 +141,7 @@ struct TALER_EXCHANGE_AuditorAddDenominationHandle *
|
|||||||
TALER_EXCHANGE_add_auditor_denomination (
|
TALER_EXCHANGE_add_auditor_denomination (
|
||||||
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_AuditorPublicKeyP *auditor_pub,
|
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||||
const struct TALER_AuditorSignatureP *auditor_sig,
|
const struct TALER_AuditorSignatureP *auditor_sig,
|
||||||
TALER_EXCHANGE_AuditorAddDenominationCallback cb,
|
TALER_EXCHANGE_AuditorAddDenominationCallback cb,
|
||||||
|
@ -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
|
||||||
@ -451,7 +451,7 @@ TALER_EXCHANGE_verify_coin_history (
|
|||||||
const char *currency,
|
const char *currency,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
json_t *history,
|
json_t *history,
|
||||||
struct GNUNET_HashCode *h_denom_pub,
|
struct TALER_DenominationHash *h_denom_pub,
|
||||||
struct TALER_Amount *total)
|
struct TALER_Amount *total)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -194,7 +194,7 @@ verify_deposit_signature_conflict (
|
|||||||
json_t *history;
|
json_t *history;
|
||||||
struct TALER_Amount total;
|
struct TALER_Amount total;
|
||||||
enum TALER_ErrorCode ec;
|
enum TALER_ErrorCode ec;
|
||||||
struct GNUNET_HashCode h_denom_pub;
|
struct TALER_DenominationHash h_denom_pub;
|
||||||
|
|
||||||
memset (&h_denom_pub,
|
memset (&h_denom_pub,
|
||||||
0,
|
0,
|
||||||
@ -537,12 +537,12 @@ TALER_EXCHANGE_deposit_permission_sign (
|
|||||||
|
|
||||||
|
|
||||||
struct TALER_EXCHANGE_DepositHandle *
|
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,
|
const struct TALER_Amount *amount,
|
||||||
struct GNUNET_TIME_Absolute wire_deadline,
|
struct GNUNET_TIME_Absolute wire_deadline,
|
||||||
json_t *wire_details,
|
json_t *wire_details,
|
||||||
const struct
|
const struct TALER_PrivateContractHash *h_contract_terms,
|
||||||
TALER_PrivateContractHash *h_contract_terms,
|
|
||||||
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,
|
||||||
@ -617,7 +617,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
|
TALER_denom_pub_hash (denom_pub,
|
||||||
&denom_pub_hash);
|
&denom_pub_hash);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
verify_signatures (dki,
|
verify_signatures (dki,
|
||||||
@ -691,8 +691,10 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
dh->depconf.merchant = *merchant_pub;
|
dh->depconf.merchant = *merchant_pub;
|
||||||
dh->amount_with_fee = *amount;
|
dh->amount_with_fee = *amount;
|
||||||
dh->dki = *dki;
|
dh->dki = *dki;
|
||||||
dh->dki.key.rsa_public_key = NULL; /* lifetime not warranted, so better
|
memset (&dh->dki.key,
|
||||||
not copy the pointer */
|
0,
|
||||||
|
sizeof (dh->dki.key)); /* lifetime not warranted, so better
|
||||||
|
not copy the contents! */
|
||||||
|
|
||||||
eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);
|
eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);
|
||||||
if ( (NULL == eh) ||
|
if ( (NULL == eh) ||
|
||||||
|
@ -345,8 +345,8 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
|
|||||||
&denom_key->fee_refresh),
|
&denom_key->fee_refresh),
|
||||||
TALER_JSON_spec_amount_any ("fee_refund",
|
TALER_JSON_spec_amount_any ("fee_refund",
|
||||||
&denom_key->fee_refund),
|
&denom_key->fee_refund),
|
||||||
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),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
|
|||||||
return GNUNET_SYSERR;
|
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);
|
&denom_key->h_key);
|
||||||
if (NULL != hash_context)
|
if (NULL != hash_context)
|
||||||
GNUNET_CRYPTO_hash_context_read (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,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Auditor signed denomination %s, which we do not know. Ignoring signature.\n",
|
"Auditor signed denomination %s, which we do not know. Ignoring signature.\n",
|
||||||
GNUNET_h2s (&denom_h));
|
GNUNET_h2s (&denom_h.hash));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (check_sigs)
|
if (check_sigs)
|
||||||
@ -626,36 +626,28 @@ update_auditors (struct TALER_EXCHANGE_Handle *exchange)
|
|||||||
* the same object), 1 otherwise.
|
* the same object), 1 otherwise.
|
||||||
*/
|
*/
|
||||||
static unsigned int
|
static unsigned int
|
||||||
denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1,
|
denoms_cmp (const struct TALER_EXCHANGE_DenomPublicKey *denom1,
|
||||||
struct TALER_EXCHANGE_DenomPublicKey *denom2)
|
const struct TALER_EXCHANGE_DenomPublicKey *denom2)
|
||||||
{
|
{
|
||||||
struct GNUNET_CRYPTO_RsaPublicKey *tmp1;
|
struct TALER_EXCHANGE_DenomPublicKey tmp1;
|
||||||
struct GNUNET_CRYPTO_RsaPublicKey *tmp2;
|
struct TALER_EXCHANGE_DenomPublicKey tmp2;
|
||||||
int r1;
|
|
||||||
int r2;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* First check if pub is the same. */
|
if (0 !=
|
||||||
if (0 != GNUNET_CRYPTO_rsa_public_key_cmp
|
TALER_denom_pub_cmp (&denom1->key,
|
||||||
(denom1->key.rsa_public_key,
|
&denom2->key))
|
||||||
denom2->key.rsa_public_key))
|
|
||||||
return 1;
|
return 1;
|
||||||
|
tmp1 = *denom1;
|
||||||
tmp1 = denom1->key.rsa_public_key;
|
tmp2 = *denom2;
|
||||||
tmp2 = denom2->key.rsa_public_key;
|
tmp1.revoked = false;
|
||||||
r1 = denom1->revoked;
|
tmp2.revoked = false;
|
||||||
r2 = denom2->revoked;
|
memset (&tmp1.key,
|
||||||
|
0,
|
||||||
denom1->key.rsa_public_key = NULL;
|
sizeof (tmp1.key));
|
||||||
denom2->key.rsa_public_key = NULL;
|
memset (&tmp2.key,
|
||||||
/* Then proceed with the rest of the object. */
|
0,
|
||||||
ret = GNUNET_memcmp (denom1,
|
sizeof (tmp2.key));
|
||||||
denom2);
|
return GNUNET_memcmp (&tmp1,
|
||||||
denom1->revoked = r1;
|
&tmp2);
|
||||||
denom2->revoked = r2;
|
|
||||||
denom1->key.rsa_public_key = tmp1;
|
|
||||||
denom2->key.rsa_public_key = tmp2;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -844,7 +836,7 @@ decode_keys_json (const json_t *resp_obj,
|
|||||||
{
|
{
|
||||||
/* 0:0:0 did not support /keys cherry picking */
|
/* 0:0:0 did not support /keys cherry picking */
|
||||||
TALER_LOG_DEBUG ("Skipping denomination key: already know it\n");
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if (key_data->denom_keys_size == key_data->num_denom_keys)
|
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));
|
EXITIF (JSON_ARRAY != json_typeof (recoup_array));
|
||||||
|
|
||||||
json_array_foreach (recoup_array, index, recoup_info) {
|
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[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
|
||||||
&h_denom_pub),
|
&h_denom_pub),
|
||||||
@ -1019,8 +1011,7 @@ free_key_data (struct TALER_EXCHANGE_Keys *key_data)
|
|||||||
key_data->num_sign_keys,
|
key_data->num_sign_keys,
|
||||||
0);
|
0);
|
||||||
for (unsigned int i = 0; i<key_data->num_denom_keys; i++)
|
for (unsigned int i = 0; i<key_data->num_denom_keys; i++)
|
||||||
GNUNET_CRYPTO_rsa_public_key_free (
|
TALER_denom_pub_free (&key_data->denom_keys[i].key);
|
||||||
key_data->denom_keys[i].key.rsa_public_key);
|
|
||||||
|
|
||||||
GNUNET_array_grow (key_data->denom_keys,
|
GNUNET_array_grow (key_data->denom_keys,
|
||||||
key_data->denom_keys_size,
|
key_data->denom_keys_size,
|
||||||
@ -1167,9 +1158,8 @@ keys_completed_cb (void *cls,
|
|||||||
TALER_EXCHANGE_DenomPublicKey));
|
TALER_EXCHANGE_DenomPublicKey));
|
||||||
|
|
||||||
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
|
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
|
||||||
kd.denom_keys[i].key.rsa_public_key
|
TALER_denom_pub_deep_copy (&kd.denom_keys[i].key,
|
||||||
= GNUNET_CRYPTO_rsa_public_key_dup (
|
&kd_old.denom_keys[i].key);
|
||||||
kd_old.denom_keys[i].key.rsa_public_key);
|
|
||||||
|
|
||||||
kd.num_auditors = kd_old.num_auditors;
|
kd.num_auditors = kd_old.num_auditors;
|
||||||
kd.auditors = GNUNET_new_array (kd.num_auditors,
|
kd.auditors = GNUNET_new_array (kd.num_auditors,
|
||||||
@ -1216,7 +1206,7 @@ keys_completed_cb (void *cls,
|
|||||||
kd.auditors = NULL;
|
kd.auditors = NULL;
|
||||||
kd.num_auditors = 0;
|
kd.num_auditors = 0;
|
||||||
for (unsigned int i = 0; i<kd_old.num_denom_keys; i++)
|
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,
|
GNUNET_array_grow (kd.denom_keys,
|
||||||
kd.denom_keys_size,
|
kd.denom_keys_size,
|
||||||
0);
|
0);
|
||||||
@ -2060,9 +2050,9 @@ TALER_EXCHANGE_get_denomination_key (
|
|||||||
const struct TALER_DenominationPublicKey *pk)
|
const struct TALER_DenominationPublicKey *pk)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i<keys->num_denom_keys; i++)
|
for (unsigned int i = 0; i<keys->num_denom_keys; i++)
|
||||||
if (0 == GNUNET_CRYPTO_rsa_public_key_cmp (pk->rsa_public_key,
|
if (0 ==
|
||||||
keys->denom_keys[i].key.
|
TALER_denom_pub_cmp (pk,
|
||||||
rsa_public_key))
|
&keys->denom_keys[i].key))
|
||||||
return &keys->denom_keys[i];
|
return &keys->denom_keys[i];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2082,9 +2072,8 @@ TALER_EXCHANGE_copy_denomination_key (
|
|||||||
|
|
||||||
copy = GNUNET_new (struct TALER_EXCHANGE_DenomPublicKey);
|
copy = GNUNET_new (struct TALER_EXCHANGE_DenomPublicKey);
|
||||||
*copy = *key;
|
*copy = *key;
|
||||||
copy->key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (
|
TALER_denom_pub_deep_copy (©->key,
|
||||||
key->key.rsa_public_key);
|
&key->key);
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2099,7 +2088,7 @@ void
|
|||||||
TALER_EXCHANGE_destroy_denomination_key (
|
TALER_EXCHANGE_destroy_denomination_key (
|
||||||
struct TALER_EXCHANGE_DenomPublicKey *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);
|
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 */
|
/* end of denom.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user