aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-12-03 15:21:12 +0100
committerKim Alvefur <zash@zash.se>2017-12-03 15:21:12 +0100
commitabb425e70f217eb660aadb29885e07a7238b7feb (patch)
tree7bf81f4d70bac58ed3522b88d14c3c0dbeb9c487 /util-src
parentutil.crand: Use a small buffer on the stack for small pieces of random, should be faster (diff)
downloadprosody-abb425e70f217eb660aadb29885e07a7238b7feb.tar.xz
prosody-abb425e70f217eb660aadb29885e07a7238b7feb.zip
util.crand: Make it possible to use arc4random on Linux (needs libbsd)
Diffstat (limited to 'util-src')
-rw-r--r--util-src/crand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util-src/crand.c b/util-src/crand.c
index ab2f4ad1f..cdc3c2116 100644
--- a/util-src/crand.c
+++ b/util-src/crand.c
@@ -54,7 +54,11 @@ int getrandom(void *buf, size_t buflen, unsigned int flags) {
#elif defined(WITH_OPENSSL)
#include <openssl/rand.h>
-#elif ! defined(WITH_ARC4RANDOM)
+#elif defined(WITH_ARC4RANDOM)
+#ifdef __linux__
+#include <bsd/stdlib.h>
+#endif
+#else
#error util.crand compiled without a random source
#endif