From 828f4f4fb10a89ef034bf41b2b7e614bd2f7385c Mon Sep 17 00:00:00 2001 From: Bernard Date: Fri, 10 Apr 2015 22:47:03 +0200 Subject: [PATCH] Fix build when OpenSSL has no EGD support --- cf/crypto.m4 | 1 + lib/hcrypto/rand-fortuna.c | 2 +- lib/hcrypto/test_rand.c | 2 +- lib/krb5/crypto-rand.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cf/crypto.m4 b/cf/crypto.m4 index 370068b4d..f42905d0d 100644 --- a/cf/crypto.m4 +++ b/cf/crypto.m4 @@ -118,6 +118,7 @@ if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then break; fi done + AC_CHECK_LIB(crypto, RAND_egd, AC_DEFINE(HAVE_RAND_EGD, 1, [Define if the libcrypto has RAND_egd])) CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" fi diff --git a/lib/hcrypto/rand-fortuna.c b/lib/hcrypto/rand-fortuna.c index 11027b46c..6c7a56f1c 100644 --- a/lib/hcrypto/rand-fortuna.c +++ b/lib/hcrypto/rand-fortuna.c @@ -486,7 +486,7 @@ fortuna_reseed(void) entropy_p = 1; } #endif -#ifndef NO_RAND_EGD_METHOD +#if !defined(NO_RAND_EGD_METHOD) && 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 f7e668774..df7532db0 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 -#ifndef NO_RAND_EGD_METHOD +#if !defined(NO_RAND_EGD_METHOD) && 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 9ae550b06..8063bc745 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) { -#ifndef NO_RAND_EGD_METHOD +#if !defined(NO_RAND_EGD_METHOD) && defined(HAVE_RAND_EGD) krb5_context context; const char *p; -- 2.11.4.GIT