summaryrefslogtreecommitdiff
path: root/misc/unix/rand.c
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-02-24 04:29:21 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-02-24 04:29:21 +0000
commit08bac6ee5a23156a505f45cc69f5231c895a1450 (patch)
tree3858dcef9a574c63ae7895d3926eee2bdde8375a /misc/unix/rand.c
parent86b18cbc267e4bcc3a8957db50b6a11471187832 (diff)
downloadlibapr-08bac6ee5a23156a505f45cc69f5231c895a1450.tar.gz
OS/2: Add a crypto strength randomness generator.
Not highly sophisticated or efficient but passes every test I know of for unpredictability & generates mod_auth_digest's secret in negligible time. Critical comment from crypto experts is more than welcome. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61290 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc/unix/rand.c')
-rw-r--r--misc/unix/rand.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/misc/unix/rand.c b/misc/unix/rand.c
index ceb8c8ea6..71778c6fd 100644
--- a/misc/unix/rand.c
+++ b/misc/unix/rand.c
@@ -81,6 +81,13 @@ apr_status_t apr_generate_random_bytes(unsigned char * buf, int length)
close(rnd);
+#elif defined(OS2)
+ static UCHAR randbyte();
+ unsigned int idx;
+
+ for (idx=0; idx<length; idx++)
+ buf[idx] = randbyte();
+
#else /* use truerand */
extern int randbyte(void); /* from the truerand library */
@@ -99,4 +106,9 @@ apr_status_t apr_generate_random_bytes(unsigned char * buf, int length)
#undef STR
#undef XSTR
+
+#ifdef OS2
+#include "../os2/randbyte.c"
+#endif
+
#endif /* APR_HAS_RANDOM */