aboutsummaryrefslogtreecommitdiff
path: root/src/test/rng_test_helpers.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-03-18 09:37:13 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-04-30 11:11:39 -0400
commit11eaed66bbc2105942c26a2dc9e502ce77e08b69 (patch)
tree48bd314c661b5d267f52f9f5ada97a4c4dee6293 /src/test/rng_test_helpers.h
parentf021ca2d52da262e14706498190de5fe7859e00b (diff)
downloadtor-11eaed66bbc2105942c26a2dc9e502ce77e08b69.tar.gz
tor-11eaed66bbc2105942c26a2dc9e502ce77e08b69.zip
Add support for deterministic override of crypto_rand() in tests
We had this previously, but we did it differently in different places. This implementation is pulled from test_prob_distr.c
Diffstat (limited to 'src/test/rng_test_helpers.h')
-rw-r--r--src/test/rng_test_helpers.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/rng_test_helpers.h b/src/test/rng_test_helpers.h
new file mode 100644
index 0000000000..be95ec9d1d
--- /dev/null
+++ b/src/test/rng_test_helpers.h
@@ -0,0 +1,21 @@
+/* Copyright (c) 2017-2019, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_RNG_TEST_HELPERS_H
+#define TOR_RNG_TEST_HELPERS_H
+
+#include "core/or/or.h"
+
+void testing_enable_deterministic_rng(void);
+void testing_enable_reproducible_rng(void);
+
+void testing_disable_rng_override(void);
+
+#define testing_disable_reproducible_rng() \
+ testing_disable_rng_override()
+#define testing_disable_deterministic_rng() \
+ testing_disable_rng_override()
+
+void testing_dump_reproducible_rng_seed(void);
+
+#endif /* !defined(TOR_RNG_TEST_HELPERS_H) */