From 3d62a083492e05eb200015a806fb441f8b30fb38 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 10 Sep 2008 05:38:05 +0000 Subject: use one call to arc4random_buf() instead of lots of arc4random() --- lib/libcrypto/rand/rand_unix.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'lib/libcrypto') diff --git a/lib/libcrypto/rand/rand_unix.c b/lib/libcrypto/rand/rand_unix.c index 6c2be5cb966..964d25833cd 100644 --- a/lib/libcrypto/rand/rand_unix.c +++ b/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