diff options
| author | markus <> | 2004-04-07 20:42:12 +0000 |
|---|---|---|
| committer | markus <> | 2004-04-07 20:42:12 +0000 |
| commit | 00b426069b0dfa8f0d9b87308646e9684f45c515 (patch) | |
| tree | 2eb0df944a8ed229c1d2a165679566e87ce34575 /src/lib/libcrypto/rand/rand_unix.c | |
| parent | fd84abe5019daf5a6869e1d12702e3e11b7a81bc (diff) | |
| download | openbsd-00b426069b0dfa8f0d9b87308646e9684f45c515.tar.gz openbsd-00b426069b0dfa8f0d9b87308646e9684f45c515.tar.bz2 openbsd-00b426069b0dfa8f0d9b87308646e9684f45c515.zip | |
import openssl-0.9.7d
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) |
