summaryrefslogtreecommitdiff
path: root/src/rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rand.c')
-rw-r--r--src/rand.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/rand.c b/src/rand.c
index 10cd0252..fad9697b 100644
--- a/src/rand.c
+++ b/src/rand.c
@@ -14,10 +14,7 @@
#include <time.h>
#include <unistd.h>
-#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
-#define USE_OPENSSL_CRYPTO
-#endif
-#ifdef USE_OPENSSL_CRYPTO
+#if defined(WITH_OPENSSL)
#include <openssl/opensslv.h> /* OPENSSL_VERSION_NUMBER */
#include <openssl/rand.h>
#endif
@@ -161,7 +158,7 @@ static void li_rand_init (void)
#ifdef HAVE_SRANDOM
srandom(u); /*(initialize just in case random() used elsewhere)*/
#endif
- #ifdef USE_OPENSSL_CRYPTO
+ #if defined(WITH_OPENSSL)
RAND_poll();
RAND_seed(xsubi, (int)sizeof(xsubi));
#endif
@@ -176,7 +173,7 @@ int li_rand_pseudo (void)
{
/* randomness *is not* cryptographically strong */
/* (attempt to use better mechanisms to replace the more portable rand()) */
- #ifdef USE_OPENSSL_CRYPTO /* (openssl 1.1.0 deprecates RAND_pseudo_bytes()) */
+ #if defined(WITH_OPENSSL) /* (openssl 1.1.0 deprecates RAND_pseudo_bytes()) */
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
int i;
if (-1 != RAND_pseudo_bytes((unsigned char *)&i, sizeof(i))) return i;
@@ -206,7 +203,7 @@ void li_rand_pseudo_bytes (unsigned char *buf, int num)
int li_rand_bytes (unsigned char *buf, int num)
{
- #ifdef USE_OPENSSL_CRYPTO
+ #if defined(WITH_OPENSSL)
int rc = RAND_bytes(buf, num);
if (-1 != rc) {
return rc;
@@ -225,7 +222,7 @@ int li_rand_bytes (unsigned char *buf, int num)
void li_rand_cleanup (void)
{
- #ifdef USE_OPENSSL_CRYPTO
+ #if defined(WITH_OPENSSL)
RAND_cleanup();
#endif
safe_memclear(xsubi, sizeof(xsubi));