#include "core/or/or.h"
#include "lib/crypt_ops/crypto_rand.h"
+#include "ext/tinytest.h"
#include "test/rng_test_helpers.h"
static crypto_xof_t *rng_xof = NULL;
/**
- * Print the seed for our PRNG to stdout. We use this when we're
+ * Print the seed for our PRNG to stdout. We use this when we're failed
+ * test that had a reproducible RNG set.
**/
void
testing_dump_reproducible_rng_seed(void)
rng_is_replaced = false;
}
+
+/**
+ * As testing_disable_rng_override(), but dump the seed if the current
+ * test has failed.
+ */
+void
+testing_disable_reproducible_rng(void)
+{
+ if (tinytest_cur_test_has_failed()) {
+ testing_dump_reproducible_rng_seed();
+ }
+ testing_disable_rng_override();
+}
void testing_disable_rng_override(void);
-#define testing_disable_reproducible_rng() \
- testing_disable_rng_override()
+void testing_disable_reproducible_rng(void);
#define testing_disable_deterministic_rng() \
testing_disable_rng_override()
#define testing_disable_prefilled_rng() \