From 3565cb1afe4f917422853e42d7dbe05526ab750b Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 30 Oct 2019 09:08:38 +0100 Subject: Disable both RDRAND and RDSEED if a failure is detected --- src/Crypto/cpu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Crypto') diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c index 33a9815e..78cc715a 100644 --- a/src/Crypto/cpu.c +++ b/src/Crypto/cpu.c @@ -397,6 +397,19 @@ void DetectX86Features() ) { g_hasRDRAND = 0; + g_hasRDSEED = 0; + } + } + + if (g_hasRDSEED) + { + if ( RDSEED_getBytes ((unsigned char*) cpuid, sizeof (cpuid)) + && (cpuid[0] == 0xFFFFFFFF) && (cpuid[1] == 0xFFFFFFFF) + && (cpuid[2] == 0xFFFFFFFF) && (cpuid[3] == 0xFFFFFFFF) + ) + { + g_hasRDRAND = 0; + g_hasRDSEED = 0; } } -- cgit v1.2.3