[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: -fix uninit nonce
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: -fix uninit nonce |
Date: |
Sun, 13 Feb 2022 14:54:53 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new ccb3e0f1 -fix uninit nonce
ccb3e0f1 is described below
commit ccb3e0f161df4e3c5d60e177237384cc8f6b4b79
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 13 14:54:51 2022 +0100
-fix uninit nonce
---
src/lib/merchant_api_tip_pickup.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/lib/merchant_api_tip_pickup.c
b/src/lib/merchant_api_tip_pickup.c
index 9ed9afa1..8118918b 100644
--- a/src/lib/merchant_api_tip_pickup.c
+++ b/src/lib/merchant_api_tip_pickup.c
@@ -102,6 +102,12 @@ struct TALER_MERCHANT_TipPickupHandle
*/
char *backend_url;
+ /**
+ * Array of denomination keys and nonces, or NULL.
+ * Length is @e nks_len.
+ */
+ struct TALER_EXCHANGE_NonceKey *nks;
+
/**
* ID of the tip we are picking up.
*/
@@ -111,6 +117,11 @@ struct TALER_MERCHANT_TipPickupHandle
* Number of planchets/coins used for this operation.
*/
unsigned int num_planchets;
+
+ /**
+ * Length of the @e nks array.
+ */
+ unsigned int nks_len;
};
@@ -217,6 +228,7 @@ static void
pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
{
struct TALER_PlanchetDetail details[tp->num_planchets];
+ unsigned int noff = 0;
for (unsigned int i = 0; i<tp->num_planchets; i++)
{
@@ -229,6 +241,13 @@ pickup_post_csr (struct TALER_MERCHANT_TipPickupHandle *tp)
TALER_planchet_blinding_secret_create (&pd->ps,
&pcd->exchange_vals,
&pcd->bks);
+ if (TALER_DENOMINATION_CS == pcd->exchange_vals.cipher)
+ {
+ GNUNET_assert (noff < tp->nks_len);
+ details[i].blinded_planchet.details.cs_blinded_planchet.nonce
+ = tp->nks[noff].nonce;
+ noff++;
+ }
if (GNUNET_OK !=
TALER_planchet_prepare (&pd->pk.key,
&pcd->exchange_vals,
@@ -392,13 +411,16 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context
*ctx,
pickup_post_csr (tp);
return tp;
}
+ tp->nks_len = num_csr;
+ tp->nks = GNUNET_new_array (num_csr,
+ struct TALER_EXCHANGE_NonceKey);
{
- struct TALER_EXCHANGE_NonceKey nks[num_csr];
unsigned int off = 0;
for (unsigned int i = 0; i<tp->num_planchets; i++)
{
const struct PlanchetData *pd = &tp->planchets[i];
+ struct TALER_EXCHANGE_NonceKey *nk = &tp->nks[i];
switch (pd->pk.key.cipher)
{
@@ -408,16 +430,16 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context
*ctx,
case TALER_DENOMINATION_RSA:
break;
case TALER_DENOMINATION_CS:
- nks[off].pk = &pd->pk;
+ nk->pk = &pd->pk;
TALER_cs_withdraw_nonce_derive (&pd->ps,
- &nks[off].nonce);
+ &nk->nonce);
off++;
break;
}
}
tp->csr = TALER_EXCHANGE_csr (exchange,
off,
- nks,
+ tp->nks,
&csr_cb,
tp);
if (NULL == tp->csr)
@@ -455,6 +477,7 @@ TALER_MERCHANT_tip_pickup_cancel (struct
TALER_MERCHANT_TipPickupHandle *tp)
tp->csr = NULL;
}
GNUNET_free (tp->backend_url);
+ GNUNET_free (tp->nks);
GNUNET_free (tp->pcds);
GNUNET_free (tp);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: -fix uninit nonce,
gnunet <=