mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-21 13:52:36 +00:00
Fix build with NOSSE2 (#1891)
* Fix build with NOSSE2 Disable AESNI and SHANI code that depends on SSE2 availability if NOSSE2 is enabled. * Fix NOSSE2 builds while preserving runtime AES acceleration Keep AES/Camellia acceleration enabled and honor NOSSE2 with NOAESNI. Include stddef.h outside UEFI to provide wchar_t for Camellia. Match the SHA probe guard to its implementation, keeping NOASM and UEFI exclusions. --------- Co-authored-by: Mounir IDRASSI <mounir.idrassi@amcrypto.jp>
This commit is contained in:
co-authored by
Mounir IDRASSI
parent
62253154cb
commit
a835875912
@@ -45,6 +45,9 @@
|
||||
|
||||
/* Adapted for VeraCrypt */
|
||||
|
||||
#if !defined(_UEFI)
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#include "Common/Crypto.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
+2
-2
@@ -290,9 +290,9 @@ static int Detect_MS_HyperV_AES ()
|
||||
|
||||
#endif
|
||||
|
||||
/* TrySHA256 lives in Sha2Intel.c, which omits it for _UEFI and CRYPTOPP_DISABLE_ASM */
|
||||
/* Keep this guard in sync with TrySHA256 in Sha2Intel.c. */
|
||||
#if !defined(_UEFI) && !defined(CRYPTOPP_DISABLE_ASM) && \
|
||||
(defined(__SHA__) || defined(__INTEL_COMPILER) || CRYPTOPP_SHANI_AVAILABLE)
|
||||
CRYPTOPP_SHANI_AVAILABLE
|
||||
#define TC_SHA256_PROBE_AVAILABLE
|
||||
extern int TrySHA256();
|
||||
#endif
|
||||
|
||||
+11
-6
@@ -234,6 +234,14 @@ ifeq "$(shell uname -s)" "Linux"
|
||||
LFLAGS += -Wl,-z,max-page-size=4096
|
||||
endif
|
||||
|
||||
# Keep NOAESNI consistent with assembler object selection even with NOSSE2.
|
||||
ifneq (,$(filter x86 x64,$(CPU_ARCH)))
|
||||
ifeq "$(DISABLE_AESNI)" "1"
|
||||
CFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI
|
||||
CXXFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq "$(SIMD_SUPPORTED)" "1"
|
||||
CFLAGS += -msse2
|
||||
CXXFLAGS += -msse2
|
||||
@@ -243,10 +251,7 @@ ifeq "$(shell uname -s)" "Linux"
|
||||
GCC_GTEQ_470 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40700)
|
||||
GCC_GTEQ_500 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 50000)
|
||||
|
||||
ifeq "$(DISABLE_AESNI)" "1"
|
||||
CFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI
|
||||
CXXFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI
|
||||
else
|
||||
ifeq "$(DISABLE_AESNI)" "0"
|
||||
ifeq "$(GCC_GTEQ_440)" "1"
|
||||
CFLAGS += -maes
|
||||
CXXFLAGS += -maes
|
||||
@@ -289,8 +294,8 @@ ifeq "$(shell uname -s)" "Linux"
|
||||
endif
|
||||
|
||||
ifeq "$(origin NOSSE2)" "command line"
|
||||
CFLAGS += -mno-sse2
|
||||
CXXFLAGS += -mno-sse2
|
||||
CFLAGS += -mno-sse2 -DCRYPTOPP_DISABLE_SHANI
|
||||
CXXFLAGS += -mno-sse2 -DCRYPTOPP_DISABLE_SHANI
|
||||
WXCONFIG_CFLAGS += -mno-sse2
|
||||
WXCONFIG_CXXFLAGS += -mno-sse2
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user