summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2006-04-11 21:34:21 +0000
committerUlf Möller <ulf@openssl.org>2006-04-11 21:34:21 +0000
commit4700aea951dcba9b1e3b724bf4d8f0c712578892 (patch)
treea30eb63c83db7085b9067633de5391267ce74881 /crypto/rand
parent60cdb821db3403481c891b570d163d28f041ec02 (diff)
Add BeOS support.
PR: 1312 Submitted by: Oliver Tappe <zooey@hirschkaefer.de> Reviewed by: Ulf Moeller
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/rand_egd.c2
-rw-r--r--crypto/rand/rand_unix.c20
2 files changed, 20 insertions, 2 deletions
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index 50bce6caba..d53b916ebe 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -95,7 +95,7 @@
* RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
*/
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS)
+#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS)
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{
return(-1);
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index c340642515..c4838b6b2e 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -205,6 +205,16 @@ int RAND_poll(void)
do
{
+#if defined(OPENSSL_SYS_BEOS_R5)
+ /* select() is broken in BeOS R5, so we simply
+ * try to read something and snooze if we couldn't: */
+ r=read(fd,(unsigned char *)tmpbuf+n,
+ ENTROPY_NEEDED-n);
+ if (r > 0)
+ n += r;
+ else if (r == 0)
+ snooze(t.tv_usec);
+#else
FD_ZERO(&fset);
FD_SET(fd, &fset);
r = -1;
@@ -218,7 +228,7 @@ int RAND_poll(void)
if (r > 0)
n += r;
}
-
+#endif
/* Some Unixen will update t, some
won't. For those who won't, give
up here, otherwise, we will do
@@ -267,6 +277,14 @@ int RAND_poll(void)
l=time(NULL);
RAND_add(&l,sizeof(l),0.0);
+#if defined(OPENSSL_SYS_BEOS)
+ {
+ system_info sysInfo;
+ get_system_info(&sysInfo);
+ RAND_add(&sysInfo,sizeof(sysInfo),0);
+ }
+#endif
+
#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
return 1;
#else