summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rand/rand_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rand/rand_unix.c')
-rw-r--r--src/lib/libcrypto/rand/rand_unix.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c
index e9ead3a529..4bb9666e49 100644
--- a/src/lib/libcrypto/rand/rand_unix.c
+++ b/src/lib/libcrypto/rand/rand_unix.c
@@ -179,16 +179,10 @@ int RAND_poll(void)
179#elif defined __OpenBSD__ 179#elif defined __OpenBSD__
180int RAND_poll(void) 180int RAND_poll(void)
181{ 181{
182 u_int32_t rnd = 0, i;
183 unsigned char buf[ENTROPY_NEEDED]; 182 unsigned char buf[ENTROPY_NEEDED];
184 183
185 for (i = 0; i < sizeof(buf); i++) { 184 arc4random_buf(buf, sizeof(buf));
186 if (i % 4 == 0) 185 RAND_add(buf, sizeof(buf), sizeof(buf));
187 rnd = arc4random();
188 buf[i] = rnd;
189 rnd >>= 8;
190 }
191 RAND_add(buf, sizeof(buf), ENTROPY_NEEDED);
192 memset(buf, 0, sizeof(buf)); 186 memset(buf, 0, sizeof(buf));
193 187
194 return 1; 188 return 1;