From 3f313ff9ef28f00cf7a4822d95eb0af29e3a5e41 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Mon, 13 Aug 2018 16:25:55 -0400 Subject: Expose RDRAND RNG through FFI --- src/lib/entropy/rdrand/rdrand.cpp | 6 +++--- src/lib/entropy/rdseed/rdseed.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/lib/entropy') diff --git a/src/lib/entropy/rdrand/rdrand.cpp b/src/lib/entropy/rdrand/rdrand.cpp index 6a5b0f7c4..b8a74ce2f 100644 --- a/src/lib/entropy/rdrand/rdrand.cpp +++ b/src/lib/entropy/rdrand/rdrand.cpp @@ -8,12 +8,12 @@ #include #include -#include namespace Botan { -size_t Intel_Rdrand::poll(RandomNumberGenerator& rng) { - if(CPUID::has_rdrand() && BOTAN_ENTROPY_INTEL_RNG_POLLS > 0) +size_t Intel_Rdrand::poll(RandomNumberGenerator& rng) + { + if(BOTAN_ENTROPY_INTEL_RNG_POLLS > 0 && RDRAND_RNG::available()) { RDRAND_RNG rdrand_rng; secure_vector buf(4 * BOTAN_ENTROPY_INTEL_RNG_POLLS); diff --git a/src/lib/entropy/rdseed/rdseed.cpp b/src/lib/entropy/rdseed/rdseed.cpp index fbb8f921e..fccc53f6a 100644 --- a/src/lib/entropy/rdseed/rdseed.cpp +++ b/src/lib/entropy/rdseed/rdseed.cpp @@ -15,7 +15,8 @@ namespace Botan { BOTAN_FUNC_ISA("rdseed") -size_t Intel_Rdseed::poll(RandomNumberGenerator& rng) { +size_t Intel_Rdseed::poll(RandomNumberGenerator& rng) + { if(CPUID::has_rdseed()) { for(size_t p = 0; p != BOTAN_ENTROPY_INTEL_RNG_POLLS; ++p) -- cgit v1.2.3