diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/taler-exchange-secmod-cs.c | 23 | ||||
-rw-r--r-- | src/util/taler-exchange-secmod-rsa.c | 21 | ||||
-rw-r--r-- | src/util/test_helper_cs.conf | 2 | ||||
-rw-r--r-- | src/util/test_helper_rsa.conf | 1 |
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] |