mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Add check for buggy RDRAND (AMD Ryzen CPU case) even if we always use RDSEED instead of RDRAND when RDSEED is available (which is the case on modern CPUs)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "cpu.h"
|
||||
#include "misc.h"
|
||||
#include "rdrand.h"
|
||||
|
||||
#ifndef EXCEPTION_EXECUTE_HANDLER
|
||||
#define EXCEPTION_EXECUTE_HANDLER 1
|
||||
@@ -387,6 +388,18 @@ void DetectX86Features()
|
||||
}
|
||||
}
|
||||
|
||||
/* Add check fur buggy RDRAND (AMD Ryzen case) even if we always use RDSEED instead of RDRAND when RDSEED available */
|
||||
if (g_hasRDRAND)
|
||||
{
|
||||
if ( RDRAND_getBytes ((unsigned char*) cpuid, sizeof (cpuid))
|
||||
&& (cpuid[0] == 0xFFFFFFFF) && (cpuid[1] == 0xFFFFFFFF)
|
||||
&& (cpuid[2] == 0xFFFFFFFF) && (cpuid[3] == 0xFFFFFFFF)
|
||||
)
|
||||
{
|
||||
g_hasRDRAND = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_cacheLineSize)
|
||||
g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user