diff options
author | Jack Lloyd <[email protected]> | 2017-03-29 13:04:20 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-03-29 13:04:20 -0400 |
commit | 9124f6db6b22ea527f67238ee0bd41c9d20beef6 (patch) | |
tree | f4fac5ce20ab4a2b5fe2383843d69db1a56cc152 | |
parent | 379936037cca51ed247ac3e9ce27e01ff3ac8398 (diff) | |
parent | 2377e2b25c9daa61c7b8908bf99a5aaf794e799f (diff) |
Merge GH #949 Add --entropy flag to rng cmd
-rw-r--r-- | src/cli/utils.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp index c0af0332e..76501add4 100644 --- a/src/cli/utils.cpp +++ b/src/cli/utils.cpp @@ -10,6 +10,7 @@ #include <botan/hash.h> #include <botan/cpuid.h> #include <botan/hex.h> +#include <botan/entropy_src.h> #if defined(BOTAN_HAS_BASE64_CODEC) #include <botan/base64.h> @@ -156,7 +157,7 @@ BOTAN_REGISTER_COMMAND("hash", Hash); class RNG final : public Command { public: - RNG() : Command("rng --system --rdrand *bytes") {} + RNG() : Command("rng --system --rdrand --entropy *bytes") {} void go() override { @@ -180,6 +181,15 @@ class RNG final : public Command return; #endif } + else if(flag_set("entropy")) + { +#if defined(BOTAN_HAS_AUTO_SEEDING_RNG) + rng.reset(new Botan::AutoSeeded_RNG(Botan::Entropy_Sources::global_sources())); +#else + error_output() << "auto_rng disabled in build\n"; + return; +#endif + } else { #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) |