From 4e78e6ea5608edddda8929f3b43a978e89f927ba Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Tue, 19 Jul 2016 14:57:12 -0400 Subject: 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 --- src/cli/utils.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/cli') 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 #endif +#if defined(BOTAN_HAS_RDRAND_RNG) + #include +#endif + #if defined(BOTAN_HAS_HTTP_UTIL) #include #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 { @@ -162,6 +166,15 @@ class RNG final : public Command #else error_output() << "system_rng disabled in build\n"; 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 -- cgit v1.2.3