aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-12-28 13:23:40 +0000
committerlloyd <[email protected]>2014-12-28 13:23:40 +0000
commit6322dc69fcf9f3effed4e51de90b3f5b163db47e (patch)
tree6cc5a7b12b5a6648f53b4b22003f9a28b425d1fa /src/tests/tests.cpp
parent69d883e83569dd81f02fbbd7dfbdcfc5a3918d49 (diff)
All tests now share an RNG. Uses system RNG if available
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r--src/tests/tests.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 99a4d8e3a..9ed6785bc 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -2,10 +2,26 @@
#include <botan/init.h>
#include <iostream>
#include <fstream>
+#include <botan/auto_rng.h>
+
+#if defined(BOTAN_HAS_SYSTEM_RNG)
+ #include <botan/system_rng.h>
+#endif
+
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
+Botan::RandomNumberGenerator& test_rng()
+ {
+#if defined(BOTAN_HAS_SYSTEM_RNG)
+ return Botan::system_rng();
+#else
+ static AutoSeeded_RNG rng;
+ return rng;
+#endif
+ }
+
std::vector<std::string> list_dir(const std::string& dir_path)
{
std::vector<std::string> paths;