diff options
author | Jack Lloyd <[email protected]> | 2016-07-19 14:57:12 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-19 14:57:12 -0400 |
commit | 4e78e6ea5608edddda8929f3b43a978e89f927ba (patch) | |
tree | b2da95ad40377650878f1b1218ec6e8bea3e6c5b /src/cli/utils.cpp | |
parent | 308c7d5eda678566edd26e9ab20edbe772f46363 (diff) |
Add RDRAND_RNG
For those that are willing to trust uninspectible hardware. :)
Changes RDRAND entropy source to call RDRAND_RNG
Add --rdrand flag to rng cmdlet
Diffstat (limited to 'src/cli/utils.cpp')
-rw-r--r-- | src/cli/utils.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp index 76e445126..b0d364581 100644 --- a/src/cli/utils.cpp +++ b/src/cli/utils.cpp @@ -20,6 +20,10 @@ #include <botan/system_rng.h> #endif +#if defined(BOTAN_HAS_RDRAND_RNG) + #include <botan/rdrand_rng.h> +#endif + #if defined(BOTAN_HAS_HTTP_UTIL) #include <botan/http_util.h> #endif @@ -149,7 +153,7 @@ BOTAN_REGISTER_COMMAND("hash", Hash); class RNG final : public Command { public: - RNG() : Command("rng --system *bytes") {} + RNG() : Command("rng --system --rdrand *bytes") {} void go() override { @@ -164,6 +168,15 @@ class RNG final : public Command return; #endif } + else if(flag_set("rdrand")) + { +#if defined(BOTAN_HAS_RDRAND_RNG) + rng.reset(new Botan::RDRAND_RNG); +#else + error_output() << "rdrand_rng disabled in build\n"; + return; +#endif + } else { rng.reset(new Botan::AutoSeeded_RNG); |