diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/lib/config.h.in | 1 | ||||
-rw-r--r-- | src/lib/random.c | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 31a7742b..8dbedcff 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -99,6 +99,7 @@ endif () find_package(OpenSSL QUIET) if (OPENSSL_FOUND) + set(HAVE_OPENSSL_RNG TRUE) if (OPENSSL_VERSION VERSION_LESS "1.1.0") message(STATUS "Install version >= \"1.1.0\" to enable OpenSSL support " "(found version \"${OPENSSL_VERSION}\")") @@ -114,7 +115,7 @@ if (OPENSSL_FOUND) endif () endif () -if (NOT HAVE_OPENSSL) +if (NOT HAVE_OPENSSL_RNG) set(OPENSSL_INCLUDE_DIR "") set(OPENSSL_LIBRARIES "") endif () @@ -133,7 +134,7 @@ else () endif() if (NOT ((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR APPLE OR - HAVE_SYS_RANDOM OR HAVE_OPENSSL OR HAVE_LIBGCRYPT)) + HAVE_SYS_RANDOM OR HAVE_OPENSSL_RNG OR HAVE_LIBGCRYPT)) message(FATAL_ERROR "No secure random generator found, " "please install libgcrypt (> 1.7.0) or OpenSSL") endif () diff --git a/src/lib/config.h.in b/src/lib/config.h.in index 70261cab..8afc9a8c 100644 --- a/src/lib/config.h.in +++ b/src/lib/config.h.in @@ -33,6 +33,7 @@ #cmakedefine SHM_RBUFF_LOCKLESS #cmakedefine SHM_RDRB_MULTI_BLOCK #cmakedefine QOS_DISABLE_CRC +#cmakedefine HAVE_OPENSSL_RNG #define SHM_RBUFF_PREFIX "@SHM_RBUFF_PREFIX@" #define SHM_LOCKFILE_NAME "@SHM_LOCKFILE_NAME@" diff --git a/src/lib/random.c b/src/lib/random.c index 3751668e..971f5b5a 100644 --- a/src/lib/random.c +++ b/src/lib/random.c @@ -40,7 +40,7 @@ #include <gcrypt.h> #elif defined(__FreeBSD__) #include <stdlib.h> -#elif defined(HAVE_OPENSSL) +#elif defined(HAVE_OPENSSL_RNG) #include <openssl/rand.h> #include <limits.h> #endif @@ -58,7 +58,7 @@ int random_buffer(void * buf, #elif defined(HAVE_LIBGCRYPT) gcry_randomize(buf, len, GCRY_STRONG_RANDOM); return 0; -#elif defined(HAVE_OPENSSL) +#elif defined(HAVE_OPENSSL_RNG) if (len > 0 && len < INT_MAX) return RAND_bytes((unsigned char *) buf, (int) len); return -1; |