diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2008-09-10 05:38:05 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2008-09-10 05:38:05 +0000 |
commit | 3d62a083492e05eb200015a806fb441f8b30fb38 (patch) | |
tree | 79005a4638b6593a4c8d7721a753def504a1c5ee /lib/libcrypto | |
parent | b89fcf1291cf777ec4a06f3617d0df179ac1ef18 (diff) |
use one call to arc4random_buf() instead of lots of arc4random()
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/rand/rand_unix.c | 10 |
1 files changed, 2 insertions, 8 deletions
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; |