aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-10-27 23:54:55 +0200
committerChristian Grothoff <christian@grothoff.org>2023-10-27 23:54:55 +0200
commit192e361811c93327c80af69b0f5280b30ceae682 (patch)
tree9eefd1c730d1212216a1f68fc1399954ebd0c39d /src
parent47397c55f764ccd5a00a2626199d2a6772fb7db9 (diff)
fixes with respect to new blinding API
Diffstat (limited to 'src')
-rw-r--r--src/exchangedb/pg_get_known_coin.c4
-rw-r--r--src/include/taler_crypto_lib.h37
-rw-r--r--src/include/taler_exchange_service.h1
-rw-r--r--src/lib/exchange_api_batch_withdraw.c20
-rw-r--r--src/lib/exchange_api_refresh_common.c5
-rw-r--r--src/pq/pq_result_helper.c2
6 files changed, 39 insertions, 30 deletions
diff --git a/src/exchangedb/pg_get_known_coin.c b/src/exchangedb/pg_get_known_coin.c
index bab48c119..2c4a82d67 100644
--- a/src/exchangedb/pg_get_known_coin.c
+++ b/src/exchangedb/pg_get_known_coin.c
@@ -51,9 +51,6 @@ TEH_PG_get_known_coin (void *cls,
"Getting known coin data for coin %s\n",
TALER_B2S (coin_pub));
coin_info->coin_pub = *coin_pub;
- /* Used in #postgres_get_known_coin() to fetch
- the denomination public key and signature for
- a coin known to the exchange. */
PREPARE (pg,
"get_known_coin",
"SELECT"
@@ -63,7 +60,6 @@ TEH_PG_get_known_coin (void *cls,
" FROM known_coins"
" JOIN denominations USING (denominations_serial)"
" WHERE coin_pub=$1;");
-
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_known_coin",
params,
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 06bf7f519..82d737004 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1133,16 +1133,6 @@ TALER_rsa_pub_hash (const struct GNUNET_CRYPTO_RsaPublicKey *rsa,
/**
- * Return the alg value singleton for creation of
- * blinding secrets for RSA.
- *
- * @return singleton to use for RSA blinding
- */
-const struct TALER_ExchangeWithdrawValues *
-TALER_denom_ewv_rsa_singleton (void);
-
-
-/**
* Hash @a cs.
*
* @param cs key to hash
@@ -1352,6 +1342,16 @@ struct TALER_ExchangeWithdrawValues
/**
+ * Return the alg value singleton for creation of
+ * blinding secrets for RSA.
+ *
+ * @return singleton to use for RSA blinding
+ */
+const struct TALER_ExchangeWithdrawValues *
+TALER_denom_ewv_rsa_singleton (void);
+
+
+/**
* Create private key for a Taler coin.
* @param ps planchet secret to derive coin priv key
* @param alg_values includes algorithm specific values
@@ -1946,14 +1946,15 @@ TALER_planchet_blinding_secret_create (
* @return #GNUNET_OK on success
*/
enum GNUNET_GenericReturnValue
-TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
- const struct TALER_ExchangeWithdrawValues *alg_values,
- const union GNUNET_CRYPTO_BlindingSecretP *bks,
- const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
- const struct TALER_CoinSpendPrivateKeyP *coin_priv,
- const struct TALER_AgeCommitmentHash *ach,
- struct TALER_CoinPubHashP *c_hash,
- struct TALER_PlanchetDetail *pd);
+TALER_planchet_prepare (
+ const struct TALER_DenominationPublicKey *dk,
+ const struct TALER_ExchangeWithdrawValues *alg_values,
+ const union GNUNET_CRYPTO_BlindingSecretP *bks,
+ const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
+ const struct TALER_CoinSpendPrivateKeyP *coin_priv,
+ const struct TALER_AgeCommitmentHash *ach,
+ struct TALER_CoinPubHashP *c_hash,
+ struct TALER_PlanchetDetail *pd);
/**
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index fb0a578af..8f5f4c4d2 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1513,6 +1513,7 @@ struct TALER_EXCHANGE_CsRWithdrawResponse
* respective coin's withdraw operation.
*/
struct TALER_ExchangeWithdrawValues alg_values;
+
} ok;
/**
diff --git a/src/lib/exchange_api_batch_withdraw.c b/src/lib/exchange_api_batch_withdraw.c
index d17a00f1b..cab4734b5 100644
--- a/src/lib/exchange_api_batch_withdraw.c
+++ b/src/lib/exchange_api_batch_withdraw.c
@@ -116,7 +116,6 @@ struct TALER_EXCHANGE_BatchWithdrawHandle
*/
const struct TALER_EXCHANGE_Keys *keys;
-
/**
* Handle for the actual (internal) batch withdraw operation.
*/
@@ -305,7 +304,9 @@ withdraw_cs_stage_two_callback (
switch (csrr->hr.http_status)
{
case MHD_HTTP_OK:
- cd->alg_values = csrr->details.ok.alg_values;
+ cd->alg_values.blinding_inputs
+ = GNUNET_CRYPTO_blinding_input_values_incref (
+ csrr->details.ok.alg_values.blinding_inputs);
TALER_planchet_setup_coin_priv (&cd->ps,
&cd->alg_values,
&cd->priv);
@@ -376,15 +377,18 @@ TALER_EXCHANGE_batch_withdraw (
{
case GNUNET_CRYPTO_BSA_RSA:
{
+ const struct TALER_ExchangeWithdrawValues *alg_values
+ = TALER_denom_ewv_rsa_singleton ();
+
TALER_planchet_setup_coin_priv (&cd->ps,
- &cd->alg_values,
+ alg_values,
&cd->priv);
TALER_planchet_blinding_secret_create (&cd->ps,
- &cd->alg_values,
+ alg_values,
&cd->bks);
if (GNUNET_OK !=
TALER_planchet_prepare (&cd->pk.key,
- NULL,
+ alg_values,
&cd->bks,
NULL,
&cd->priv,
@@ -444,6 +448,12 @@ TALER_EXCHANGE_batch_withdraw_cancel (
TALER_EXCHANGE_csr_withdraw_cancel (cd->csrh);
cd->csrh = NULL;
}
+ if (NULL != cd->alg_values.blinding_inputs)
+ {
+ GNUNET_CRYPTO_blinding_input_values_decref (
+ cd->alg_values.blinding_inputs);
+ cd->alg_values.blinding_inputs = NULL;
+ }
TALER_blinded_planchet_free (&cd->pd.blinded_planchet);
TALER_denom_pub_free (&cd->pk.key);
}
diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c
index 57011a6b4..2e92807b3 100644
--- a/src/lib/exchange_api_refresh_common.c
+++ b/src/lib/exchange_api_refresh_common.c
@@ -99,6 +99,9 @@ TALER_EXCHANGE_get_melt_data_ (
{
struct FreshCoinData *fcd = &md->fcds[j];
+ TALER_denom_pub_deep_copy (&fcd->fresh_pk,
+ &rd->fresh_pks[j].key);
+ GNUNET_assert (NULL != fcd->fresh_pk.bsign_pub_key);
switch (fcd->fresh_pk.bsign_pub_key->cipher)
{
case GNUNET_CRYPTO_BSA_INVALID:
@@ -121,8 +124,6 @@ TALER_EXCHANGE_get_melt_data_ (
&nonces[j].cs_nonce);
break;
}
- TALER_denom_pub_deep_copy (&fcd->fresh_pk,
- &rd->fresh_pks[j].key);
if ( (0 >
TALER_amount_add (&total,
&total,
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 06c72267b..d9a3d8fd5 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -623,13 +623,13 @@ extract_denom_sig (void *cls,
if (sizeof (ubs->details.cs_signature) != len)
{
GNUNET_break (0);
+ GNUNET_free (ubs);
return GNUNET_SYSERR;
}
GNUNET_memcpy (&ubs->details.cs_signature,
res,
len);
sig->unblinded_sig = ubs;
- GNUNET_free (ubs);
return GNUNET_OK;
}
GNUNET_break (0);