summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2021-10-25 13:54:38 +0200
committerChristian Grothoff <christian@grothoff.org>2021-10-27 09:23:13 +0200
commit58ea04167ca46e7ef82d25900cae731741854279 (patch)
treec322cab80cddb21cad4e809b5d8fda41b4b48819 /src/lib
parent201d6ea5c9eac6f8e02cfcff996eb5e871d3b53f (diff)
downloadexchange-58ea04167ca46e7ef82d25900cae731741854279.tar.gz
exchange-58ea04167ca46e7ef82d25900cae731741854279.tar.bz2
exchange-58ea04167ca46e7ef82d25900cae731741854279.zip
-fix misc FTBFS
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/auditor_api_deposit_confirmation.c8
-rw-r--r--src/lib/exchange_api_auditor_add_denomination.c2
-rw-r--r--src/lib/exchange_api_common.c4
-rw-r--r--src/lib/exchange_api_deposit.c44
-rw-r--r--src/lib/exchange_api_handle.c85
5 files changed, 67 insertions, 76 deletions
diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c
index 9c13c3f0f..89f67f92e 100644
--- a/src/lib/auditor_api_deposit_confirmation.c
+++ b/src/lib/auditor_api_deposit_confirmation.c
@@ -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,
diff --git a/src/lib/exchange_api_auditor_add_denomination.c b/src/lib/exchange_api_auditor_add_denomination.c
index 8952cd2fc..fbe46e51f 100644
--- a/src/lib/exchange_api_auditor_add_denomination.c
+++ b/src/lib/exchange_api_auditor_add_denomination.c
@@ -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,
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 9c4a95ad0..143ceddae 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.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
@@ -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;
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index d153a2733..461a282cf 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -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,22 +537,22 @@ TALER_EXCHANGE_deposit_permission_sign (
struct TALER_EXCHANGE_DepositHandle *
-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_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_DenominationSignature *denom_sig,
- const struct TALER_DenominationPublicKey *denom_pub,
- struct GNUNET_TIME_Absolute timestamp,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
- const struct TALER_CoinSpendSignatureP *coin_sig,
- TALER_EXCHANGE_DepositResultCallback cb,
- void *cb_cls,
- enum TALER_ErrorCode *ec)
+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_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_DenominationSignature *denom_sig,
+ const struct TALER_DenominationPublicKey *denom_pub,
+ struct GNUNET_TIME_Absolute timestamp,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ struct GNUNET_TIME_Absolute refund_deadline,
+ const struct TALER_CoinSpendSignatureP *coin_sig,
+ TALER_EXCHANGE_DepositResultCallback cb,
+ void *cb_cls,
+ enum TALER_ErrorCode *ec)
{
const struct TALER_EXCHANGE_Keys *key_state;
const struct TALER_EXCHANGE_DenomPublicKey *dki;
@@ -617,8 +617,8 @@ 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,
- &denom_pub_hash);
+ TALER_denom_pub_hash (denom_pub,
+ &denom_pub_hash);
if (GNUNET_OK !=
verify_signatures (dki,
amount,
@@ -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) ||
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 0b19c795d..2fd0937f4 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -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,8 +359,8 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_rsa_public_key_hash (denom_key->key.rsa_public_key,
- &denom_key->h_key);
+ TALER_denom_pub_hash (&denom_key->key,
+ &denom_key->h_key);
if (NULL != hash_context)
GNUNET_CRYPTO_hash_context_read (hash_context,
&denom_key->h_key,
@@ -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;
-
- /* 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))
- return 1;
+ struct TALER_EXCHANGE_DenomPublicKey tmp1;
+ struct TALER_EXCHANGE_DenomPublicKey tmp2;
- 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;
+ if (0 !=
+ TALER_denom_pub_cmp (&denom1->key,
+ &denom2->key))
+ return 1;
+ 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 (&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);
}