diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2016-11-19 17:20:34 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2016-12-03 00:14:15 +0100 |
commit | 3a9b9b2deb8e19fa10e7c3c99ad0baa2f90f13fa (patch) | |
tree | 4faca67f21f7e25488525076f6ed3ad70568870a /fuzz | |
parent | 3a85d05fb3977ddc3b2f97cf4641b73e10bb952b (diff) |
Make the random number generator predictable when fuzzing.
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2023
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/README.md | 3 | ||||
-rw-r--r-- | fuzz/server.c | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/fuzz/README.md b/fuzz/README.md index c5a1ba9c9a..d0c30f4461 100644 --- a/fuzz/README.md +++ b/fuzz/README.md @@ -38,7 +38,8 @@ Configure for fuzzing: $ CC=clang ./config enable-fuzz-libfuzzer \ --with-fuzzer-include=../../svn-work/Fuzzer \ --with-fuzzer-lib=../../svn-work/Fuzzer/libFuzzer \ - -DPEDANTIC enable-asan enable-ubsan no-shared + -DPEDANTIC enable-asan enable-ubsan no-shared \ + -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $ sudo apt-get install make $ LDCMD=clang++ make -j $ fuzz/helper.py $FUZZER 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; } |