aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-12-02 13:33:10 +0000
committerlloyd <[email protected]>2014-12-02 13:33:10 +0000
commit2f884827b2aa1b070795230ebe012f1708ded73a (patch)
treebb13325a9254f210bd7cc4dd50b22b6957c48800 /src/cmd
parente78801f8c8a168d70ae06769ec6996c4e0da122f (diff)
Add an easy way to directly use the system PRNG.
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/rng.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/rng.cpp b/src/cmd/rng.cpp
index 187fbad1e..0fdec2019 100644
--- a/src/cmd/rng.cpp
+++ b/src/cmd/rng.cpp
@@ -7,6 +7,10 @@
#include "apps.h"
#include <botan/libstate.h>
+#if defined(BOTAN_HAS_SYSTEM_RNG)
+ #include <botan/system_rng.h>
+#endif
+
namespace {
int rng(int argc, char* argv[])
@@ -22,6 +26,10 @@ int rng(int argc, char* argv[])
const size_t amt = to_u32bit(argv[argc-1]);
const bool raw = (argc == 3 && std::string(argv[1]) == "--raw-entropy");
+#if defined(BOTAN_HAS_SYSTEM_RNG)
+ std::cout << "System " << hex_encode(system_rng().random_vec(amt)) << "\n";
+#endif
+
if(!raw)
{
AutoSeeded_RNG rng;