From 6e86a3c43cd6b16115134dfe617b091f8dbcd89d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 17 Nov 2021 13:03:47 +0100 Subject: -sms wip --- src/util/test_helper_rsa.c | 259 +++++++++++++++++++++++++++++---------------- 1 file changed, 170 insertions(+), 89 deletions(-) (limited to 'src/util/test_helper_rsa.c') diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c index e4c0bf6f..97844001 100644 --- a/src/util/test_helper_rsa.c +++ b/src/util/test_helper_rsa.c @@ -22,11 +22,12 @@ #include "taler_util.h" /** - * Configuration has 1 minute duration and 5 minutes lookahead, so - * we should never have more than 6 active keys, plus for during - * key expiration / revocation. + * Configuration has 1 minute duration and 5 minutes lookahead, but + * we do not get 'revocations' for expired keys. So this must be + * large enough to deal with key rotation during the runtime of + * the benchmark. */ -#define MAX_KEYS 7 +#define MAX_KEYS 1024 /** * How many random key revocations should we test? @@ -38,6 +39,17 @@ */ #define NUM_SIGN_TESTS 5 +/** + * How many iterations of the successful signing test should we run + * during the benchmark phase? + */ +#define NUM_SIGN_PERFS 100 + +/** + * How many parallel clients should we use for the parallel + * benchmark? (> 500 may cause problems with the max open FD number limit). + */ +#define NUM_CORES 8 /** * Number of keys currently in #keys. @@ -62,7 +74,7 @@ struct KeyData /** * Hash of the public key. */ - struct TALER_DenominationHash h_denom_pub; + struct GNUNET_HashCode h_denom_pub; /** * Full public key. @@ -110,7 +122,7 @@ key_cb (void *cls, const char *section_name, struct GNUNET_TIME_Absolute start_time, struct GNUNET_TIME_Relative validity_duration, - const struct TALER_DenominationHash *h_denom_pub, + const struct GNUNET_HashCode *h_denom_pub, const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_SecurityModulePublicKeyP *sm_pub, const struct TALER_SecurityModuleSignatureP *sm_sig) @@ -119,7 +131,7 @@ key_cb (void *cls, (void) sm_sig; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Key notification about key %s in `%s'\n", - GNUNET_h2s (&h_denom_pub->hash), + GNUNET_h2s (h_denom_pub), section_name); if (0 == validity_duration.rel_value_us) { @@ -133,7 +145,8 @@ key_cb (void *cls, { keys[i].valid = false; keys[i].revoked = false; - TALER_denom_pub_free (&keys[i].denom_pub); + GNUNET_CRYPTO_rsa_public_key_free (keys[i].denom_pub.rsa_public_key); + keys[i].denom_pub.rsa_public_key = NULL; GNUNET_assert (num_keys > 0); num_keys--; found = true; @@ -154,9 +167,8 @@ key_cb (void *cls, keys[i].h_denom_pub = *h_denom_pub; keys[i].start_time = start_time; keys[i].validity_duration = validity_duration; - keys[i].denom_pub = *denom_pub; - TALER_denom_pub_deep_copy (&keys[i].denom_pub, - denom_pub); + keys[i].denom_pub.rsa_public_key + = GNUNET_CRYPTO_rsa_public_key_dup (denom_pub->rsa_public_key); num_keys++; return; } @@ -199,7 +211,7 @@ test_revocation (struct TALER_CRYPTO_DenominationHelper *dh) keys[j].revoked = true; fprintf (stderr, "Revoking key %s ...", - GNUNET_h2s (&keys[j].h_denom_pub.hash)); + GNUNET_h2s (&keys[j].h_denom_pub)); TALER_CRYPTO_helper_denom_revoke (dh, &keys[j].h_denom_pub); for (unsigned int k = 0; k<1000; k++) @@ -235,35 +247,42 @@ test_revocation (struct TALER_CRYPTO_DenominationHelper *dh) static int test_signing (struct TALER_CRYPTO_DenominationHelper *dh) { - struct TALER_BlindedDenominationSignature ds; + struct TALER_DenominationSignature ds; enum TALER_ErrorCode ec; bool success = false; - struct TALER_PlanchetSecretsP ps; - struct TALER_CoinPubHash c_hash; - - TALER_planchet_setup_random (&ps); + struct GNUNET_HashCode m_hash; + struct GNUNET_CRYPTO_RsaBlindingKeySecret bks; + + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, + &bks, + sizeof (bks)); + GNUNET_CRYPTO_hash ("Hello", + strlen ("Hello"), + &m_hash); for (unsigned int i = 0; i 0); num_keys--; } + GNUNET_CONFIGURATION_destroy (cfg); return ret; } @@ -535,7 +616,7 @@ main (int argc, (void) argc; (void) argv; GNUNET_log_setup ("test-helper-rsa", - "INFO", + "WARNING", NULL); GNUNET_OS_init (TALER_project_data_default ()); libexec_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); @@ -551,7 +632,7 @@ main (int argc, "-c", "test_helper_rsa.conf", "-L", - "INFO", + "WARNING", NULL); if (NULL == helper) { -- cgit v1.2.3