summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/rand/rand_unix.c
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2004-03-17 15:49:33 +0000
committernectar <nectar@FreeBSD.org>2004-03-17 15:49:33 +0000
commit0f095e8a2af65fdcbf4af38dc6a00383e2fd6b3f (patch)
treec6fe9e2dc64448f48fdaf5e0b2778005ccc1baac /crypto/openssl/crypto/rand/rand_unix.c
parente8232d78abaf5a170e34e0742d0042a65bcaafe4 (diff)
downloadFreeBSD-src-0f095e8a2af65fdcbf4af38dc6a00383e2fd6b3f.zip
FreeBSD-src-0f095e8a2af65fdcbf4af38dc6a00383e2fd6b3f.tar.gz
Vendor import of OpenSSL 0.9.7d.
Diffstat (limited to 'crypto/openssl/crypto/rand/rand_unix.c')
-rw-r--r--crypto/openssl/crypto/rand/rand_unix.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/openssl/crypto/rand/rand_unix.c b/crypto/openssl/crypto/rand/rand_unix.c
index a776e52..0599719 100644
--- a/crypto/openssl/crypto/rand/rand_unix.c
+++ b/crypto/openssl/crypto/rand/rand_unix.c
@@ -124,6 +124,24 @@
#include <unistd.h>
#include <time.h>
+#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);
+ memset(buf, 0, sizeof(buf));
+
+ return 1;
+}
+#else
int RAND_poll(void)
{
unsigned long l;
@@ -236,6 +254,7 @@ int RAND_poll(void)
}
#endif
+#endif
#if defined(OPENSSL_SYS_VXWORKS)
int RAND_poll(void)
OpenPOWER on IntegriCloud