aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-11 16:15:42 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-13 12:35:22 -0400
commit27dd2b1f1ff612977ec50c9e15dbe14607b0551b (patch)
tree5dcdd426889c0651339816fcf0f1712e53b23b1b /src/test/fuzz
parentd811ce2421dcf1684db7e34f2b5998d9f360d5fb (diff)
downloadtor-27dd2b1f1ff612977ec50c9e15dbe14607b0551b.tar.gz
tor-27dd2b1f1ff612977ec50c9e15dbe14607b0551b.zip
Make nss get initialized before we fuzz anything.
Diffstat (limited to 'src/test/fuzz')
-rw-r--r--src/test/fuzz/fuzzing_common.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c
index 1222162bfa..1401e4c28d 100644
--- a/src/test/fuzz/fuzzing_common.c
+++ b/src/test/fuzz/fuzzing_common.c
@@ -7,8 +7,8 @@
#include "app/config/config.h"
#include "test/fuzz/fuzzing.h"
#include "lib/compress/compress.h"
-#include "lib/crypt_ops/crypto_cipher.h"
#include "lib/crypt_ops/crypto_ed25519.h"
+#include "lib/crypt_ops/crypto_init.h"
static or_options_t *mock_options = NULL;
static const or_options_t *
@@ -96,15 +96,20 @@ global_init(void)
{
tor_threads_init();
tor_compress_init();
- {
- struct sipkey sipkey = { 1337, 7331 };
- siphash_set_global_key(&sipkey);
- }
/* Initialise logging first */
init_logging(1);
configure_backtrace_handler(get_version());
+ if (crypto_global_init(0, NULL, NULL) < 0)
+ abort();
+
+ {
+ struct sipkey sipkey = { 1337, 7331 };
+ siphash_unset_global_key();
+ siphash_set_global_key(&sipkey);
+ }
+
/* set up the options. */
mock_options = tor_malloc_zero(sizeof(or_options_t));
MOCK(get_options, mock_get_options);