diff options
Diffstat (limited to '')
-rw-r--r-- | src/nxt_random.c | 8 | ||||
-rw-r--r-- | src/nxt_unix.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/nxt_random.c b/src/nxt_random.c index b6c9f704..aaa39887 100644 --- a/src/nxt_random.c +++ b/src/nxt_random.c @@ -68,6 +68,14 @@ nxt_random_stir(nxt_random_t *r) n = syscall(SYS_getrandom, &key, NXT_RANDOM_KEY_SIZE, 0); +#elif (NXT_HAVE_GETENTROPY || NXT_HAVE_GETENTROPY_SYS_RANDOM) + + n = 0; + + if (getentropy(&key, NXT_RANDOM_KEY_SIZE) == 0) { + n = NXT_RANDOM_KEY_SIZE; + } + #else n = 0; diff --git a/src/nxt_unix.h b/src/nxt_unix.h index 33e9f247..151dd555 100644 --- a/src/nxt_unix.h +++ b/src/nxt_unix.h @@ -234,6 +234,8 @@ #include <sys/random.h> /* getrandom(). */ #elif (NXT_HAVE_LINUX_SYS_GETRANDOM) #include <linux/random.h> /* SYS_getrandom. */ +#elif (NXT_HAVE_GETENTROPY_SYS_RANDOM) +#include <sys/random.h> /* getentropy(). */ #endif |