diff options
Diffstat (limited to 'src/lib/libcrypto/rand/rand_unix.c')
-rw-r--r-- | src/lib/libcrypto/rand/rand_unix.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index a776e52243..0599719dd1 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
@@ -124,6 +124,24 @@ | |||
124 | #include <unistd.h> | 124 | #include <unistd.h> |
125 | #include <time.h> | 125 | #include <time.h> |
126 | 126 | ||
127 | #ifdef __OpenBSD__ | ||
128 | int RAND_poll(void) | ||
129 | { | ||
130 | u_int32_t rnd = 0, i; | ||
131 | unsigned char buf[ENTROPY_NEEDED]; | ||
132 | |||
133 | for (i = 0; i < sizeof(buf); i++) { | ||
134 | if (i % 4 == 0) | ||
135 | rnd = arc4random(); | ||
136 | buf[i] = rnd; | ||
137 | rnd >>= 8; | ||
138 | } | ||
139 | RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); | ||
140 | memset(buf, 0, sizeof(buf)); | ||
141 | |||
142 | return 1; | ||
143 | } | ||
144 | #else | ||
127 | int RAND_poll(void) | 145 | int RAND_poll(void) |
128 | { | 146 | { |
129 | unsigned long l; | 147 | unsigned long l; |
@@ -236,6 +254,7 @@ int RAND_poll(void) | |||
236 | } | 254 | } |
237 | 255 | ||
238 | #endif | 256 | #endif |
257 | #endif | ||
239 | 258 | ||
240 | #if defined(OPENSSL_SYS_VXWORKS) | 259 | #if defined(OPENSSL_SYS_VXWORKS) |
241 | int RAND_poll(void) | 260 | int RAND_poll(void) |