From 456f4a78d24a929f5b9d1c064cd9c2ee7a8aaf5a Mon Sep 17 00:00:00 2001 From: Leigh Date: Fri, 27 Mar 2015 13:24:36 +0100 Subject: [PATCH] Add RAND_egd check for compiling against LibreSSL --- ext/openssl/config0.m4 | 1 + ext/openssl/openssl.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ext/openssl/config0.m4 b/ext/openssl/config0.m4 index 701e488385..a9484b4acc 100644 --- a/ext/openssl/config0.m4 +++ b/ext/openssl/config0.m4 @@ -21,6 +21,7 @@ if test "$PHP_OPENSSL" != "no"; then AC_CHECK_LIB(ssl, DSA_get_default_method, AC_DEFINE(HAVE_DSA_DEFAULT_METHOD, 1, [OpenSSL 0.9.7 or later])) AC_CHECK_LIB(crypto, X509_free, AC_DEFINE(HAVE_DSA_DEFAULT_METHOD, 1, [OpenSSL 0.9.7 or later])) + AC_CHECK_FUNCS([RAND_egd]) PHP_SETUP_OPENSSL(OPENSSL_SHARED_LIBADD, [ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 704f119e1d..0c20fa1e15 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -993,11 +993,13 @@ static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *se if (file == NULL) { file = RAND_file_name(buffer, sizeof(buffer)); +#ifdef HAVE_RAND_EGD } else if (RAND_egd(file) > 0) { /* if the given filename is an EGD socket, don't * write anything back to it */ *egdsocket = 1; return SUCCESS; +#endif } if (file == NULL || !RAND_load_file(file, -1)) { if (RAND_status() == 0) { -- 2.50.1