aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/entropy
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-08-13 16:25:55 -0400
committerJack Lloyd <[email protected]>2018-08-13 16:25:55 -0400
commit3f313ff9ef28f00cf7a4822d95eb0af29e3a5e41 (patch)
treee37a511f6fb9824ab201eeefd1479205ade86d3f /src/lib/entropy
parentb34fc175d8a5bef2ab148afef9e5aa4faf1d392f (diff)
Expose RDRAND RNG through FFI
Diffstat (limited to 'src/lib/entropy')
-rw-r--r--src/lib/entropy/rdrand/rdrand.cpp6
-rw-r--r--src/lib/entropy/rdseed/rdseed.cpp3
2 files changed, 5 insertions, 4 deletions
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 <botan/internal/rdrand.h>
#include <botan/rdrand_rng.h>
-#include <botan/cpuid.h>
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<uint8_t> 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)