[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: implement csr max request elemen
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: implement csr max request elements |
Date: |
Sat, 05 Feb 2022 22:46:50 +0100 |
This is an automated email from the git hooks/post-receive script.
lucien-heuzeveldt pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 251f2b59 implement csr max request elements
251f2b59 is described below
commit 251f2b598730b9a5a692a602bcde050d63c2db84
Author: Lucien Heuzeveldt <lucienclaude.heuzeveldt@students.bfh.ch>
AuthorDate: Sat Feb 5 22:46:36 2022 +0100
implement csr max request elements
---
src/exchange/taler-exchange-httpd_csr.c | 12 ++++++++++--
src/exchange/taler-exchange-httpd_refreshes_reveal.c | 10 ++--------
src/include/taler_crypto_lib.h | 6 ++++++
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_csr.c
b/src/exchange/taler-exchange-httpd_csr.c
index b3fa49f3..af621682 100644
--- a/src/exchange/taler-exchange-httpd_csr.c
+++ b/src/exchange/taler-exchange-httpd_csr.c
@@ -63,7 +63,15 @@ TEH_handler_csr (struct TEH_RequestContext *rc,
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
csr_requests_num = json_array_size (csr_requests);
- // FIXME: check number of requests against an upper bound
+ if (TALER_MAX_FRESH_COINS <= csr_requests_num)
+ {
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ // FIXME: generalize error message
+ TALER_EC_EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE,
+ NULL);
+ }
struct TALER_CsNonce nonces[GNUNET_NZL (csr_requests_num)];
struct TALER_DenominationHash denom_pub_hashes[GNUNET_NZL
(csr_requests_num)];
for (unsigned int i = 0; i < csr_requests_num; i++)
@@ -86,7 +94,6 @@ TEH_handler_csr (struct TEH_RequestContext *rc,
csr_spec,
i,
-1);
- GNUNET_JSON_parse_free (csr_spec);
if (GNUNET_OK != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
}
@@ -158,6 +165,7 @@ TEH_handler_csr (struct TEH_RequestContext *rc,
}
// derive r_pub
+ // FIXME: bundle all requests into one derivation request (TEH_keys_...,
crypto helper, security module)
ec = TEH_keys_denomination_cs_r_pub (denom_pub_hash,
nonce,
r_pub);
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index ce1e273b..3e5401a1 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -31,12 +31,6 @@
#include "taler-exchange-httpd_keys.h"
-/**
- * Maximum number of fresh coins we allow per refresh operation.
- */
-#define MAX_FRESH_COINS 256
-
-
/**
* Send a response for "/refreshes/$RCH/reveal".
*
@@ -305,7 +299,7 @@ resolve_refreshes_reveal_denominations (struct
MHD_Connection *connection,
const json_t *coin_evs)
{
unsigned int num_fresh_coins = json_array_size (new_denoms_h_json);
- /* We know num_fresh_coins is bounded by #MAX_FRESH_COINS, so this is safe */
+ /* We know num_fresh_coins is bounded by #TALER_MAX_FRESH_COINS, so this is
safe */
const struct TEH_DenominationKey *dks[num_fresh_coins];
struct TALER_RefreshCoinData rcds[num_fresh_coins];
struct TALER_EXCHANGEDB_RefreshRevealedCoin rrcs[num_fresh_coins];
@@ -610,7 +604,7 @@ handle_refreshes_reveal_json (struct MHD_Connection
*connection,
unsigned int num_tprivs = json_array_size (tp_json);
GNUNET_assert (num_tprivs == TALER_CNC_KAPPA - 1); /* checked just earlier */
- if ( (num_fresh_coins >= MAX_FRESH_COINS) ||
+ if ( (num_fresh_coins >= TALER_MAX_FRESH_COINS) ||
(0 == num_fresh_coins) )
{
GNUNET_break_op (0);
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 0783b1e8..cf8464b3 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1557,6 +1557,12 @@ TALER_planchet_to_coin (const struct
TALER_DenominationPublicKey *dk,
/* ****************** Refresh crypto primitives ************* */
+/**
+ * Maximum number of fresh coins we allow per refresh operation.
+ */
+#define TALER_MAX_FRESH_COINS 256
+
+
/**
* Given the coin and the transfer private keys, compute the
* transfer secret. (Technically, we only need one of the two
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: implement csr max request elements,
gnunet <=