summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNic Eigel <nic@eigel.ch>2024-01-16 22:37:31 +0100
committerNic Eigel <nic@eigel.ch>2024-01-16 22:37:31 +0100
commitb5de0afa73c0b8f7bcf988e2bc00f07f4f6cf42e (patch)
treed0f7e4f65205a31db3de0b12b42e98991aefa079 /src
parent45b110edb2b4fd39c56f433c5c0a7f93cd29d4da (diff)
parentec522a445a2a00e9000c937e61940c7ac9c4b79d (diff)
downloadexchange-b5de0afa73c0b8f7bcf988e2bc00f07f4f6cf42e.tar.gz
exchange-b5de0afa73c0b8f7bcf988e2bc00f07f4f6cf42e.tar.bz2
exchange-b5de0afa73c0b8f7bcf988e2bc00f07f4f6cf42e.zip
Merge branch 'master' of git+ssh://git.taler.net/exchange
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c14
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c48
-rw-r--r--src/exchangedb/test_exchangedb.c20
-rw-r--r--src/include/taler_crypto_lib.h30
-rw-r--r--src/include/taler_exchange_service.h11
-rw-r--r--src/include/taler_pq_lib.h4
-rw-r--r--src/include/taler_util.h5
-rw-r--r--src/lib/exchange_api_age_withdraw.c40
-rw-r--r--src/lib/exchange_api_batch_deposit.c11
-rw-r--r--src/lib/exchange_api_batch_withdraw.c12
-rw-r--r--src/lib/exchange_api_batch_withdraw2.c11
-rw-r--r--src/lib/exchange_api_handle.c8
-rw-r--r--src/lib/exchange_api_link.c4
-rw-r--r--src/lib/exchange_api_melt.c8
-rw-r--r--src/lib/exchange_api_refresh_common.c12
-rw-r--r--src/lib/exchange_api_refreshes_reveal.c4
-rw-r--r--src/testing/testing_api_cmd_batch_withdraw.c8
-rw-r--r--src/testing/testing_api_cmd_refresh.c12
-rw-r--r--src/testing/testing_api_cmd_withdraw.c8
-rw-r--r--src/util/Makefile.am2
-rw-r--r--src/util/crypto_helper_cs.c2
-rw-r--r--src/util/crypto_helper_esign.c4
-rw-r--r--src/util/crypto_helper_rsa.c6
-rw-r--r--src/util/denom.c14
-rw-r--r--src/util/taler-exchange-secmod-cs.c48
-rw-r--r--src/util/taler-exchange-secmod-eddsa.c43
-rw-r--r--src/util/taler-exchange-secmod-rsa.c50
-rw-r--r--src/util/taler-exchange-secmod-rsa.conf5
-rw-r--r--src/util/test_helper_cs.c4
-rw-r--r--src/util/test_helper_eddsa.c4
-rw-r--r--src/util/test_helper_rsa.c4
31 files changed, 271 insertions, 185 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index 4d6decf35..92892cb6d 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -1630,7 +1630,7 @@ setup_key_helpers (struct HelperState *hs)
= GNUNET_CONTAINER_multipeermap_create (32,
GNUNET_NO /* MUST BE NO! */);
hs->rsadh = TALER_CRYPTO_helper_rsa_connect (TEH_cfg,
- "taler",
+ "taler-exchange",
&helper_rsa_cb,
hs);
if (NULL == hs->rsadh)
@@ -1639,7 +1639,7 @@ setup_key_helpers (struct HelperState *hs)
return GNUNET_SYSERR;
}
hs->csdh = TALER_CRYPTO_helper_cs_connect (TEH_cfg,
- "taler",
+ "taler-exchange",
&helper_cs_cb,
hs);
if (NULL == hs->csdh)
@@ -1648,7 +1648,7 @@ setup_key_helpers (struct HelperState *hs)
return GNUNET_SYSERR;
}
hs->esh = TALER_CRYPTO_helper_esign_connect (TEH_cfg,
- "taler",
+ "taler-exchange",
&helper_esign_cb,
hs);
if (NULL == hs->esh)
@@ -1919,8 +1919,8 @@ denomination_info_cb (
return;
}
dk = GNUNET_new (struct TEH_DenominationKey);
- TALER_denom_pub_deep_copy (&dk->denom_pub,
- denom_pub);
+ TALER_denom_pub_copy (&dk->denom_pub,
+ denom_pub);
dk->h_denom_pub = *h_denom_pub;
dk->meta = *meta;
dk->master_sig = *master_sig;
@@ -4078,8 +4078,8 @@ TEH_keys_load_fees (struct TEH_KeyStateHandle *ksh,
{
GNUNET_assert (GNUNET_CRYPTO_BSA_INVALID !=
hd->denom_pub.bsign_pub_key->cipher);
- TALER_denom_pub_deep_copy (denom_pub,
- &hd->denom_pub);
+ TALER_denom_pub_copy (denom_pub,
+ &hd->denom_pub);
}
else
{
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 4e7bccbd2..b21e5d62f 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -234,14 +234,14 @@
* @param conn SQL connection that was used
*/
#define BREAK_DB_ERR(result,conn) do { \
- GNUNET_break (0); \
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
- "Database failure: %s/%s/%s/%s/%s", \
- PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
- PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
- PQresultErrorMessage (result), \
- PQresStatus (PQresultStatus (result)), \
- PQerrorMessage (conn)); \
+ GNUNET_break (0); \
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
+ "Database failure: %s/%s/%s/%s/%s", \
+ PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
+ PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
+ PQresultErrorMessage (result), \
+ PQresStatus (PQresultStatus (result)), \
+ PQerrorMessage (conn)); \
} while (0)
@@ -345,21 +345,29 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
GNUNET_free (pg);
return NULL;
}
- if ( (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (cfg,
- "exchangedb",
- "IDLE_RESERVE_EXPIRATION_TIME",
- &pg->idle_reserve_expiration_time))
- ||
- (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (cfg,
- "exchangedb",
- "LEGAL_RESERVE_EXPIRATION_TIME",
- &pg->legal_reserve_expiration_time)) )
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (cfg,
+ "exchangedb",
+ "IDLE_RESERVE_EXPIRATION_TIME",
+ &pg->idle_reserve_expiration_time))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchangedb",
+ "IDLE_RESERVE_EXPIRATION_TIME");
+ GNUNET_free (pg->exchange_url);
+ GNUNET_free (pg->sql_dir);
+ GNUNET_free (pg);
+ return NULL;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (cfg,
+ "exchangedb",
+ "LEGAL_RESERVE_EXPIRATION_TIME",
+ &pg->legal_reserve_expiration_time))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchangedb",
- "LEGAL/IDLE_RESERVE_EXPIRATION_TIME");
+ "LEGAL_RESERVE_EXPIRATION_TIME");
GNUNET_free (pg->exchange_url);
GNUNET_free (pg->sql_dir);
GNUNET_free (pg);
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index f96e81da7..d333a7ea0 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -34,25 +34,25 @@ static int result;
* Report line of error if @a cond is true, and jump to label "drop".
*/
#define FAILIF(cond) \
- do { \
- if (! (cond)) { break;} \
- GNUNET_break (0); \
- goto drop; \
- } while (0)
+ do { \
+ if (! (cond)) { break;} \
+ GNUNET_break (0); \
+ goto drop; \
+ } while (0)
/**
* Initializes @a ptr with random data.
*/
#define RND_BLK(ptr) \
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \
- sizeof (*ptr))
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \
+ sizeof (*ptr))
/**
* Initializes @a ptr with zeros.
*/
#define ZR_BLK(ptr) \
- memset (ptr, 0, sizeof (*ptr))
+ memset (ptr, 0, sizeof (*ptr))
/**
@@ -1680,8 +1680,8 @@ run (void *cls)
rsa->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
- TALER_denom_ewv_deep_copy (&ccoin->exchange_vals,
- alg_values);
+ TALER_denom_ewv_copy (&ccoin->exchange_vals,
+ alg_values);
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 9e074a0c4..b872af08d 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1363,7 +1363,7 @@ TALER_denom_ewv_rsa_singleton (void);
* @param bi_src blinding input values to copy
*/
void
-TALER_denom_ewv_deep_copy (
+TALER_denom_ewv_copy (
struct TALER_ExchangeWithdrawValues *bi_dst,
const struct TALER_ExchangeWithdrawValues *bi_src);
@@ -1559,8 +1559,8 @@ TALER_denom_pub_hash (const struct TALER_DenominationPublicKey *denom_pub,
* @param denom_src public key to copy
*/
void
-TALER_denom_pub_deep_copy (struct TALER_DenominationPublicKey *denom_dst,
- const struct TALER_DenominationPublicKey *denom_src);
+TALER_denom_pub_copy (struct TALER_DenominationPublicKey *denom_dst,
+ const struct TALER_DenominationPublicKey *denom_src);
/**
@@ -1571,8 +1571,8 @@ TALER_denom_pub_deep_copy (struct TALER_DenominationPublicKey *denom_dst,
* @param denom_src public key to copy
*/
void
-TALER_denom_sig_deep_copy (struct TALER_DenominationSignature *denom_dst,
- const struct TALER_DenominationSignature *denom_src);
+TALER_denom_sig_copy (struct TALER_DenominationSignature *denom_dst,
+ const struct TALER_DenominationSignature *denom_src);
/**
@@ -1583,7 +1583,7 @@ TALER_denom_sig_deep_copy (struct TALER_DenominationSignature *denom_dst,
* @param denom_src public key to copy
*/
void
-TALER_blinded_denom_sig_deep_copy (
+TALER_blinded_denom_sig_copy (
struct TALER_BlindedDenominationSignature *denom_dst,
const struct TALER_BlindedDenominationSignature *denom_src);
@@ -2804,15 +2804,15 @@ TALER_CRYPTO_helper_esign_sign_ (
* @return the error code (or #TALER_EC_NONE on success)
*/
#define TALER_CRYPTO_helper_esign_sign(esh,ps,epub,esig) ( \
- /* check size is set correctly */ \
- GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)), \
- /* check 'ps' begins with the purpose */ \
- GNUNET_static_assert (((void*) (ps)) == \
- ((void*) &(ps)->purpose)), \
- TALER_CRYPTO_helper_esign_sign_ (esh, \
- &(ps)->purpose, \
- epub, \
- esig) )
+ /* check size is set correctly */ \
+ GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)), \
+ /* check 'ps' begins with the purpose */ \
+ GNUNET_static_assert (((void*) (ps)) == \
+ ((void*) &(ps)->purpose)), \
+ TALER_CRYPTO_helper_esign_sign_ (esh, \
+ &(ps)->purpose, \
+ epub, \
+ esig) )
/**
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index b2e513341..8a59f157f 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2023 Taler Systems SA
+ Copyright (C) 2014-2024 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
@@ -2591,7 +2591,8 @@ typedef void
/**
* Withdraw multiple coins from the exchange using a /reserves/$RESERVE_PUB/batch-withdraw
* request. This API is typically used by a wallet to withdraw many coins from a
- * reserve.
+ * reserve. The blind signatures are unblinded and verified before being returned
+ * to the caller at @a res_cb.
*
* Note that to ensure that no money is lost in case of hardware
* failures, the caller must have committed (most of) the arguments to
@@ -2688,7 +2689,11 @@ struct TALER_EXCHANGE_Withdraw2Handle;
/**
* Withdraw a coin from the exchange using a /reserves/$RESERVE_PUB/withdraw
* request. This API is typically used by a merchant to withdraw a tip
- * where the blinding factor is unknown to the merchant.
+ * where the blinding factor is unknown to the merchant. Note that unlike
+ * the #TALER_EXCHANGE_withdraw() API, this API neither unblinds the signatures
+ * nor can it verify that the exchange signatures are valid, so these tasks
+ * are left to the caller. Wallets probably should use #TALER_EXCHANGE_withdraw()
+ * which integrates these steps.
*
* Note that to ensure that no money is lost in case of hardware
* failures, the caller must have committed (most of) the arguments to
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index cf9f7c02f..6fae8562a 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -30,6 +30,10 @@
#include <gnunet/gnunet_pq_lib.h>
#include "taler_util.h"
+/**
+ * API version. Bump on every change.
+ */
+#define TALER_PQ_VERSION 0x09040000
/**
* Generate query parameter (as record tuple) for an amount, consisting
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 7d5542a1b..e895c3445 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2023 Taler Systems SA
+ Copyright (C) 2014-2024 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
@@ -17,6 +17,7 @@
* @file include/taler_util.h
* @brief Interface for common utility functions
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Christian Grothoff
*/
#ifndef TALER_UTIL_H
#define TALER_UTIL_H
@@ -33,7 +34,7 @@
* Version of the Taler API, in hex.
* Thus 0.8.4-1 = 0x00080401.
*/
-#define TALER_API_VERSION 0x00090200
+#define TALER_API_VERSION 0x00090400
/**
* Stringify operator.
diff --git a/src/lib/exchange_api_age_withdraw.c b/src/lib/exchange_api_age_withdraw.c
index 8f8d2b2b0..ca1a11cb8 100644
--- a/src/lib/exchange_api_age_withdraw.c
+++ b/src/lib/exchange_api_age_withdraw.c
@@ -500,13 +500,13 @@ perform_protocol (
struct TALER_EXCHANGE_AgeWithdrawBlindedHandle *awbh)
{
#define FAIL_IF(cond) \
- do { \
- if ((cond)) \
- { \
- GNUNET_break (! (cond)); \
- goto ERROR; \
- } \
- } while (0)
+ do { \
+ if ((cond)) \
+ { \
+ GNUNET_break (! (cond)); \
+ goto ERROR; \
+ } \
+ } while (0)
struct GNUNET_HashContext *coins_hctx = NULL;
json_t *j_denoms = NULL;
@@ -813,8 +813,8 @@ csr_withdraw_done (
bool success = false;
/* Complete the initialization of the coin with CS denomination */
- TALER_denom_ewv_deep_copy (&can->details.alg_values,
- &csrr->details.ok.alg_values);
+ TALER_denom_ewv_copy (&can->details.alg_values,
+ &csrr->details.ok.alg_values);
GNUNET_assert (can->details.alg_values.blinding_inputs->cipher
== GNUNET_CRYPTO_BSA_CS);
TALER_planchet_setup_coin_priv (&can->secret,
@@ -882,13 +882,13 @@ prepare_coins (
static num_coins])
{
#define FAIL_IF(cond) \
- do { \
- if ((cond)) \
- { \
- GNUNET_break (! (cond)); \
- goto ERROR; \
- } \
- } while (0)
+ do { \
+ if ((cond)) \
+ { \
+ GNUNET_break (! (cond)); \
+ goto ERROR; \
+ } \
+ } while (0)
GNUNET_assert (0 < num_coins);
awh->age_mask = coin_inputs[0].denom_pub->key.age_mask;
@@ -904,8 +904,8 @@ prepare_coins (
cd->denom_pub = *input->denom_pub;
/* The mask must be the same for all coins */
FAIL_IF (awh->age_mask.bits != input->denom_pub->key.age_mask.bits);
- TALER_denom_pub_deep_copy (&cd->denom_pub.key,
- &input->denom_pub->key);
+ TALER_denom_pub_copy (&cd->denom_pub.key,
+ &input->denom_pub->key);
for (uint8_t k = 0; k < TALER_CNC_KAPPA; k++)
{
@@ -927,8 +927,8 @@ prepare_coins (
switch (input->denom_pub->key.bsign_pub_key->cipher)
{
case GNUNET_CRYPTO_BSA_RSA:
- TALER_denom_ewv_deep_copy (&can->details.alg_values,
- TALER_denom_ewv_rsa_singleton ());
+ TALER_denom_ewv_copy (&can->details.alg_values,
+ TALER_denom_ewv_rsa_singleton ());
TALER_planchet_setup_coin_priv (&can->secret,
&can->details.alg_values,
&can->details.coin_priv);
diff --git a/src/lib/exchange_api_batch_deposit.c b/src/lib/exchange_api_batch_deposit.c
index 56b9b11e3..3dab64526 100644
--- a/src/lib/exchange_api_batch_deposit.c
+++ b/src/lib/exchange_api_batch_deposit.c
@@ -256,8 +256,6 @@ auditor_cb (void *cls,
struct TALER_EXCHANGE_BatchDepositHandle *dh = cls;
const struct TALER_EXCHANGE_SigningPublicKey *spk;
struct TEAH_AuditorInteractionEntry *aie;
- const struct TALER_EXCHANGE_DenomPublicKey *dki;
- unsigned int coin;
const struct TALER_CoinSpendSignatureP *csigs[GNUNET_NZL (
dh->num_cdds)];
const struct TALER_CoinSpendPublicKeyP *cpubs[GNUNET_NZL (
@@ -279,14 +277,9 @@ auditor_cb (void *cls,
"Not providing deposit confirmation to auditor\n");
return;
}
- coin = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- dh->num_cdds);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Will provide deposit confirmation to auditor `%s'\n",
TALER_B2S (auditor_pub));
- dki = TALER_EXCHANGE_get_denomination_key_by_hash (dh->keys,
- &dh->cdds[coin].h_denom_pub);
- GNUNET_assert (NULL != dki);
spk = TALER_EXCHANGE_get_signing_key_info (dh->keys,
&dh->exchange_pub);
if (NULL == spk)
@@ -557,6 +550,7 @@ TALER_EXCHANGE_batch_deposit (
{
*ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
GNUNET_break_op (0);
+ json_decref (deposits);
return NULL;
}
if (0 >
@@ -568,6 +562,7 @@ TALER_EXCHANGE_batch_deposit (
GNUNET_break_op (0);
GNUNET_free (dh->cdds);
GNUNET_free (dh);
+ json_decref (deposits);
return NULL;
}
GNUNET_assert (0 <=
@@ -585,6 +580,7 @@ TALER_EXCHANGE_batch_deposit (
GNUNET_break_op (0);
GNUNET_free (dh->cdds);
GNUNET_free (dh);
+ json_decref (deposits);
return NULL;
}
if (GNUNET_is_zero (&cdd->h_age_commitment))
@@ -621,6 +617,7 @@ TALER_EXCHANGE_batch_deposit (
GNUNET_free (dh->url);
GNUNET_free (dh->cdds);
GNUNET_free (dh);
+ json_decref (deposits);
return NULL;
}
diff --git a/src/lib/exchange_api_batch_withdraw.c b/src/lib/exchange_api_batch_withdraw.c
index bc5abd539..a1b21f347 100644
--- a/src/lib/exchange_api_batch_withdraw.c
+++ b/src/lib/exchange_api_batch_withdraw.c
@@ -306,8 +306,8 @@ withdraw_cs_stage_two_callback (
case MHD_HTTP_OK:
GNUNET_assert (NULL ==
cd->alg_values.blinding_inputs);
- TALER_denom_ewv_deep_copy (&cd->alg_values,
- &csrr->details.ok.alg_values);
+ TALER_denom_ewv_copy (&cd->alg_values,
+ &csrr->details.ok.alg_values);
TALER_planchet_setup_coin_priv (&cd->ps,
&cd->alg_values,
&cd->priv);
@@ -377,13 +377,13 @@ TALER_EXCHANGE_batch_withdraw (
cd->ps = *wci->ps;
cd->ach = wci->ach;
cd->pk = *wci->pk;
- TALER_denom_pub_deep_copy (&cd->pk.key,
- &wci->pk->key);
+ TALER_denom_pub_copy (&cd->pk.key,
+ &wci->pk->key);
switch (wci->pk->key.bsign_pub_key->cipher)
{
case GNUNET_CRYPTO_BSA_RSA:
- TALER_denom_ewv_deep_copy (&cd->alg_values,
- TALER_denom_ewv_rsa_singleton ());
+ TALER_denom_ewv_copy (&cd->alg_values,
+ TALER_denom_ewv_rsa_singleton ());
TALER_planchet_setup_coin_priv (&cd->ps,
&cd->alg_values,
&cd->priv);
diff --git a/src/lib/exchange_api_batch_withdraw2.c b/src/lib/exchange_api_batch_withdraw2.c
index 453d8a0ab..ff1496466 100644
--- a/src/lib/exchange_api_batch_withdraw2.c
+++ b/src/lib/exchange_api_batch_withdraw2.c
@@ -89,8 +89,8 @@ struct TALER_EXCHANGE_BatchWithdraw2Handle
/**
* We got a 200 OK response for the /reserves/$RESERVE_PUB/batch-withdraw operation.
* Extract the coin's signature and return it to the caller. The signature we
- * get from the exchange is for the blinded value. Thus, we first must
- * unblind it and then should verify its validity against our coin's hash.
+ * get from the exchange is for the blinded value. As we do not have the
+ * blinding factor, the signature CANNOT be verified.
*
* If everything checks out, we return the unblinded signature
* to the application via the callback.
@@ -103,11 +103,12 @@ static enum GNUNET_GenericReturnValue
reserve_batch_withdraw_ok (struct TALER_EXCHANGE_BatchWithdraw2Handle *wh,
const json_t *json)
{
- struct TALER_BlindedDenominationSignature blind_sigs[wh->num_coins];
+ struct TALER_BlindedDenominationSignature blind_sigs[GNUNET_NZL (
+ wh->num_coins)];
const json_t *ja = json_object_get (json,
"ev_sigs");
const json_t *j;
- unsigned int index;
+ size_t index;
struct TALER_EXCHANGE_BatchWithdraw2Response bwr = {
.hr.reply = json,
.hr.http_status = MHD_HTTP_OK
@@ -134,7 +135,7 @@ reserve_batch_withdraw_ok (struct TALER_EXCHANGE_BatchWithdraw2Handle *wh,
NULL, NULL))
{
GNUNET_break_op (0);
- for (unsigned int i = 0; i<index; i++)
+ for (size_t i = 0; i<index; i++)
TALER_blinded_denom_sig_free (&blind_sigs[i]);
return GNUNET_SYSERR;
}
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 27ce85060..7db89933b 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1386,8 +1386,8 @@ keys_completed_cb (void *cls,
kd_old->num_denom_keys
* sizeof (struct TALER_EXCHANGE_DenomPublicKey));
for (unsigned int i = 0; i<kd_old->num_denom_keys; i++)
- TALER_denom_pub_deep_copy (&kd->denom_keys[i].key,
- &kd_old->denom_keys[i].key);
+ TALER_denom_pub_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,
struct TALER_EXCHANGE_AuditorInformation);
@@ -1796,8 +1796,8 @@ TALER_EXCHANGE_copy_denomination_key (
copy = GNUNET_new (struct TALER_EXCHANGE_DenomPublicKey);
*copy = *key;
- TALER_denom_pub_deep_copy (&copy->key,
- &key->key);
+ TALER_denom_pub_copy (&copy->key,
+ &key->key);
return copy;
}
diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c
index 2d56ec915..4b1adc723 100644
--- a/src/lib/exchange_api_link.c
+++ b/src/lib/exchange_api_link.c
@@ -214,8 +214,8 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
}
/* clean up */
- TALER_denom_pub_deep_copy (&lci->pub,
- &rpub);
+ TALER_denom_pub_copy (&lci->pub,
+ &rpub);
GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c
index 24b064476..c2f8cefb7 100644
--- a/src/lib/exchange_api_melt.c
+++ b/src/lib/exchange_api_melt.c
@@ -476,8 +476,8 @@ csr_cb (void *cls,
case GNUNET_CRYPTO_BSA_RSA:
break;
case GNUNET_CRYPTO_BSA_CS:
- TALER_denom_ewv_deep_copy (wv,
- &csrr->details.ok.alg_values[nks_off]);
+ TALER_denom_ewv_copy (wv,
+ &csrr->details.ok.alg_values[nks_off]);
nks_off++;
break;
}
@@ -535,8 +535,8 @@ TALER_EXCHANGE_melt (
GNUNET_free (mh);
return NULL;
case GNUNET_CRYPTO_BSA_RSA:
- TALER_denom_ewv_deep_copy (&mh->mbds[i].alg_value,
- TALER_denom_ewv_rsa_singleton ());
+ TALER_denom_ewv_copy (&mh->mbds[i].alg_value,
+ TALER_denom_ewv_rsa_singleton ());
break;
case GNUNET_CRYPTO_BSA_CS:
nks[nks_off].pk = fresh_pk;
diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c
index 652581d8e..4369367e4 100644
--- a/src/lib/exchange_api_refresh_common.c
+++ b/src/lib/exchange_api_refresh_common.c
@@ -89,18 +89,18 @@ TALER_EXCHANGE_get_melt_data_ (
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (rd->melt_amount.currency,
&total));
- TALER_denom_pub_deep_copy (&md->melted_coin.pub_key,
- &rd->melt_pk.key);
- TALER_denom_sig_deep_copy (&md->melted_coin.sig,
- &rd->melt_sig);
+ TALER_denom_pub_copy (&md->melted_coin.pub_key,
+ &rd->melt_pk.key);
+ TALER_denom_sig_copy (&md->melted_coin.sig,
+ &rd->melt_sig);
md->fcds = GNUNET_new_array (md->num_fresh_coins,
struct FreshCoinData);
for (unsigned int j = 0; j<rd->fresh_pks_len; j++)
{
struct FreshCoinData *fcd = &md->fcds[j];
- TALER_denom_pub_deep_copy (&fcd->fresh_pk,
- &rd->fresh_pks[j].key);
+ TALER_denom_pub_copy (&fcd->fresh_pk,
+ &rd->fresh_pks[j].key);
GNUNET_assert (NULL != fcd->fresh_pk.bsign_pub_key);
if (alg_values[j].blinding_inputs->cipher !=
fcd->fresh_pk.bsign_pub_key->cipher)
diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c
index 7eadab228..69c53a6c9 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -470,8 +470,8 @@ TALER_EXCHANGE_refreshes_reveal (
= GNUNET_new_array (md.num_fresh_coins,
struct TALER_ExchangeWithdrawValues);
for (unsigned int i = 0; i<md.num_fresh_coins; i++)
- TALER_denom_ewv_deep_copy (&rrh->alg_values[i],
- &alg_values[i]);
+ TALER_denom_ewv_copy (&rrh->alg_values[i],
+ &alg_values[i]);
rrh->url = TALER_url_join (url,
arg_str,
NULL);
diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c
index 98bbb7e26..1b056bdbb 100644
--- a/src/testing/testing_api_cmd_batch_withdraw.c
+++ b/src/testing/testing_api_cmd_batch_withdraw.c
@@ -215,15 +215,15 @@ reserve_batch_withdraw_cb (void *cls,
const struct TALER_EXCHANGE_PrivateCoinDetails *pcd
= &wr->details.ok.coins[i];
- TALER_denom_sig_deep_copy (&cs->sig,
- &pcd->sig);
+ TALER_denom_sig_copy (&cs->sig,
+ &pcd->sig);
cs->coin_priv = pcd->coin_priv;
GNUNET_CRYPTO_eddsa_key_get_public (&cs->coin_priv.eddsa_priv,
&cs->coin_pub.eddsa_pub);
cs->bks = pcd->bks;
- TALER_denom_ewv_deep_copy (&cs->exchange_vals,
- &pcd->exchange_vals);
+ TALER_denom_ewv_copy (&cs->exchange_vals,
+ &pcd->exchange_vals);
}
break;
case MHD_HTTP_FORBIDDEN:
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
index c1555a901..111e9118f 100644
--- a/src/testing/testing_api_cmd_refresh.c
+++ b/src/testing/testing_api_cmd_refresh.c
@@ -459,8 +459,8 @@ reveal_cb (void *cls,
fc->h_age_commitment = coin->h_age_commitment;
}
- TALER_denom_sig_deep_copy (&fc->sig,
- &coin->sig);
+ TALER_denom_sig_copy (&fc->sig,
+ &coin->sig);
}
if (0 != rrs->total_backoff.rel_value_us)
{
@@ -979,8 +979,8 @@ melt_cb (void *cls,
mr->details.ok.num_mbds,
struct TALER_EXCHANGE_MeltBlindingDetail);
for (unsigned int i = 0; i<mr->details.ok.num_mbds; i++)
- TALER_denom_ewv_deep_copy (&rms->mbds[i].alg_value,
- &mr->details.ok.mbds[i].alg_value);
+ TALER_denom_ewv_copy (&rms->mbds[i].alg_value,
+ &mr->details.ok.mbds[i].alg_value);
}
if (0 != rms->total_backoff.rel_value_us)
{
@@ -1153,8 +1153,8 @@ melt_run (void *cls,
&fresh_pk->fees.withdraw));
rms->fresh_pks[i] = *fresh_pk;
/* Make a deep copy of the RSA key */
- TALER_denom_pub_deep_copy (&rms->fresh_pks[i].key,
- &fresh_pk->key);
+ TALER_denom_pub_copy (&rms->fresh_pks[i].key,
+ &fresh_pk->key);
} /* end for */
rms->refresh_data.melt_priv = *rms->melt_priv;
diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c
index a98e69521..f8ff0205b 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -293,12 +293,12 @@ reserve_withdraw_cb (void *cls,
{
case MHD_HTTP_OK:
GNUNET_assert (1 == wr->details.ok.num_coins);
- TALER_denom_sig_deep_copy (&ws->sig,
- &wr->details.ok.coins[0].sig);
+ TALER_denom_sig_copy (&ws->sig,
+ &wr->details.ok.coins[0].sig);
ws->coin_priv = wr->details.ok.coins[0].coin_priv;
ws->bks = wr->details.ok.coins[0].bks;
- TALER_denom_ewv_deep_copy (&ws->exchange_vals,
- &wr->details.ok.coins[0].exchange_vals);
+ TALER_denom_ewv_copy (&ws->exchange_vals,
+ &wr->details.ok.coins[0].exchange_vals);
if (0 != ws->total_backoff.rel_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 2a0304e03..478f75cfe 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -120,7 +120,7 @@ libtalerutil_la_LIBADD = \
-lm
libtalerutil_la_LDFLAGS = \
- -version-info 0:0:0 \
+ -version-info 1:0:0 \
-no-undefined
diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c
index ac41f52c6..4c4a56feb 100644
--- a/src/util/crypto_helper_cs.c
+++ b/src/util/crypto_helper_cs.c
@@ -122,7 +122,7 @@ TALER_CRYPTO_helper_cs_connect (
char *secname;
GNUNET_asprintf (&secname,
- "%s-exchange-secmod-cs",
+ "%s-secmod-cs",
section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index 4901937f5..e044d31d1 100644
--- a/src/util/crypto_helper_esign.c
+++ b/src/util/crypto_helper_esign.c
@@ -118,9 +118,9 @@ TALER_CRYPTO_helper_esign_connect (
struct TALER_CRYPTO_ExchangeSignHelper *esh;
char *unixpath;
char *secname;
-
+
GNUNET_asprintf (&secname,
- "%s-exchange-secmod-eddsa",
+ "%s-secmod-eddsa",
section);
if (GNUNET_OK !=
diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c
index d5b7ccf2f..e23e12a88 100644
--- a/src/util/crypto_helper_rsa.c
+++ b/src/util/crypto_helper_rsa.c
@@ -120,9 +120,9 @@ TALER_CRYPTO_helper_rsa_connect (
struct TALER_CRYPTO_RsaDenominationHelper *dh;
char *unixpath;
char *secname;
-
+
GNUNET_asprintf (&secname,
- "%s-exchange-secmod-rsa",
+ "%s-secmod-rsa",
section);
if (GNUNET_OK !=
@@ -142,7 +142,7 @@ TALER_CRYPTO_helper_rsa_connect (
if (strlen (unixpath) >= sizeof (dh->sa.sun_path))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-rsa",
+ secname,
"UNIXPATH",
"path too long");
GNUNET_free (unixpath);
diff --git a/src/util/denom.c b/src/util/denom.c
index 928c46328..cb232c4a3 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -252,8 +252,8 @@ TALER_denom_ewv_free (struct TALER_ExchangeWithdrawValues *ewv)
void
-TALER_denom_ewv_deep_copy (struct TALER_ExchangeWithdrawValues *bi_dst,
- const struct TALER_ExchangeWithdrawValues *bi_src)
+TALER_denom_ewv_copy (struct TALER_ExchangeWithdrawValues *bi_dst,
+ const struct TALER_ExchangeWithdrawValues *bi_src)
{
if (bi_src == TALER_denom_ewv_rsa_singleton ())
{
@@ -266,8 +266,8 @@ TALER_denom_ewv_deep_copy (struct TALER_ExchangeWithdrawValues *bi_dst,
void
-TALER_denom_pub_deep_copy (struct TALER_DenominationPublicKey *denom_dst,
- const struct TALER_DenominationPublicKey *denom_src)
+TALER_denom_pub_copy (struct TALER_DenominationPublicKey *denom_dst,
+ const struct TALER_DenominationPublicKey *denom_src)
{
denom_dst->age_mask = denom_src->age_mask;
denom_dst->bsign_pub_key
@@ -276,8 +276,8 @@ TALER_denom_pub_deep_copy (struct TALER_DenominationPublicKey *denom_dst,
void
-TALER_denom_sig_deep_copy (struct TALER_DenominationSignature *denom_dst,
- const struct TALER_DenominationSignature *denom_src)
+TALER_denom_sig_copy (struct TALER_DenominationSignature *denom_dst,
+ const struct TALER_DenominationSignature *denom_src)
{
denom_dst->unblinded_sig
= GNUNET_CRYPTO_ub_sig_incref (denom_src->unblinded_sig);
@@ -285,7 +285,7 @@ TALER_denom_sig_deep_copy (struct TALER_DenominationSignature *denom_dst,
void
-TALER_blinded_denom_sig_deep_copy (
+TALER_blinded_denom_sig_copy (
struct TALER_BlindedDenominationSignature *denom_dst,
const struct TALER_BlindedDenominationSignature *denom_src)
{
diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c
index fbd5aa258..3e9ba1558 100644
--- a/src/util/taler-exchange-secmod-cs.c
+++ b/src/util/taler-exchange-secmod-cs.c
@@ -341,9 +341,9 @@ static struct GNUNET_TIME_Timestamp now_tmp;
static char *keydir;
/**
- * Name of the configuration section prefix to use. Usually either "taler" or
+ * Name of the configuration section prefix to use. Usually either "taler-exchange" or
* "donau". The actual configuration section will then be
- * "$SECTION-exchange-secmod-cs".
+ * "$SECTION-secmod-cs".
*/
static char *section;
@@ -1964,6 +1964,11 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *ct,
struct Denomination *denom)
{
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-cs",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
ct,
@@ -1973,6 +1978,7 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
ct,
"DURATION_WITHDRAW");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
if (GNUNET_TIME_relative_cmp (overlap_duration,
@@ -1980,11 +1986,13 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
denom->duration_withdraw))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-cs",
+ secname,
"OVERLAP_DURATION",
"Value given must be smaller than value for DURATION_WITHDRAW!");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
+ GNUNET_free (secname);
denom->section = GNUNET_strdup (ct);
return GNUNET_OK;
}
@@ -2099,28 +2107,36 @@ load_denominations (void *cls,
static enum GNUNET_GenericReturnValue
load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-cs",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-cs",
+ secname,
"OVERLAP_DURATION",
&overlap_duration))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-cs",
+ secname,
"OVERLAP_DURATION");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-cs",
+ secname,
"LOOKAHEAD_SIGN",
&lookahead_sign))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-cs",
+ secname,
"LOOKAHEAD_SIGN");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
+ GNUNET_free (secname);
return GNUNET_OK;
}
@@ -2180,7 +2196,7 @@ run (void *cls,
now = GNUNET_TIME_timestamp_get ();
}
GNUNET_asprintf (&secname,
- "%s-exchange-secmod-cs",
+ "%s-secmod-cs",
section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
@@ -2202,9 +2218,17 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
- global_ret = TES_listen_start (cfg,
- "taler-exchange-secmod-cs",
- &cb);
+ {
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-cs",
+ section);
+ global_ret = TES_listen_start (cfg,
+ secname,
+ &cb);
+ GNUNET_free (secname);
+ }
if (0 != global_ret)
return;
sem_init (&worker_sem,
@@ -2300,7 +2324,7 @@ main (int argc,
/* Restrict permissions for the key files that we create. */
(void) umask (S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH);
- section = GNUNET_strdup ("taler");
+ section = GNUNET_strdup ("taler-exchange");
/* force linker to link against libtalerutil; if we do
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
diff --git a/src/util/taler-exchange-secmod-eddsa.c b/src/util/taler-exchange-secmod-eddsa.c
index 1be4f7b49..0b95447f7 100644
--- a/src/util/taler-exchange-secmod-eddsa.c
+++ b/src/util/taler-exchange-secmod-eddsa.c
@@ -137,9 +137,9 @@ static struct GNUNET_TIME_Timestamp now_tmp;
static char *keydir;
/**
- * Name of the configuration section prefix to use. Usually either "taler" or
+ * Name of the configuration section prefix to use. Usually either "taler-exchange" or
* "donau". The actual configuration section will then be
- * "$SECTION-exchange-secmod-cs".
+ * "$SECTION-secmod-eddsa".
*/
static char *section;
@@ -998,39 +998,48 @@ import_key (void *cls,
static enum GNUNET_GenericReturnValue
load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-eddsa",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-eddsa",
+ secname,
"OVERLAP_DURATION",
&overlap_duration))
{
+ GNUNET_free (secname);
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-eddsa",
+ secname,
"OVERLAP_DURATION");
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-eddsa",
+ secname,
"DURATION",
&duration))
{
+ GNUNET_free (secname);
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-eddsa",
+ secname,
"DURATION");
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-eddsa",
+ secname,
"LOOKAHEAD_SIGN",
&lookahead_sign))
{
+ GNUNET_free (secname);
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-eddsa",
+ secname,
"LOOKAHEAD_SIGN");
return GNUNET_SYSERR;
}
+ GNUNET_free (secname);
return GNUNET_OK;
}
@@ -1088,7 +1097,7 @@ run (void *cls,
now = GNUNET_TIME_timestamp_get ();
}
GNUNET_asprintf (&secname,
- "%s-exchange-secmod-eddsa",
+ "%s-secmod-eddsa",
section);
if (GNUNET_OK !=
load_durations (cfg))
@@ -1112,9 +1121,17 @@ run (void *cls,
GNUNET_free (secname);
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
- global_ret = TES_listen_start (cfg,
- "taler-exchange-secmod-eddsa",
- &cb);
+ {
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-eddsa",
+ section);
+ global_ret = TES_listen_start (cfg,
+ secname,
+ &cb);
+ GNUNET_free (secname);
+ }
if (0 != global_ret)
return;
/* Load keys */
@@ -1175,7 +1192,7 @@ main (int argc,
/* Restrict permissions for the key files that we create. */
(void) umask (S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH);
- section = GNUNET_strdup ("taler");
+ section = GNUNET_strdup ("taler-exchange");
/* force linker to link against libtalerutil; if we do
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index 57bf69d04..c80e2e3c4 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -308,9 +308,9 @@ static struct GNUNET_TIME_Timestamp now_tmp;
static char *keydir;
/**
- * Name of the configuration section prefix to use. Usually either "taler" or
+ * Name of the configuration section prefix to use. Usually either "taler-exchange" or
* "donau". The actual configuration section will then be
- * "$SECTION-exchange-secmod-cs".
+ * "$SECTION-secmod-rsa".
*/
static char *section;
@@ -1261,6 +1261,7 @@ create_key (struct Denomination *denom,
struct GNUNET_TIME_Timestamp anchor;
anchor = now;
+ // FIXME: round down to multiple of 'anchor_round' value from configuration
if (NULL != denom->keys_tail)
{
struct GNUNET_TIME_Absolute abs;
@@ -1729,7 +1730,11 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct Denomination *denom)
{
unsigned long long rsa_keysize;
+ char *secname;
+ GNUNET_asprintf (&secname,
+ "%s-secmod-rsa",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
ct,
@@ -1739,6 +1744,7 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
ct,
"DURATION_WITHDRAW");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
if (GNUNET_TIME_relative_cmp (overlap_duration,
@@ -1746,9 +1752,10 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
denom->duration_withdraw))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-rsa",
+ section,
"OVERLAP_DURATION",
"Value given must be smaller than value for DURATION_WITHDRAW!");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -1760,6 +1767,7 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
ct,
"RSA_KEYSIZE");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
if ( (rsa_keysize > 4 * 2048) ||
@@ -1769,8 +1777,10 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
ct,
"RSA_KEYSIZE",
"Given RSA keysize outside of permitted range [1024,8192]\n");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
+ GNUNET_free (secname);
denom->rsa_keysize = (unsigned int) rsa_keysize;
denom->section = GNUNET_strdup (ct);
return GNUNET_OK;
@@ -1885,28 +1895,36 @@ load_denominations (void *cls,
static enum GNUNET_GenericReturnValue
load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-rsa",
+ section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-rsa",
+ secname,
"OVERLAP_DURATION",
&overlap_duration))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-rsa",
+ secname,
"OVERLAP_DURATION");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
- "taler-exchange-secmod-rsa",
+ secname,
"LOOKAHEAD_SIGN",
&lookahead_sign))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "taler-exchange-secmod-rsa",
+ secname,
"LOOKAHEAD_SIGN");
+ GNUNET_free (secname);
return GNUNET_SYSERR;
}
+ GNUNET_free (secname);
return GNUNET_OK;
}
@@ -1966,7 +1984,7 @@ run (void *cls,
now = GNUNET_TIME_timestamp_get ();
}
GNUNET_asprintf (&secname,
- "%s-exchange-secmod-rsa",
+ "%s-secmod-rsa",
section);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
@@ -1988,9 +2006,17 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
- global_ret = TES_listen_start (cfg,
- "taler-exchange-secmod-rsa",
- &cb);
+ {
+ char *secname;
+
+ GNUNET_asprintf (&secname,
+ "%s-secmod-rsa",
+ section);
+ global_ret = TES_listen_start (cfg,
+ secname,
+ &cb);
+ GNUNET_free (secname);
+ }
if (0 != global_ret)
return;
sem_init (&worker_sem,
@@ -2087,7 +2113,7 @@ main (int argc,
/* Restrict permissions for the key files that we create. */
(void) umask (S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH);
- section = GNUNET_strdup ("taler");
+ section = GNUNET_strdup ("taler-exchange");
/* force linker to link against libtalerutil; if we do
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
diff --git a/src/util/taler-exchange-secmod-rsa.conf b/src/util/taler-exchange-secmod-rsa.conf
index 7b16ad114..978c40258 100644
--- a/src/util/taler-exchange-secmod-rsa.conf
+++ b/src/util/taler-exchange-secmod-rsa.conf
@@ -5,7 +5,7 @@
# wallets picking one key and then due to network latency
# another key being valid. The DURATION_WITHDRAW period
# must be longer than this value.
-OVERLAP_DURATION = 5 m
+OVERLAP_DURATION = 0 m
# Where do we store the generated private keys.
KEY_DIR = ${TALER_DATA_HOME}exchange-secmod-rsa/keys
@@ -21,3 +21,6 @@ SM_PRIV_KEY = ${TALER_DATA_HOME}exchange-secmod-rsa/secmod-private-key
# For how long into the future do we pre-generate keys?
LOOKAHEAD_SIGN = 1 year
+
+# Round down anchor key start date to multiples of this time.
+ANCHOR_ROUND = 1 ms \ No newline at end of file
diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c
index 07e9907b4..93562e459 100644
--- a/src/util/test_helper_cs.c
+++ b/src/util/test_helper_cs.c
@@ -970,7 +970,7 @@ par_signing (struct GNUNET_CONFIGURATION_Handle *cfg)
int ret;
dh = TALER_CRYPTO_helper_cs_connect (cfg,
- "taler",
+ "taler-exchange",
&key_cb,
NULL);
GNUNET_assert (NULL != dh);
@@ -1028,7 +1028,7 @@ run_test (void)
nanosleep (&req,
NULL);
dh = TALER_CRYPTO_helper_cs_connect (cfg,
- "taler",
+ "taler-exchange",
&key_cb,
NULL);
if (NULL != dh)
diff --git a/src/util/test_helper_eddsa.c b/src/util/test_helper_eddsa.c
index 4f1f95893..0119e4278 100644
--- a/src/util/test_helper_eddsa.c
+++ b/src/util/test_helper_eddsa.c
@@ -365,7 +365,7 @@ par_signing (struct GNUNET_CONFIGURATION_Handle *cfg)
int ret;
esh = TALER_CRYPTO_helper_esign_connect (cfg,
- "taler",
+ "taler-exchange",
&key_cb,
NULL);
if (NULL == esh)
@@ -428,7 +428,7 @@ run_test (void)
nanosleep (&req,
NULL);
esh = TALER_CRYPTO_helper_esign_connect (cfg,
- "taler",
+ "taler-exchange",
&key_cb,
NULL);
if (NULL != esh)
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
index 2ea166330..2bc15879f 100644
--- a/src/util/test_helper_rsa.c
+++ b/src/util/test_helper_rsa.c
@@ -797,7 +797,7 @@ par_signing (struct GNUNET_CONFIGURATION_Handle *cfg)
int ret;
dh = TALER_CRYPTO_helper_rsa_connect (cfg,
- "taler",
+ "taler-exchange",
&key_cb,
NULL);
GNUNET_assert (NULL != dh);
@@ -856,7 +856,7 @@ run_test (void)
nanosleep (&req,
NULL);
dh = TALER_CRYPTO_helper_rsa_connect (cfg,
- "taler",
+ "taler-exchange",
&key_cb,
NULL);
if (NULL != dh)