aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-06-06 20:52:32 +0200
committerChristian Grothoff <christian@grothoff.org>2019-06-06 20:52:32 +0200
commita4813d1864a6cc00f829b35849c3cc5f78d75764 (patch)
tree41ef3a5b15b728cf5f5ffaddf7329a5c37854d75
parent69a07468de8555d5260afab4019e34f40e5ec6be (diff)
fixing #5754 (make copy, as original may disappear)
-rw-r--r--src/lib/exchange_api_deposit.c6
-rw-r--r--src/lib/exchange_api_handle.c37
-rw-r--r--src/lib/exchange_api_payback.c9
-rw-r--r--src/lib/exchange_api_reserve.c16
4 files changed, 38 insertions, 30 deletions
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 06cb0d143..865e9b0c4 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -514,9 +514,9 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
denom_pub);
GNUNET_assert (NULL != dki);
GNUNET_assert (GNUNET_SYSERR !=
- TALER_amount_subtract (&amount_without_fee,
- amount,
- &dki->fee_deposit));
+ TALER_amount_subtract (&amount_without_fee,
+ amount,
+ &dki->fee_deposit));
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&denom_pub_hash);
if (GNUNET_OK !=
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 9f02d7039..1f3553a7f 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -304,8 +304,8 @@ TEAH_acc_confirmation_cb (void *cls,
*/
void
TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h,
- TEAH_AuditorCallback ac,
- void *ac_cls)
+ TEAH_AuditorCallback ac,
+ void *ac_cls)
{
if (NULL == h->auditors_head)
{
@@ -368,7 +368,7 @@ free_keys_request (struct KeysRequest *kr)
*/
static int
parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
- int check_sigs,
+ int check_sigs,
json_t *sign_key_obj,
const struct TALER_MasterPublicKeyP *master_key)
{
@@ -529,7 +529,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
*/
static int
parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
- int check_sigs,
+ int check_sigs,
json_t *auditor_obj,
const struct TALER_EXCHANGE_Keys *key_data)
{
@@ -632,9 +632,9 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
&auditor_sig.eddsa_sig,
&auditor->auditor_pub.eddsa_pub))
{
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return GNUNET_SYSERR;
+ GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (spec);
+ return GNUNET_SYSERR;
}
}
auditor->denom_keys[off].denom_key_offset = dk_off;
@@ -792,9 +792,9 @@ TALER_denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1,
*/
static int
decode_keys_json (const json_t *resp_obj,
- int check_sig,
+ int check_sig,
struct TALER_EXCHANGE_Keys *key_data,
- enum TALER_EXCHANGE_VersionCompatibility *vc)
+ enum TALER_EXCHANGE_VersionCompatibility *vc)
{
struct TALER_ExchangeSignatureP sig;
struct GNUNET_HashContext *hash_context;
@@ -842,10 +842,10 @@ decode_keys_json (const json_t *resp_obj,
return GNUNET_SYSERR;
}
if (3 != sscanf (ver,
- "%u:%u:%u",
- &current,
- &revision,
- &age))
+ "%u:%u:%u",
+ &current,
+ &revision,
+ &age))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -977,11 +977,11 @@ decode_keys_json (const json_t *resp_obj,
int found = GNUNET_NO;
memset (&ai,
- 0,
- sizeof (ai));
+ 0,
+ sizeof (ai));
EXITIF (GNUNET_SYSERR ==
parse_json_auditor (&ai,
- check_sig,
+ check_sig,
auditor_info,
key_data));
for (unsigned int j=0;j<key_data->num_auditors;j++)
@@ -1165,6 +1165,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
return GNUNET_TIME_UNIT_ZERO_ABS;
}
+
/**
* Callback used when downloading the reply to a /keys request
* is complete.
@@ -1505,7 +1506,7 @@ header_cb (char *buffer,
*/
static void
deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
- const json_t *data)
+ const json_t *data)
{
enum TALER_EXCHANGE_VersionCompatibility vc;
json_t *keys;
@@ -2016,7 +2017,7 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange)
*/
const struct TALER_EXCHANGE_SigningPublicKey *
TALER_EXCHANGE_get_signing_key_details (const struct TALER_EXCHANGE_Keys *keys,
- const struct TALER_ExchangePublicKeyP *pub)
+ const struct TALER_ExchangePublicKeyP *pub)
{
for (unsigned int i=0;i<keys->num_sign_keys;i++)
{
diff --git a/src/lib/exchange_api_payback.c b/src/lib/exchange_api_payback.c
index 99b390b11..a23ad7be5 100644
--- a/src/lib/exchange_api_payback.c
+++ b/src/lib/exchange_api_payback.c
@@ -57,7 +57,7 @@ struct TALER_EXCHANGE_PaybackHandle
/**
* Denomination key of the coin.
*/
- const struct TALER_EXCHANGE_DenomPublicKey *pk;
+ struct TALER_EXCHANGE_DenomPublicKey pk;
/**
* Handle for the request.
@@ -195,7 +195,7 @@ handle_payback_finished (void *cls,
struct TALER_Amount total;
const struct TALER_EXCHANGE_DenomPublicKey *dki;
- dki = ph->pk;
+ dki = &ph->pk;
history = json_object_get (j,
"history");
if (GNUNET_OK !=
@@ -318,7 +318,8 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle);
ph->coin_pub = pr.coin_pub;
ph->exchange = exchange;
- ph->pk = pk;
+ ph->pk = *pk;
+ ph->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key);
ph->cb = payback_cb;
ph->cb_cls = payback_cb_cls;
ph->url = TEAH_path_to_url (exchange, "/payback");
@@ -332,6 +333,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
curl_easy_cleanup (eh);
json_decref (payback_obj);
GNUNET_free (ph->url);
+ GNUNET_CRYPTO_rsa_public_key_free (ph->pk.key.rsa_public_key);
GNUNET_free (ph);
return NULL;
}
@@ -365,6 +367,7 @@ TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph)
}
GNUNET_free (ph->url);
TALER_curl_easy_post_finished (&ph->ctx);
+ GNUNET_CRYPTO_rsa_public_key_free (ph->pk.key.rsa_public_key);
GNUNET_free (ph);
}
diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c
index 9a4679d20..3a77f606a 100644
--- a/src/lib/exchange_api_reserve.c
+++ b/src/lib/exchange_api_reserve.c
@@ -700,7 +700,7 @@ struct TALER_EXCHANGE_ReserveWithdrawHandle
/**
* Denomination key we are withdrawing.
*/
- const struct TALER_EXCHANGE_DenomPublicKey *pk;
+ struct TALER_EXCHANGE_DenomPublicKey pk;
/**
* Closure for @a cb.
@@ -755,7 +755,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
- TALER_planchet_to_coin (&wsh->pk->key,
+ TALER_planchet_to_coin (&wsh->pk.key,
blind_sig,
&wsh->ps,
&wsh->c_hash,
@@ -770,7 +770,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
/* signature is valid, return it to the application */
wsh->cb (wsh->cb_cls,
MHD_HTTP_OK,
- TALER_EC_NONE,
+ TALER_EC_NONE,
&fc.sig,
json);
/* make sure callback isn't called again after return */
@@ -868,8 +868,8 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *
/* Compute how much we expected to charge to the reserve */
if (GNUNET_OK !=
TALER_amount_add (&requested_amount,
- &wsh->pk->value,
- &wsh->pk->fee_withdraw))
+ &wsh->pk.value,
+ &wsh->pk.fee_withdraw))
{
/* Overflow here? Very strange, our CPU must be fried... */
GNUNET_break (0);
@@ -1008,7 +1008,8 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
wsh->exchange = exchange;
wsh->cb = res_cb;
wsh->cb_cls = res_cb_cls;
- wsh->pk = pk;
+ wsh->pk = *pk;
+ wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key);
wsh->reserve_pub = *reserve_pub;
wsh->c_hash = pd->c_hash;
GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key,
@@ -1023,6 +1024,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
if (NULL == withdraw_obj)
{
GNUNET_break (0);
+ GNUNET_CRYPTO_rsa_public_key_free (wsh->pk.key.rsa_public_key);
GNUNET_free (wsh);
return NULL;
}
@@ -1039,6 +1041,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
curl_easy_cleanup (eh);
json_decref (withdraw_obj);
GNUNET_free (wsh->url);
+ GNUNET_CRYPTO_rsa_public_key_free (wsh->pk.key.rsa_public_key);
GNUNET_free (wsh);
return NULL;
}
@@ -1202,6 +1205,7 @@ TALER_EXCHANGE_reserve_withdraw_cancel (struct TALER_EXCHANGE_ReserveWithdrawHan
}
GNUNET_free (sign->url);
TALER_curl_easy_post_finished (&sign->ctx);
+ GNUNET_CRYPTO_rsa_public_key_free (sign->pk.key.rsa_public_key);
GNUNET_free (sign);
}