From 858480145b80dfc6ad69891d2e1ed576df67d39b Mon Sep 17 00:00:00 2001 From: Bernard Spil Date: Tue, 21 Apr 2015 10:04:08 +0200 Subject: [PATCH] Refactor EGD conditional support As per Jeremy's request in #124 Windows does not define HAVE_RAND_EGD resulting in the same conditional support for EGD. --- include/NTMakefile | 1 - include/config.h.w32 | 3 --- lib/hcrypto/rand-fortuna.c | 2 +- lib/hcrypto/test_rand.c | 2 +- lib/krb5/crypto-rand.c | 2 +- windows/NTMakefile.config | 3 --- 6 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/NTMakefile b/include/NTMakefile index d5d13220e..984984d4a 100644 --- a/include/NTMakefile +++ b/include/NTMakefile @@ -79,7 +79,6 @@ while(<>) { if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"".'$(DIR_hdbdir)'."\"\n"; } if ("$(HAVE_MSLSA_CACHE)") { print "#define HAVE_MSLSA_CACHE 1\n"; } if ("$(NO_LOCALNAME)") { print "#define NO_LOCALNAME 1\n"; } - if ("$(NO_RAND_EGD_METHOD)") { print "#define NO_RAND_EGD_METHOD 1\n"; } } elsif (m/\@VERSION_OPTDEFS\@/) { diff --git a/include/config.h.w32 b/include/config.h.w32 index 49e81c59f..3b23b26dc 100644 --- a/include/config.h.w32 +++ b/include/config.h.w32 @@ -1363,9 +1363,6 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* Define if you don't want to use mmap. */ #define NO_MMAP 1 -/* Define if EGD rand method is not defined */ -#define NO_RAND_EGD_METHOD 1 - /* Define if the Unix rand method is not defined */ #define NO_RAND_UNIX_METHOD 1 diff --git a/lib/hcrypto/rand-fortuna.c b/lib/hcrypto/rand-fortuna.c index 6c7a56f1c..68112e054 100644 --- a/lib/hcrypto/rand-fortuna.c +++ b/lib/hcrypto/rand-fortuna.c @@ -486,7 +486,7 @@ fortuna_reseed(void) entropy_p = 1; } #endif -#if !defined(NO_RAND_EGD_METHOD) && defined(HAVE_RAND_EGD) +#if defined(HAVE_RAND_EGD) /* * Only to get egd entropy if /dev/random or arc4rand failed since * it can be horribly slow to generate new bits. diff --git a/lib/hcrypto/test_rand.c b/lib/hcrypto/test_rand.c index df7532db0..a55547e8a 100644 --- a/lib/hcrypto/test_rand.c +++ b/lib/hcrypto/test_rand.c @@ -125,7 +125,7 @@ main(int argc, char **argv) else if (strcasecmp(rand_method, "unix") == 0) RAND_set_rand_method(RAND_unix_method()); #endif -#if !defined(NO_RAND_EGD_METHOD) && defined(HAVE_RAND_EGD) +#if defined(HAVE_RAND_EGD) else if (strcasecmp(rand_method, "egd") == 0) RAND_set_rand_method(RAND_egd_method()); #endif diff --git a/lib/krb5/crypto-rand.c b/lib/krb5/crypto-rand.c index 8063bc745..08780c15f 100644 --- a/lib/krb5/crypto-rand.c +++ b/lib/krb5/crypto-rand.c @@ -67,7 +67,7 @@ seed_something(void) /* Calling RAND_status() will try to use /dev/urandom if it exists so we do not have to deal with it. */ if (RAND_status() != 1) { -#if !defined(NO_RAND_EGD_METHOD) && defined(HAVE_RAND_EGD) +#if defined(HAVE_RAND_EGD) krb5_context context; const char *p; diff --git a/windows/NTMakefile.config b/windows/NTMakefile.config index 982c86fb3..4da9cb53a 100644 --- a/windows/NTMakefile.config +++ b/windows/NTMakefile.config @@ -95,9 +95,6 @@ WEAK_CRYPTO=1 # Disable use of GSS LOCALNAME support NO_LOCALNAME=1 -# No entropy-gathering daemon on Windows -NO_RAND_EGD_METHOD=1 - # Windows CRT mkdir does not have the mode parameter MKDIR_DOES_NOT_HAVE_MODE=1 -- 2.11.4.GIT