summaryrefslogtreecommitdiffstats
path: root/crypto/mem.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2017-06-27 11:25:03 +0200
committerRichard Levitte <levitte@openssl.org>2017-06-28 22:15:02 +0200
commitafe9bba749b9fd897b7e7d416d904852d867d2c2 (patch)
tree5336e153fc3ddc912e74215a4a69e3eff90c9538 /crypto/mem.c
parentssl_session_dup() missing ext.alpn_session (diff)
downloadopenssl-afe9bba749b9fd897b7e7d416d904852d867d2c2.tar.xz
openssl-afe9bba749b9fd897b7e7d416d904852d867d2c2.zip
crypto/mem.c: on Windows, use rand() instead of random()
Windows doesn't provide random(). In this particular case, our requirements on the quality of randomness isn't high, so we don't need to care how good randomness rand() does or doesn't provide. Fixes #3778 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3779)
Diffstat (limited to 'crypto/mem.c')
-rw-r--r--crypto/mem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/mem.c b/crypto/mem.c
index 0584814f73..aa5ac56b47 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -112,6 +112,14 @@ static void parseit(void)
}
/*
+ * Windows doesn't have random(), but it has rand()
+ * Some rand() implementations aren't good, but we're not
+ * dealing with secure randomness here.
+ */
+#ifdef _WIN32
+# define random() rand()
+#endif
+/*
* See if the current malloc should fail.
*/
static int shouldfail(void)