diff options
Diffstat (limited to '')
-rw-r--r-- | src/nxt_random.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nxt_random.c b/src/nxt_random.c index 9af40079..ea73ae18 100644 --- a/src/nxt_random.c +++ b/src/nxt_random.c @@ -8,8 +8,6 @@ #include <nxt_main.h> -#if !(NXT_HAVE_ARC4RANDOM) - /* * The pseudorandom generator based on OpenBSD arc4random. Although it is * usually stated that arc4random uses RC4 pseudorandom generation algorithm @@ -56,7 +54,7 @@ nxt_random_stir(nxt_random_t *r) ssize_t n; struct timeval tv; union { - uint32_t value[3]; + uint32_t value[4]; u_char bytes[NXT_RANDOM_KEY_SIZE]; } key; @@ -87,6 +85,7 @@ nxt_random_stir(nxt_random_t *r) key.value[0] ^= tv.tv_usec; key.value[1] ^= tv.tv_sec; key.value[2] ^= nxt_pid; + key.value[3] ^= nxt_thread_tid(NULL); } nxt_random_add(r, key.bytes, NXT_RANDOM_KEY_SIZE); @@ -202,5 +201,3 @@ nxt_random_unit_test(nxt_thread_t *thr) } #endif - -#endif |