diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-30 09:08:38 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-30 09:09:45 +0100 |
commit | 3565cb1afe4f917422853e42d7dbe05526ab750b (patch) | |
tree | 3df9077f7fed3baaa3a770cad66b8750b7bf93ca /src | |
parent | 5ecff99edc9c342987ef59156c2358a4c24ce9b5 (diff) | |
download | VeraCrypt-3565cb1afe4f917422853e42d7dbe05526ab750b.tar.gz VeraCrypt-3565cb1afe4f917422853e42d7dbe05526ab750b.zip |
Disable both RDRAND and RDSEED if a failure is detected
Diffstat (limited to 'src')
-rw-r--r-- | src/Crypto/cpu.c | 13 |
1 files changed, 13 insertions, 0 deletions
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; } } |