summaryrefslogtreecommitdiffstats
path: root/fuzz/server.c
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 /fuzz/server.c
parentUse 8bit-counters when using libfuzzer (diff)
downloadopenssl-3a9b9b2deb8e19fa10e7c3c99ad0baa2f90f13fa.tar.xz
openssl-3a9b9b2deb8e19fa10e7c3c99ad0baa2f90f13fa.zip
Make the random number generator predictable when fuzzing.
Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #2023
Diffstat (limited to 'fuzz/server.c')
-rw-r--r--fuzz/server.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fuzz/server.c b/fuzz/server.c
index b8a3ac44e3..4f2c794a4c 100644
--- a/fuzz/server.c
+++ b/fuzz/server.c
@@ -191,6 +191,10 @@ static const uint8_t kRSAPrivateKeyDER[] = {
static SSL_CTX *ctx;
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+extern int rand_predictable;
+#endif
+
int FuzzerInitialize(int *argc, char ***argv)
{
const uint8_t *bufp = kRSAPrivateKeyDER;
@@ -214,6 +218,10 @@ int FuzzerInitialize(int *argc, char ***argv)
OPENSSL_assert(ret == 1);
X509_free(cert);
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+ rand_predictable = 1;
+#endif
+
return 1;
}