diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2016-12-02 19:34:54 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2016-12-03 00:14:15 +0100 |
commit | d69d8f904c9c558c7a9455ee816e494690d80ca8 (patch) | |
tree | 727e69f282ae7e060371ed0d0cff2d22e4fec7c4 /fuzz/cms.c | |
parent | Move libfuzzer sanitizer options to README (diff) | |
download | openssl-d69d8f904c9c558c7a9455ee816e494690d80ca8.tar.xz openssl-d69d8f904c9c558c7a9455ee816e494690d80ca8.zip |
Make the fuzzers more reproducible
We want to be in the same global state each time we come in
FuzzerTestOneInput(). There are various reasons why we might not be that
include:
- Initialization that happens on first use. This is mostly the
RUN_ONCE() things, or loading of error strings.
- Results that get cached. For instance a stack that is sorted, RSA
blinding that has been set up, ...
So I try to trigger as much as possible in FuzzerInitialize(), and for
things I didn't find out how to trigger this it needs to happen in
FuzzerTestOneInput().
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2023
Diffstat (limited to 'fuzz/cms.c')
-rw-r--r-- | fuzz/cms.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fuzz/cms.c b/fuzz/cms.c index b57a6de96a..959ef9365a 100644 --- a/fuzz/cms.c +++ b/fuzz/cms.c @@ -14,10 +14,14 @@ #include <openssl/bio.h> #include <openssl/cms.h> +#include <openssl/err.h> #include "fuzzer.h" int FuzzerInitialize(int *argc, char ***argv) { + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); + ERR_get_state(); + CRYPTO_free_ex_index(0, -1); return 1; } @@ -41,6 +45,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len) } BIO_free(in); + ERR_clear_error(); return 0; } |