diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2018-07-16 13:30:11 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2018-07-16 13:30:11 +0300 |
commit | 7c5a710c5543debff0c70cb4839e15e9a1da322b (patch) | |
tree | a7ee30b8e7aa308a19ee8a98bc745f6a26d9cf38 /src/nxt_random.c | |
parent | bf1cb8f399b2b580da5c014439eff038e9d1315f (diff) | |
download | unit-7c5a710c5543debff0c70cb4839e15e9a1da322b.tar.gz unit-7c5a710c5543debff0c70cb4839e15e9a1da322b.tar.bz2 |
Added getentropy() support.
Prodded by David Carlier.
Diffstat (limited to 'src/nxt_random.c')
-rw-r--r-- | src/nxt_random.c | 8 |
1 files changed, 8 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; |