summaryrefslogtreecommitdiff
path: root/tests/keygen.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-06-16 11:55:50 +0200
committerWerner Koch <wk@gnupg.org>2017-06-16 11:55:50 +0200
commit8f6082e95f30c1ba68d2de23da90146f87f0c66c (patch)
tree2667ef4ff141de5ca36b04d823d91a14f84aac57 /tests/keygen.c
parentb05a4abc358b204dba343d9cfbd59fdc828c1686 (diff)
downloadlibgcrypt-8f6082e95f30c1ba68d2de23da90146f87f0c66c.tar.gz
New global config option "only-urandom".
* random/rand-internal.h (RANDOM_CONF_ONLY_URANDOM): New. * random/random.c (_gcry_random_read_conf): Add option "only-urandom". * random/rndlinux.c (_gcry_rndlinux_gather_random): Implement that option. * tests/keygen.c (main): Add option --no-quick for better manual tests. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'tests/keygen.c')
-rw-r--r--tests/keygen.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/keygen.c b/tests/keygen.c
index 7cf48b6a..6b6a60a4 100644
--- a/tests/keygen.c
+++ b/tests/keygen.c
@@ -670,6 +670,7 @@ usage (int mode)
" --verbose be verbose\n"
" --debug flyswatter\n"
" --fips run in FIPS mode\n"
+ " --no-quick To not use the quick RNG hack\n"
" --progress print progress indicators\n",
mode? stderr : stdout);
if (mode)
@@ -682,6 +683,7 @@ main (int argc, char **argv)
int last_argc = -1;
int opt_fips = 0;
int with_progress = 0;
+ int no_quick = 0;
if (argc)
{ argc--; argv++; }
@@ -720,6 +722,11 @@ main (int argc, char **argv)
argc--; argv++;
with_progress = 1;
}
+ else if (!strcmp (*argv, "--no-quick"))
+ {
+ argc--; argv++;
+ no_quick = 1;
+ }
else if (!strncmp (*argv, "--", 2))
die ("unknown option '%s'", *argv);
else
@@ -740,7 +747,8 @@ main (int argc, char **argv)
if (debug)
xgcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0);
/* No valuable keys are create, so we can speed up our RNG. */
- xgcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
+ if (!no_quick)
+ xgcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
if (with_progress)
gcry_set_progress_handler (progress_cb, NULL);