diff options
author | 2008-09-10 05:38:04 +0000 | |
---|---|---|
committer | 2008-09-10 05:38:04 +0000 | |
commit | 49e30e15030c23471986e8b3175c9ebebab43cab (patch) | |
tree | f20f4c567e88b082832f19555176ed274a468221 /lib/libcrypto/rand/rand_unix.c | |
parent | 40-bit GART support for PCIE devices. From drm git a while ago. (diff) | |
download | wireguard-openbsd-49e30e15030c23471986e8b3175c9ebebab43cab.tar.xz wireguard-openbsd-49e30e15030c23471986e8b3175c9ebebab43cab.zip |
use one call to arc4random_buf() instead of lots of arc4random()
Diffstat (limited to 'lib/libcrypto/rand/rand_unix.c')
-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; |