VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/cpu.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-01 00:58:55 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-01 01:56:32 +0200
commitf5e6136830b4c1e02327d1767030181364651e40 (patch)
tree6f6e8d81a373a92d5ecd7d92ee31accfc2a59448 /src/Crypto/cpu.c
parent33bb507fdeb0ca01725ad76f70dc00a7c154ed13 (diff)
downloadVeraCrypt-f5e6136830b4c1e02327d1767030181364651e40.tar.gz
VeraCrypt-f5e6136830b4c1e02327d1767030181364651e40.zip
For code logic clarity, add check for xgetbv support in CPU before using it.
Diffstat (limited to 'src/Crypto/cpu.c')
-rw-r--r--src/Crypto/cpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c
index a9c6e926..7ec5b988 100644
--- a/src/Crypto/cpu.c
+++ b/src/Crypto/cpu.c
@@ -305,7 +305,7 @@ void DetectX86Features()
g_hasMMX = (cpuid1[3] & (1 << 23)) != 0;
if ((cpuid1[3] & (1 << 26)) != 0)
g_hasSSE2 = TrySSE2();
- if (g_hasSSE2 && (cpuid1[2] & (1 << 28)) && (cpuid1[2] & (1 << 27))) /* CPU has AVX and OS supports XSAVE/XRSTORE */
+ if (g_hasSSE2 && (cpuid1[2] & (1 << 28)) && (cpuid1[2] & (1 << 27)) && (cpuid1[2] & (1 << 26))) /* CPU has AVX and OS supports XSAVE/XRSTORE */
{
uint64 xcrFeatureMask = xgetbv();
g_hasAVX = (xcrFeatureMask & 0x6) == 0x6;