Fix build when OpenSSL has no EGD support
authorBernard <bernard@meterkast3.bachfreund.nl>
Fri, 10 Apr 2015 20:47:03 +0000 (22:47 +0200)
committerBernard <bernard@meterkast3.bachfreund.nl>
Fri, 10 Apr 2015 20:47:03 +0000 (22:47 +0200)
cf/crypto.m4
lib/hcrypto/rand-fortuna.c
lib/hcrypto/test_rand.c
lib/krb5/crypto-rand.c

index 370068b4d3968076daa9a79514640f99844523c7..f42905d0df9b94bb71227c73bfc5b12b9b3fc84e 100644 (file)
@@ -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
index 11027b46cf4acd2ffac6d4b708512c64d0240632..6c7a56f1ce5403e64a6bcecda52af1b3fda1b805 100644 (file)
@@ -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.
index f7e66877483f7637185a20b1c8e6bd96bf1f7ee5..df7532db034d82089ef2bb5144861ea119328c8a 100644 (file)
@@ -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
index 9ae550b06a23e53836d28b35c87ad612553f7488..8063bc745959783020f50fb9e3753db8a8e7f1d1 100644 (file)
@@ -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;