sha/asm/keccak1600-x86_64.pl: add CFI directives.
[openssl.git] / crypto / mem.c
index aae92d41b11996148861b388a1a9eb8d64d67796..aa5ac56b472791ad512b1dd174e0be8ea3bdbd3a 100644 (file)
@@ -111,6 +111,14 @@ static void parseit(void)
         md_failstring = semi;
 }
 
+/*
+ * 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.
  */
@@ -162,7 +170,7 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
     if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
         return malloc_impl(num, file, line);
 
-    if (num <= 0)
+    if (num == 0)
         return NULL;
 
     FAILTEST();