VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/cpu.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-10-13 10:11:02 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-10-17 18:40:33 +0200
commit15b6c7d3b7e2726b71be3331e881863eb7602826 (patch)
tree3c492fc587cfc8ea0c4effc3312cdc704ec93ee4 /src/Crypto/cpu.c
parent2edd12fe22946cce7ef4cf588e8f31faf745b5f4 (diff)
downloadVeraCrypt-15b6c7d3b7e2726b71be3331e881863eb7602826.tar.gz
VeraCrypt-15b6c7d3b7e2726b71be3331e881863eb7602826.zip
Implement detection of new CPU features: AVX2 and BMI2
Diffstat (limited to 'src/Crypto/cpu.c')
-rw-r--r--src/Crypto/cpu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c
index ed1f5933..7a4656d4 100644
--- a/src/Crypto/cpu.c
+++ b/src/Crypto/cpu.c
@@ -189,7 +189,7 @@ static int TrySSE2()
int g_x86DetectionDone = 0;
int g_hasISSE = 0, g_hasSSE2 = 0, g_hasSSSE3 = 0, g_hasMMX = 0, g_hasAESNI = 0, g_hasCLMUL = 0, g_isP4 = 0;
-int g_hasAVX = 0, g_hasSSE42 = 0, g_hasSSE41 = 0;
+int g_hasAVX = 0, g_hasAVX2 = 0, g_hasBMI2 = 0, g_hasSSE42 = 0, g_hasSSE41 = 0;
uint32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
VC_INLINE int IsIntel(const uint32 output[4])
@@ -292,6 +292,8 @@ void DetectX86Features()
g_hasMMX = (cpuid1[3] & (1 << 23)) != 0;
if ((cpuid1[3] & (1 << 26)) != 0)
g_hasSSE2 = TrySSE2();
+ g_hasAVX2 = g_hasSSE2 && (cpuid1[1] & (1 << 5));
+ g_hasBMI2 = g_hasSSE2 && (cpuid1[1] & (1 << 8));
g_hasAVX = g_hasSSE2 && (cpuid1[2] & (1 << 28));
g_hasSSE42 = g_hasSSE2 && (cpuid1[2] & (1 << 20));
g_hasSSE41 = g_hasSSE2 && (cpuid1[2] & (1 << 19));