aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_batch-withdraw.c30
-rw-r--r--src/exchange/taler-exchange-httpd_csr.c42
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c24
3 files changed, 49 insertions, 47 deletions
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c b/src/exchange/taler-exchange-httpd_batch-withdraw.c
index de1b67e52..a923784bf 100644
--- a/src/exchange/taler-exchange-httpd_batch-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_batch-withdraw.c
@@ -413,24 +413,24 @@ static MHD_RESULT
prepare_transaction (const struct TEH_RequestContext *rc,
struct BatchWithdrawContext *wc)
{
- /* Note: We could check the reserve balance here,
- just to be reasonably sure that the reserve has
- a sufficient balance before doing the "expensive"
- signatures... */
- /* Sign before transaction! */
+ struct TEH_CoinSignData csds[wc->planchets_length];
+ struct TALER_BlindedDenominationSignature bss[wc->planchets_length];
+
for (unsigned int i = 0; i<wc->planchets_length; i++)
{
struct PlanchetContext *pc = &wc->planchets[i];
+
+ csds[i].h_denom_pub = &pc->collectable.denom_pub_hash;
+ csds[i].bp = &pc->blinded_planchet;
+ }
+ {
enum TALER_ErrorCode ec;
- struct TEH_CoinSignData csds = {
- .h_denom_pub = &pc->collectable.denom_pub_hash,
- .bp = &pc->blinded_planchet
- };
- ec = TEH_keys_denomination_sign (
- &csds,
+ ec = TEH_keys_denomination_batch_sign (
+ csds,
+ wc->planchets_length,
false,
- &pc->collectable.sig);
+ bss);
if (TALER_EC_NONE != ec)
{
GNUNET_break (0);
@@ -439,6 +439,12 @@ prepare_transaction (const struct TEH_RequestContext *rc,
NULL);
}
}
+ for (unsigned int i = 0; i<wc->planchets_length; i++)
+ {
+ struct PlanchetContext *pc = &wc->planchets[i];
+
+ pc->collectable.sig = bss[i];
+ }
/* run transaction */
{
diff --git a/src/exchange/taler-exchange-httpd_csr.c b/src/exchange/taler-exchange-httpd_csr.c
index 7e9e7a584..a22fdfff5 100644
--- a/src/exchange/taler-exchange-httpd_csr.c
+++ b/src/exchange/taler-exchange-httpd_csr.c
@@ -75,10 +75,11 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
{
struct TALER_ExchangeWithdrawValues ewvs[csr_requests_num];
-
{
struct TALER_CsNonce nonces[csr_requests_num];
struct TALER_DenominationHashP denom_pub_hashes[csr_requests_num];
+ struct TEH_CsDeriveData cdds[csr_requests_num];
+ struct TALER_DenominationCSPublicRPairP r_pubs[csr_requests_num];
for (unsigned int i = 0; i < csr_requests_num; i++)
{
@@ -114,8 +115,6 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
const struct TALER_CsNonce *nonce = &nonces[i];
const struct TALER_DenominationHashP *denom_pub_hash =
&denom_pub_hashes[i];
- struct TALER_DenominationCSPublicRPairP *r_pub
- = &ewvs[i].details.cs_values;
ewvs[i].cipher = TALER_DENOMINATION_CS;
/* check denomination referenced by denom_pub_hash */
@@ -176,28 +175,23 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
denom_pub_hash);
}
}
-
- /* derive r_pub */
- // FIXME-#7272: bundle all requests into one derivation request (TEH_keys_..., crypto helper, security module)
- {
- const struct TEH_CsDeriveData cdd = {
- .h_denom_pub = denom_pub_hash,
- .nonce = nonce
- };
-
- ec = TEH_keys_denomination_cs_r_pub (&cdd,
- true,
- r_pub);
- }
- if (TALER_EC_NONE != ec)
- {
- GNUNET_break (0);
- return TALER_MHD_reply_with_ec (rc->connection,
- ec,
- NULL);
- }
+ cdds[i].h_denom_pub = denom_pub_hash;
+ cdds[i].nonce = nonce;
+ } /* for (i) */
+ ec = TEH_keys_denomination_cs_batch_r_pub (cdds,
+ csr_requests_num,
+ true,
+ r_pubs);
+ if (TALER_EC_NONE != ec)
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_ec (rc->connection,
+ ec,
+ NULL);
}
- }
+ for (unsigned int i = 0; i < csr_requests_num; i++)
+ ewvs[i].details.cs_values = r_pubs[i];
+ } /* end scope */
/* send response */
{
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 56848d581..08a85265c 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -750,20 +750,21 @@ clean_age:
(unsigned int) rctx->num_fresh_coins);
/* create fresh coin signatures */
- for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
{
+ struct TEH_CoinSignData csds[rctx->num_fresh_coins];
+ struct TALER_BlindedDenominationSignature bss[rctx->num_fresh_coins];
enum TALER_ErrorCode ec;
- struct TEH_CoinSignData csd = {
- .h_denom_pub = &rrcs[i].h_denom_pub,
- .bp = &rcds[i].blinded_planchet
- };
- // FIXME #7272: replace with a batch call that
- // passes all coins in once go!
- ec = TEH_keys_denomination_sign (
- &csd,
+ for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
+ {
+ csds[i].h_denom_pub = &rrcs[i].h_denom_pub;
+ csds[i].bp = &rcds[i].blinded_planchet;
+ }
+ ec = TEH_keys_denomination_batch_sign (
+ csds,
+ rctx->num_fresh_coins,
true,
- &rrcs[i].coin_sig);
+ bss);
if (TALER_EC_NONE != ec)
{
GNUNET_break (0);
@@ -772,8 +773,9 @@ clean_age:
NULL);
goto cleanup;
}
+ for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
+ rrcs[i].coin_sig = bss[i];
}
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signatures ready, starting DB interaction\n");