Disable both RDRAND and RDSEED if a failure is detected

This commit is contained in:
Mounir IDRASSI 2019-10-30 09:08:38 +01:00
parent 5ecff99edc
commit 3565cb1afe
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F
1 changed files with 13 additions and 0 deletions

View File

@ -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;
}
}