diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2006-10-04 01:17:23 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2006-10-04 01:17:23 +0000 |
| commit | f68412f9277c88fe0458068bcf22dc9d385fb379 (patch) | |
| tree | 7013a99312e56648ee066eb4b36a8b4a7e5f0465 /lib | |
| parent | aed19ad525bb1f287a3b21fcd66474bb27196916 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/gen/arc4random.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/arc4random.c b/lib/libc/gen/arc4random.c index e2448d56cbe9..52e28adbe27e 100644 --- a/lib/libc/gen/arc4random.c +++ b/lib/libc/gen/arc4random.c @@ -61,6 +61,7 @@ static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; static struct arc4_stream rs; static int rs_initialized; static int rs_stired; +static int arc4_count; static inline u_int8_t arc4_getbyte(struct arc4_stream *); static void arc4_stir(struct arc4_stream *); @@ -127,7 +128,8 @@ arc4_stir(as) * by Ilya Mironov. */ for (n = 0; n < 1024; n++) - arc4_getbyte(as); + (void) arc4_getbyte(as); + arc4_count = 400000; } static inline u_int8_t @@ -172,7 +174,7 @@ arc4_check_init(void) static void arc4_check_stir(void) { - if (!rs_stired) { + if (!rs_stired || --arc4_count == 0) { arc4_stir(&rs); rs_stired = 1; } |
