VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/cpu.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-20 17:43:35 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-21 01:39:55 +0200
commit70097ecfe54a9630e1e77fdc30204a5460228193 (patch)
treef43481a6ede0e0fcd81f8ba02006613d02d23032 /src/Crypto/cpu.c
parentee5c1784ea0ed1328f7607bf3ea619ef3bd96d03 (diff)
downloadVeraCrypt-70097ecfe54a9630e1e77fdc30204a5460228193.tar.gz
VeraCrypt-70097ecfe54a9630e1e77fdc30204a5460228193.zip
Crypto: Add optimized Camellia assembly implementation for x86_64 based on work by Jussi Kivilinna (https://github.com/jkivilin/supercop-blockciphers). This improve speed by a factor of 2.5 when AES-NI supported by CPU and by 30% if AES-NI not supported.
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 7a4656d4..5c74eca0 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_hasAVX2 = 0, g_hasBMI2 = 0, g_hasSSE42 = 0, g_hasSSE41 = 0;
+int g_hasAVX = 0, g_hasAVX2 = 0, g_hasBMI2 = 0, g_hasSSE42 = 0, g_hasSSE41 = 0, g_isIntel = 0, g_isAMD = 0;
uint32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
VC_INLINE int IsIntel(const uint32 output[4])
@@ -325,11 +325,13 @@ void DetectX86Features()
if (IsIntel(cpuid))
{
+ g_isIntel = 1;
g_isP4 = ((cpuid1[0] >> 8) & 0xf) == 0xf;
g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1);
}
else if (IsAMD(cpuid))
{
+ g_isAMD = 1;
CpuId(0x80000005, cpuid);
g_cacheLineSize = GETBYTE(cpuid[2], 0);
}