VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-10-30 08:08:38 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-10-30 08:09:45 (GMT)
commit3565cb1afe4f917422853e42d7dbe05526ab750b (patch)
tree3df9077f7fed3baaa3a770cad66b8750b7bf93ca
parent5ecff99edc9c342987ef59156c2358a4c24ce9b5 (diff)
downloadVeraCrypt-3565cb1afe4f917422853e42d7dbe05526ab750b.zip
VeraCrypt-3565cb1afe4f917422853e42d7dbe05526ab750b.tar.gz
Disable both RDRAND and RDSEED if a failure is detected
-rw-r--r--src/Crypto/cpu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c
index 33a9815..78cc715 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;
}
}