diff options
Diffstat (limited to 'src/lib/libcrypto/rand/rand_unix.c')
-rw-r--r-- | src/lib/libcrypto/rand/rand_unix.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index 71b98ec212..964d25833c 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
@@ -136,16 +136,10 @@ | |||
136 | #ifdef __OpenBSD__ | 136 | #ifdef __OpenBSD__ |
137 | int RAND_poll(void) | 137 | int RAND_poll(void) |
138 | { | 138 | { |
139 | u_int32_t rnd = 0, i; | ||
140 | unsigned char buf[ENTROPY_NEEDED]; | 139 | unsigned char buf[ENTROPY_NEEDED]; |
141 | 140 | ||
142 | for (i = 0; i < sizeof(buf); i++) { | 141 | arc4random_buf(buf, sizeof(buf)); |
143 | if (i % 4 == 0) | 142 | RAND_add(buf, sizeof(buf), sizeof(buf)); |
144 | rnd = arc4random(); | ||
145 | buf[i] = rnd; | ||
146 | rnd >>= 8; | ||
147 | } | ||
148 | RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); | ||
149 | memset(buf, 0, sizeof(buf)); | 143 | memset(buf, 0, sizeof(buf)); |
150 | 144 | ||
151 | return 1; | 145 | return 1; |
@@ -232,7 +226,7 @@ int RAND_poll(void) | |||
232 | t.tv_sec = 0; | 226 | t.tv_sec = 0; |
233 | t.tv_usec = usec; | 227 | t.tv_usec = usec; |
234 | 228 | ||
235 | if (FD_SETSIZE > 0 && (unsigned)fd >= FD_SETSIZE) | 229 | if (FD_SETSIZE > 0 && fd >= FD_SETSIZE) |
236 | { | 230 | { |
237 | /* can't use select, so just try to read once anyway */ | 231 | /* can't use select, so just try to read once anyway */ |
238 | try_read = 1; | 232 | try_read = 1; |