summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2020-05-17 02:08:56 +0200
committerBernd Edlinger <bernd.edlinger@hotmail.de>2020-05-20 14:49:09 +0200
commit5f10fce37b234807c39d6b1b6440585b84b68b65 (patch)
treedf1bc64e692004fe8084dd4e149a6f1b8290c433
parentde5e2cb541699e11a2b82de1d7f98f62bc207a1d (diff)
Fix egd and devrandom source configs
./config --with-rand-seed=egd need to defines OPENSSL_RAND_SEED_EGD and OPENSSL_NO_EGD so get rid of OPENSSL_NO_EGD (compiles but I did not really test EGD) ./config --with-rand-seed=devrandom does not work since wait_random_seeded works under the assumption that OPENSSL_RAND_SEED_GETRANDOM is supposed to be enabled as well, that is usually the case, but not when only devrandom is enabled. Skip the wait code in this special case. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11848) (cherry picked from commit ddec332f329a432a45c0131d83f3bfb46114532b)
-rwxr-xr-xConfigure3
-rw-r--r--crypto/rand/rand_unix.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/Configure b/Configure
index 2e9efaa5f3..29f8b4dd4b 100755
--- a/Configure
+++ b/Configure
@@ -1049,6 +1049,9 @@ if (scalar(@seed_sources) == 0) {
print "Using os-specific seed configuration\n";
push @seed_sources, 'os';
}
+if (scalar(grep { $_ eq 'egd' } @seed_sources) > 0) {
+ delete $disabled{'egd'};
+}
if (scalar(grep { $_ eq 'none' } @seed_sources) > 0) {
die "Cannot seed with none and anything else" if scalar(@seed_sources) > 1;
warn <<_____ if scalar(@seed_sources) == 1;
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 19b6138a1f..da66773e4a 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -411,7 +411,8 @@ static struct random_device {
} random_devices[OSSL_NELEM(random_device_paths)];
static int keep_random_devices_open = 1;
-# if defined(__linux) && defined(DEVRANDOM_WAIT)
+# if defined(__linux) && defined(DEVRANDOM_WAIT) \
+ && defined(OPENSSL_RAND_SEED_GETRANDOM)
static void *shm_addr;
static void cleanup_shm(void)
@@ -489,7 +490,7 @@ static int wait_random_seeded(void)
}
return seeded;
}
-# else /* defined __linux */
+# else /* defined __linux && DEVRANDOM_WAIT && OPENSSL_RAND_SEED_GETRANDOM */
static int wait_random_seeded(void)
{
return 1;