summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorGian Demarmels <gian@demarmels.org>2022-01-29 12:57:25 +0100
committerGian Demarmels <gian@demarmels.org>2022-02-04 15:39:57 +0100
commit8674f32aec8113ced6b2c2be625728b31158fff8 (patch)
tree32dbf9b07c6cccd8b72fc068ed6f66a6d9e50d80 /src/util
parent086cf05794e2936370223c97b35c1909fbc1a2c1 (diff)
downloadexchange-8674f32aec8113ced6b2c2be625728b31158fff8.tar.gz
exchange-8674f32aec8113ced6b2c2be625728b31158fff8.tar.bz2
exchange-8674f32aec8113ced6b2c2be625728b31158fff8.zip
denomination CIPHER field per denom
Diffstat (limited to 'src/util')
-rw-r--r--src/util/taler-exchange-secmod-cs.c23
-rw-r--r--src/util/taler-exchange-secmod-rsa.c21
-rw-r--r--src/util/test_helper_cs.conf2
-rw-r--r--src/util/test_helper_rsa.conf1
4 files changed, 46 insertions, 1 deletions
diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c
index 8ff8dc79b..a47e9f220 100644
--- a/src/util/taler-exchange-secmod-cs.c
+++ b/src/util/taler-exchange-secmod-cs.c
@@ -43,6 +43,8 @@
#include <poll.h>
+#define TALER_CFG_CIPHER_LEN 3
+
/**
* Information we keep per denomination.
*/
@@ -1360,6 +1362,7 @@ load_denominations (void *cls,
struct LoadContext *ctx = cls;
struct Denomination *denom;
bool wake = true;
+ char *cipher;
if ( (0 != strncasecmp (denomination_alias,
"coin_",
@@ -1368,6 +1371,26 @@ load_denominations (void *cls,
"coin-",
strlen ("coin-"))) )
return; /* not a denomination type definition */
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (ctx->cfg,
+ denomination_alias,
+ "CIPHER",
+ &cipher))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ denomination_alias,
+ "CIPHER");
+ return;
+ }
+ if (strlen (cipher) > TALER_CFG_CIPHER_LEN)
+ {
+ return; /* Cipher length must be smaller than TALER_CFG_CIPHER_LEN */
+ }
+ if (0 != strcmp (cipher, "CS"))
+ {
+ return; /* Ignore denominations of other types than CS*/
+ }
+
denom = GNUNET_new (struct Denomination);
if (GNUNET_OK !=
parse_denomination_cfg (ctx->cfg,
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index 433879299..fef20524d 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -41,6 +41,7 @@
#include "secmod_common.h"
#include <poll.h>
+#define TALER_CFG_CIPHER_LEN 3
/**
* Information we keep per denomination.
@@ -1340,6 +1341,7 @@ load_denominations (void *cls,
struct LoadContext *ctx = cls;
struct Denomination *denom;
bool wake = true;
+ char *cipher;
if ( (0 != strncasecmp (denomination_alias,
"coin_",
@@ -1348,6 +1350,25 @@ load_denominations (void *cls,
"coin-",
strlen ("coin-"))) )
return; /* not a denomination type definition */
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (ctx->cfg,
+ denomination_alias,
+ "CIPHER",
+ &cipher))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ denomination_alias,
+ "CIPHER");
+ return;
+ }
+ if (strlen (cipher) > TALER_CFG_CIPHER_LEN)
+ {
+ return; /* Cipher length must be smaller than TALER_CFG_CIPHER_LEN */
+ }
+ if (0 != strcmp (cipher, "RSA"))
+ {
+ return; /* Ignore denominations of other types than CS */
+ }
denom = GNUNET_new (struct Denomination);
if (GNUNET_OK !=
parse_denomination_cfg (ctx->cfg,
diff --git a/src/util/test_helper_cs.conf b/src/util/test_helper_cs.conf
index a5d1211a3..f3b5b834c 100644
--- a/src/util/test_helper_cs.conf
+++ b/src/util/test_helper_cs.conf
@@ -4,7 +4,7 @@ TALER_TEST_HOME = test_helper_cs_home/
[coin_1]
DURATION_WITHDRAW = 1 minute
-RSA_KEYSIZE = 2048
+CIPHER = CS
[taler-exchange-secmod-cs]
LOOKAHEAD_SIGN = 5 minutes
diff --git a/src/util/test_helper_rsa.conf b/src/util/test_helper_rsa.conf
index 6f445fc56..d50e64d95 100644
--- a/src/util/test_helper_rsa.conf
+++ b/src/util/test_helper_rsa.conf
@@ -4,6 +4,7 @@ TALER_TEST_HOME = test_helper_rsa_home/
[coin_1]
DURATION_WITHDRAW = 1 minute
+CIPHER = RSA
RSA_KEYSIZE = 2048
[taler-exchange-secmod-rsa]