summaryrefslogtreecommitdiff
path: root/src/lib/random.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-10-05 13:05:12 +0200
committerSander Vrijders <sander@ouroboros.rocks>2019-10-05 13:52:26 +0200
commitc8ab23cbce8a209566f317d22e2c554ff621e3c8 (patch)
treed5705905d8cd21eee16a5487ba10bc87b20f4e34 /src/lib/random.c
parentd7db0ac776bdeaff89d13e951e19e9fe28d7bbd1 (diff)
downloadouroboros-c8ab23cbce8a209566f317d22e2c554ff621e3c8.tar.gz
ouroboros-c8ab23cbce8a209566f317d22e2c554ff621e3c8.zip
build: Allow older OpenSSL versions for random
Ubuntu 16 comes with older versions of OpenSSL, glibc and libgcrypt. Ouroboros will now fall back to OpenSSL even if the version is <= 1.1.0. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/random.c')
-rw-r--r--src/lib/random.c4
1 files changed, 2 insertions, 2 deletions
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;