diff options
author | lloyd <[email protected]> | 2008-10-27 15:54:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-27 15:54:02 +0000 |
commit | b33e8dec240005c50e8be3818d2ec250da8eeb17 (patch) | |
tree | db4063f8a00e3562eb31c543704cad42cc31f163 /checks | |
parent | fcac5f9181e170b1034d2018d7974c206cf65586 (diff) |
Use a single RNG in check/test code
Diffstat (limited to 'checks')
-rw-r--r-- | checks/check.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/checks/check.cpp b/checks/check.cpp index 36762786a..dfe77c39b 100644 --- a/checks/check.cpp +++ b/checks/check.cpp @@ -28,7 +28,7 @@ const std::string BIGINT_VALIDATION_FILE = "checks/mp_valid.dat"; const std::string PK_VALIDATION_FILE = "checks/pk_valid.dat"; const std::string EXPECTED_FAIL_FILE = "checks/fail.dat"; -int run_test_suite(); +int run_test_suite(RandomNumberGenerator& rng); namespace { @@ -102,7 +102,8 @@ int main(int argc, char* argv[]) Botan::InitializerOptions init_options(opts.value_if_set("init")); Botan::LibraryInitializer init(init_options); - //Botan::LibraryInitializer::initialize(init_options); + + Botan::AutoSeeded_RNG rng; if(opts.is_set("help") || argc <= 1) { @@ -120,7 +121,7 @@ int main(int argc, char* argv[]) } else if(opts.is_set("validate") || opts.is_set("test")) { - run_test_suite(); + run_test_suite(rng); } if(opts.is_set("bench-algo") || opts.is_set("benchmark") || @@ -140,8 +141,6 @@ int main(int argc, char* argv[]) const bool html = opts.is_set("html"); - AutoSeeded_RNG rng; - if(opts.is_set("benchmark")) { benchmark("All", rng, html, seconds); @@ -181,8 +180,6 @@ int main(int argc, char* argv[]) std::cerr << "Unknown --bench-type " << type << "\n"; } } - - Botan::set_global_state(0); } catch(std::exception& e) { @@ -196,15 +193,13 @@ int main(int argc, char* argv[]) return 0; } -int run_test_suite() +int run_test_suite(RandomNumberGenerator& rng) { std::cout << "Beginning tests..." << std::endl; u32bit errors = 0; try { - AutoSeeded_RNG rng; - errors += do_validation_tests(VALIDATION_FILE, rng); errors += do_validation_tests(EXPECTED_FAIL_FILE, rng, false); errors += do_bigint_tests(BIGINT_VALIDATION_FILE, rng); |