summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2016-11-19 17:20:34 +0100
committerKurt Roeckx <kurt@roeckx.be>2016-12-03 00:14:15 +0100
commit3a9b9b2deb8e19fa10e7c3c99ad0baa2f90f13fa (patch)
tree4faca67f21f7e25488525076f6ed3ad70568870a /crypto
parent3a85d05fb3977ddc3b2f97cf4641b73e10bb952b (diff)
Make the random number generator predictable when fuzzing.
Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #2023
Diffstat (limited to 'crypto')
-rw-r--r--crypto/rand/md_rand.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c
index 85ce4e6f98..0cf6e90834 100644
--- a/crypto/rand/md_rand.c
+++ b/crypto/rand/md_rand.c
@@ -33,7 +33,7 @@
# include <openssl/fips.h>
#endif
-#ifdef BN_DEBUG
+#if defined(BN_DEBUG) || defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
# define PREDICT
#endif
@@ -307,7 +307,7 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo)
#ifdef PREDICT
if (rand_predictable) {
- static unsigned char val = 0;
+ unsigned char val = 0;
for (i = 0; i < num; i++)
buf[i] = val++;