From b558ff83b6fe99a196d1c89185e7e9785b6b0bf6 Mon Sep 17 00:00:00 2001 From: djm <> Date: Wed, 10 Sep 2008 05:38:04 +0000 Subject: use one call to arc4random_buf() instead of lots of arc4random() --- src/lib/libcrypto/rand/rand_unix.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/lib/libcrypto/rand/rand_unix.c') diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index 6c2be5cb96..964d25833c 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c @@ -136,16 +136,10 @@ #ifdef __OpenBSD__ int RAND_poll(void) { - u_int32_t rnd = 0, i; unsigned char buf[ENTROPY_NEEDED]; - for (i = 0; i < sizeof(buf); i++) { - if (i % 4 == 0) - rnd = arc4random(); - buf[i] = rnd; - rnd >>= 8; - } - RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); + arc4random_buf(buf, sizeof(buf)); + RAND_add(buf, sizeof(buf), sizeof(buf)); memset(buf, 0, sizeof(buf)); return 1; -- cgit v1.2.3-55-g6feb