Support Base Implementation + SIMD implementation on Solaris (PR #461)
parent
b57f7f0ae0
commit
5c6a32ba0f
229
GNUmakefile
229
GNUmakefile
|
|
@ -165,28 +165,22 @@ ifeq ($(IS_X86)$(IS_X32)$(IS_CYGWIN)$(IS_MINGW)$(SUN_COMPILER),00000)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# .intel_syntax wasn't supported until GNU assembler 2.10
|
# .intel_syntax wasn't supported until GNU assembler 2.10
|
||||||
# No DISABLE_NATIVE_ARCH with CRYPTOPP_DISABLE_ASM for now
|
|
||||||
# See http://github.com/weidai11/cryptopp/issues/395
|
|
||||||
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
||||||
ifeq ($(HAVE_GAS)$(GAS210_OR_LATER),10)
|
ifeq ($(HAVE_GAS)$(GAS210_OR_LATER),10)
|
||||||
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
||||||
DISABLE_NATIVE_ARCH := 1
|
|
||||||
else
|
else
|
||||||
ifeq ($(HAVE_GAS)$(GAS217_OR_LATER),10)
|
ifeq ($(HAVE_GAS)$(GAS217_OR_LATER),10)
|
||||||
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
|
||||||
DISABLE_NATIVE_ARCH := 1
|
|
||||||
else
|
else
|
||||||
ifeq ($(HAVE_GAS)$(GAS218_OR_LATER),10)
|
ifeq ($(HAVE_GAS)$(GAS218_OR_LATER),10)
|
||||||
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
|
||||||
DISABLE_NATIVE_ARCH := 1
|
|
||||||
else
|
else
|
||||||
ifeq ($(HAVE_GAS)$(GAS219_OR_LATER),10)
|
ifeq ($(HAVE_GAS)$(GAS219_OR_LATER),10)
|
||||||
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
|
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
|
||||||
DISABLE_NATIVE_ARCH := 1
|
|
||||||
else
|
else
|
||||||
ifeq ($(HAVE_GAS)$(GAS223_OR_LATER),10)
|
ifeq ($(HAVE_GAS)$(GAS223_OR_LATER),10)
|
||||||
CXXFLAGS += -DCRYPTOPP_DISABLE_SHA
|
CXXFLAGS += -DCRYPTOPP_DISABLE_SHA
|
||||||
DISABLE_NATIVE_ARCH := 1
|
|
||||||
endif # -DCRYPTOPP_DISABLE_SHA
|
endif # -DCRYPTOPP_DISABLE_SHA
|
||||||
endif # -DCRYPTOPP_DISABLE_AESNI
|
endif # -DCRYPTOPP_DISABLE_AESNI
|
||||||
endif # -DCRYPTOPP_DISABLE_SSE4
|
endif # -DCRYPTOPP_DISABLE_SSE4
|
||||||
|
|
@ -225,33 +219,57 @@ endif # -DCRYPTOPP_DISABLE_AESNI
|
||||||
endif # -DCRYPTOPP_DISABLE_SSE4
|
endif # -DCRYPTOPP_DISABLE_SSE4
|
||||||
endif # -DCRYPTOPP_DISABLE_SSSE3
|
endif # -DCRYPTOPP_DISABLE_SSSE3
|
||||||
|
|
||||||
ifneq ($(INTEL_COMPILER),0)
|
# Begin SunCC
|
||||||
CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
|
ifeq ($(SUN_COMPILER),1)
|
||||||
ifeq ($(ICC111_OR_LATER),0)
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=ssse3 -xdumpmacros /dev/null 2>&1 | $(EGREP) -i -c "illegal value ignored")
|
||||||
# "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and some x64 inline assembly with ICC 11.0
|
ifeq ($(COUNT),0)
|
||||||
# if you want to use Crypto++'s assembly code with ICC, try enabling it on individual files
|
SSSE3_FLAG = -xarch=ssse3 -D__SSSE3__=1
|
||||||
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
ARIA_FLAG = -xarch=ssse3 -D__SSSE3__=1
|
||||||
|
endif
|
||||||
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=sse4_2 -xdumpmacros /dev/null 2>&1 | $(EGREP) -i -c "illegal value ignored")
|
||||||
|
ifeq ($(COUNT),0)
|
||||||
|
BLAKE2_FLAG = -xarch=sse4_2 -D__SSE4_2__=1
|
||||||
|
CRC_FLAG = -xarch=sse4_2 -D__SSE4_2__=1
|
||||||
|
endif
|
||||||
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=aes -xdumpmacros /dev/null 2>&1 | $(EGREP) -i -c "illegal value ignored")
|
||||||
|
ifeq ($(COUNT),0)
|
||||||
|
GCM_FLAG = -xarch=aes -D__PCLMUL__=1
|
||||||
|
AES_FLAG = -xarch=aes -D__AES__=1
|
||||||
|
endif
|
||||||
|
COUNT := $(shell $(CXX) $(CXXFLAGS) -E -xarch=sha -xdumpmacros /dev/null 2>&1 | $(EGREP) -i -c "illegal value ignored")
|
||||||
|
ifeq ($(COUNT),0)
|
||||||
|
SHA_FLAG = -xarch=sha -D__SHA__=1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
# End SunCC
|
||||||
|
|
||||||
|
ifneq ($(INTEL_COMPILER),0)
|
||||||
|
CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
|
||||||
|
ifeq ($(ICC111_OR_LATER),0)
|
||||||
|
# "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and some x64 inline assembly with ICC 11.0
|
||||||
|
# if you want to use Crypto++'s assembly code with ICC, try enabling it on individual files
|
||||||
|
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Tell MacPorts GCC to use Clang integrated assembler
|
# Tell MacPorts GCC to use Clang integrated assembler
|
||||||
# http://github.com/weidai11/cryptopp/issues/190
|
# http://github.com/weidai11/cryptopp/issues/190
|
||||||
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER),11)
|
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER),11)
|
||||||
ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
|
ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -Wa,-q
|
CXXFLAGS += -Wa,-q
|
||||||
endif
|
endif
|
||||||
ifeq ($(findstring -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER,$(CXXFLAGS)),)
|
||||||
CLANG_INTEGRATED_ASSEMBLER := 1
|
CLANG_INTEGRATED_ASSEMBLER := 1
|
||||||
CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1
|
CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# GCC on Solaris needs -m64. Otherwise, i386 is default
|
# GCC on Solaris needs -m64. Otherwise, i386 is default
|
||||||
# http://github.com/weidai11/cryptopp/issues/230
|
# http://github.com/weidai11/cryptopp/issues/230
|
||||||
ifeq ($(IS_SUN)$(GCC_COMPILER)$(IS_X64),111)
|
ifeq ($(IS_SUN)$(GCC_COMPILER)$(IS_X64),111)
|
||||||
ifeq ($(findstring -m32,$(CXXFLAGS)),)
|
ifeq ($(findstring -m32,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -m64
|
CXXFLAGS += -m64
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Allow use of "/" operator for GNU Assembler.
|
# Allow use of "/" operator for GNU Assembler.
|
||||||
|
|
@ -369,9 +387,6 @@ CXXFLAGS += -m64
|
||||||
else ifeq ($(IS_64),0)
|
else ifeq ($(IS_64),0)
|
||||||
CXXFLAGS += -m32
|
CXXFLAGS += -m32
|
||||||
endif
|
endif
|
||||||
ifneq ($(SUNCC_513_OR_LATER),0)
|
|
||||||
CXXFLAGS += -native
|
|
||||||
endif
|
|
||||||
# Add for non-i386
|
# Add for non-i386
|
||||||
ifneq ($(IS_X86),1)
|
ifneq ($(IS_X86),1)
|
||||||
CXXFLAGS += -KPIC
|
CXXFLAGS += -KPIC
|
||||||
|
|
@ -405,117 +420,121 @@ endif # No ASM
|
||||||
|
|
||||||
# Native build testing. Issue 'make native'.
|
# Native build testing. Issue 'make native'.
|
||||||
ifeq ($(findstring native,$(MAKECMDGOALS)),native)
|
ifeq ($(findstring native,$(MAKECMDGOALS)),native)
|
||||||
ifeq ($(findstring -march=native,$(CXXFLAGS)),)
|
ifeq ($(findstring -march=native,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -march=native
|
ifeq ($(IS_SUN)$(SUN_COMPILER),11)
|
||||||
endif # CXXFLAGS
|
CXXFLAGS += -native
|
||||||
|
else
|
||||||
|
CXXFLAGS += -march=native
|
||||||
|
endif # CXXFLAGS
|
||||||
|
endif # Sun
|
||||||
endif # Native
|
endif # Native
|
||||||
|
|
||||||
# Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
|
# Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
|
||||||
ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
|
ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
|
||||||
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
||||||
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
||||||
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
||||||
ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
|
ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -fsanitize=undefined
|
CXXFLAGS += -fsanitize=undefined
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
endif # UBsan
|
endif # UBsan
|
||||||
|
|
||||||
# Address Sanitizer (Asan) testing. Issue 'make asan'.
|
# Address Sanitizer (Asan) testing. Issue 'make asan'.
|
||||||
ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
|
ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
|
||||||
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
||||||
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
||||||
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
||||||
ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
|
ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -fsanitize=address
|
CXXFLAGS += -fsanitize=address
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
|
ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -fno-omit-frame-pointer
|
CXXFLAGS += -fno-omit-frame-pointer
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
endif # Asan
|
endif # Asan
|
||||||
|
|
||||||
# LD gold linker testing. Triggered by 'LD=ld.gold'.
|
# LD gold linker testing. Triggered by 'LD=ld.gold'.
|
||||||
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
|
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
|
||||||
ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
|
ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
|
||||||
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(EGREP) -i -c "elf")
|
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(EGREP) -i -c "elf")
|
||||||
ifneq ($(ELF_FORMAT),0)
|
ifneq ($(ELF_FORMAT),0)
|
||||||
LDFLAGS += -fuse-ld=gold
|
LDFLAGS += -fuse-ld=gold
|
||||||
endif # ELF/ELF64
|
endif # ELF/ELF64
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
endif # Gold
|
endif # Gold
|
||||||
|
|
||||||
# lcov code coverage. Issue 'make coverage'.
|
# lcov code coverage. Issue 'make coverage'.
|
||||||
ifneq ($(filter lcov coverage,$(MAKECMDGOALS)),)
|
ifneq ($(filter lcov coverage,$(MAKECMDGOALS)),)
|
||||||
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
||||||
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
||||||
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
||||||
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
||||||
endif # CRYPTOPP_COVERAGE
|
endif # CRYPTOPP_COVERAGE
|
||||||
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -coverage
|
CXXFLAGS += -coverage
|
||||||
endif # -coverage
|
endif # -coverage
|
||||||
endif # GCC code coverage
|
endif # GCC code coverage
|
||||||
|
|
||||||
# gcov code coverage for Travis. Issue 'make codecov'.
|
# gcov code coverage for Travis. Issue 'make codecov'.
|
||||||
ifneq ($(filter gcov codecov,$(MAKECMDGOALS)),)
|
ifneq ($(filter gcov codecov,$(MAKECMDGOALS)),)
|
||||||
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
||||||
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
||||||
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
||||||
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
CXXFLAGS += -DCRYPTOPP_COVERAGE
|
||||||
endif # CRYPTOPP_COVERAGE
|
endif # CRYPTOPP_COVERAGE
|
||||||
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -coverage
|
CXXFLAGS += -coverage
|
||||||
endif # -coverage
|
endif # -coverage
|
||||||
endif # GCC code coverage
|
endif # GCC code coverage
|
||||||
|
|
||||||
# Valgrind testing. Issue 'make valgrind'.
|
# Valgrind testing. Issue 'make valgrind'.
|
||||||
ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
|
ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
|
||||||
# Tune flags; see http://valgrind.org/docs/manual/quick-start.html
|
# Tune flags; see http://valgrind.org/docs/manual/quick-start.html
|
||||||
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
||||||
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
|
||||||
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
|
||||||
ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),)
|
ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -DCRYPTOPP_VALGRIND
|
CXXFLAGS += -DCRYPTOPP_VALGRIND
|
||||||
endif # -DCRYPTOPP_VALGRIND
|
endif # -DCRYPTOPP_VALGRIND
|
||||||
endif # Valgrind
|
endif # Valgrind
|
||||||
|
|
||||||
# Debug testing on GNU systems. Triggered by -DDEBUG.
|
# Debug testing on GNU systems. Triggered by -DDEBUG.
|
||||||
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
|
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
|
||||||
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
|
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
|
||||||
USING_GLIBCXX := $(shell $(CXX) -x c++ $(CXXFLAGS) -E adhoc.cpp.proto 2>&1 | $(EGREP) -i -c "__GLIBCXX__")
|
USING_GLIBCXX := $(shell $(CXX) -x c++ $(CXXFLAGS) -E adhoc.cpp.proto 2>&1 | $(EGREP) -i -c "__GLIBCXX__")
|
||||||
ifneq ($(USING_GLIBCXX),0)
|
ifneq ($(USING_GLIBCXX),0)
|
||||||
ifeq ($(HAS_NEWLIB),0)
|
ifeq ($(HAS_NEWLIB),0)
|
||||||
ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
|
ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -D_GLIBCXX_DEBUG
|
CXXFLAGS += -D_GLIBCXX_DEBUG
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
endif # HAS_NEWLIB
|
endif # HAS_NEWLIB
|
||||||
endif # USING_GLIBCXX
|
endif # USING_GLIBCXX
|
||||||
endif # GNU Debug build
|
endif # GNU Debug build
|
||||||
|
|
||||||
# Dead code stripping. Issue 'make lean'.
|
# Dead code stripping. Issue 'make lean'.
|
||||||
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
||||||
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -ffunction-sections
|
CXXFLAGS += -ffunction-sections
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
||||||
CXXFLAGS += -fdata-sections
|
CXXFLAGS += -fdata-sections
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
ifneq ($(IS_DARWIN),0)
|
ifneq ($(IS_DARWIN),0)
|
||||||
ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
|
ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
|
||||||
LDFLAGS += -Wl,-dead_strip
|
LDFLAGS += -Wl,-dead_strip
|
||||||
endif # CXXFLAGS
|
endif # CXXFLAGS
|
||||||
else # BSD, Linux and Unix
|
else # BSD, Linux and Unix
|
||||||
ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
|
ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
|
||||||
LDFLAGS += -Wl,--gc-sections
|
LDFLAGS += -Wl,--gc-sections
|
||||||
endif # LDFLAGS
|
endif # LDFLAGS
|
||||||
endif # MAKECMDGOALS
|
endif # MAKECMDGOALS
|
||||||
endif # Dead code stripping
|
endif # Dead code stripping
|
||||||
|
|
||||||
# For Shared Objects, Diff, Dist/Zip rules
|
# For Shared Objects, Diff, Dist/Zip rules
|
||||||
|
|
@ -525,7 +544,7 @@ LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
|
||||||
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
|
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
|
||||||
|
|
||||||
ifeq ($(strip $(LIB_PATCH)),)
|
ifeq ($(strip $(LIB_PATCH)),)
|
||||||
LIB_PATCH := 0
|
LIB_PATCH := 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||||
|
|
|
||||||
16
config.h
16
config.h
|
|
@ -475,7 +475,8 @@ NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3)
|
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3)
|
||||||
# if defined(__SSSE3__) || (_MSC_VER >= 1500) || (CRYPTOPP_GCC_VERSION >= 40300)
|
# if defined(__SSSE3__) || (_MSC_VER >= 1500) || (CRYPTOPP_GCC_VERSION >= 40300) || \
|
||||||
|
(__SUNPRO_CC >= 0x5110)
|
||||||
#define CRYPTOPP_SSSE3_AVAILABLE 1
|
#define CRYPTOPP_SSSE3_AVAILABLE 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -485,34 +486,37 @@ NAMESPACE_END
|
||||||
// SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
|
// SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
|
||||||
#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
|
#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
|
||||||
(defined(__SSE4_1__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
|
(defined(__SSE4_1__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
|
||||||
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || \
|
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
|
||||||
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
|
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
|
||||||
#define CRYPTOPP_SSE41_AVAILABLE 1
|
#define CRYPTOPP_SSE41_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
|
#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
|
||||||
(defined(__SSE4_2__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
|
(defined(__SSE4_2__) || (CRYPTOPP_MSC_VERSION >= 1500) || (__SUNPRO_CC >= 0x5110) || \
|
||||||
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || \
|
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || \
|
||||||
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
|
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
|
||||||
#define CRYPTOPP_SSE42_AVAILABLE 1
|
#define CRYPTOPP_SSE42_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Requires Sun Studio 12.3 (SunCC 0x5120)
|
||||||
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_CLMUL) && \
|
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_CLMUL) && \
|
||||||
(defined(__PCLMUL__) || (_MSC_FULL_VER >= 150030729) || \
|
(defined(__PCLMUL__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
|
||||||
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
|
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
|
||||||
(CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
|
(CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
|
||||||
#define CRYPTOPP_CLMUL_AVAILABLE 1
|
#define CRYPTOPP_CLMUL_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Requires Sun Studio 12.3 (SunCC 0x5120)
|
||||||
#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
|
#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
|
||||||
(defined(__AES__) || (_MSC_FULL_VER >= 150030729) || \
|
(defined(__AES__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
|
||||||
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
|
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
|
||||||
(CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
|
(CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
|
||||||
#define CRYPTOPP_AESNI_AVAILABLE 1
|
#define CRYPTOPP_AESNI_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Guessing at SHA for SunCC
|
||||||
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SHA) && \
|
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SHA) && \
|
||||||
(defined(__SHA__) || (CRYPTOPP_MSC_VERSION >= 1900) || \
|
(defined(__SHA__) || (CRYPTOPP_MSC_VERSION >= 1900) || (__SUNPRO_CC >= 0x5150) || \
|
||||||
(CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1300) || \
|
(CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1300) || \
|
||||||
(CRYPTOPP_LLVM_CLANG_VERSION >= 30400) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50100))
|
(CRYPTOPP_LLVM_CLANG_VERSION >= 30400) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50100))
|
||||||
#define CRYPTOPP_SHANI_AVAILABLE 1
|
#define CRYPTOPP_SHANI_AVAILABLE 1
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,12 @@
|
||||||
# undef CRYPTOPP_SSE2_ASM_AVAILABLE
|
# undef CRYPTOPP_SSE2_ASM_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// SunCC 12.3 and 12.4 crash in GCM_Reduce_CLMUL
|
||||||
|
// http://github.com/weidai11/cryptopp/issues/226
|
||||||
|
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)
|
||||||
|
# undef CRYPTOPP_CLMUL_AVAILABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
// Clang and GCC hoops...
|
// Clang and GCC hoops...
|
||||||
#if !(defined(__ARM_FEATURE_CRYPTO) || defined(_MSC_VER))
|
#if !(defined(__ARM_FEATURE_CRYPTO) || defined(_MSC_VER))
|
||||||
# undef CRYPTOPP_ARM_PMULL_AVAILABLE
|
# undef CRYPTOPP_ARM_PMULL_AVAILABLE
|
||||||
|
|
|
||||||
10
gcm.cpp
10
gcm.cpp
|
|
@ -21,11 +21,11 @@
|
||||||
# undef CRYPTOPP_SSE2_ASM_AVAILABLE
|
# undef CRYPTOPP_SSE2_ASM_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SunCC 5.13 and below crash with AES-NI/CLMUL and C++{03|11}. Disable one or the other.
|
// SunCC 12.3 and 12.4 crash in GCM_Reduce_CLMUL
|
||||||
// Also see http://github.com/weidai11/cryptopp/issues/226
|
// http://github.com/weidai11/cryptopp/issues/226
|
||||||
// #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x513)
|
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)
|
||||||
// # undef CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
|
# undef CRYPTOPP_CLMUL_AVAILABLE
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
#include "gcm.h"
|
#include "gcm.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,10 @@
|
||||||
// Hack for SunCC, http://github.com/weidai11/cryptopp/issues/224
|
// Hack for SunCC, http://github.com/weidai11/cryptopp/issues/224
|
||||||
#if (__SUNPRO_CC >= 0x5130)
|
#if (__SUNPRO_CC >= 0x5130)
|
||||||
# define MAYBE_CONST
|
# define MAYBE_CONST
|
||||||
|
# define MAYBE_UNCONST_CAST(T, x) const_cast<MAYBE_CONST T>(x)
|
||||||
#else
|
#else
|
||||||
# define MAYBE_CONST const
|
# define MAYBE_CONST const
|
||||||
|
# define MAYBE_UNCONST_CAST(T, x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clang __m128i casts, http://bugs.llvm.org/show_bug.cgi?id=20670
|
// Clang __m128i casts, http://bugs.llvm.org/show_bug.cgi?id=20670
|
||||||
|
|
@ -627,18 +629,27 @@ inline size_t Rijndael_AdvancedProcessBlocks_AESNI(F1 func1, F4 func4,
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Rijndael_Enc_AdvancedProcessBlocks_AESNI(MAYBE_CONST word32 *subKeys, size_t rounds,
|
size_t Rijndael_Enc_AdvancedProcessBlocks_AESNI(const word32 *subKeys, size_t rounds,
|
||||||
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
|
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
|
||||||
{
|
{
|
||||||
|
// SunCC workaround
|
||||||
|
MAYBE_CONST word32* sk = MAYBE_UNCONST_CAST(word32*, subKeys);
|
||||||
|
MAYBE_CONST byte* ib = MAYBE_UNCONST_CAST(byte*, inBlocks);
|
||||||
|
MAYBE_CONST byte* xb = MAYBE_UNCONST_CAST(byte*, xorBlocks);
|
||||||
|
|
||||||
return Rijndael_AdvancedProcessBlocks_AESNI(AESNI_Enc_Block, AESNI_Enc_4_Blocks,
|
return Rijndael_AdvancedProcessBlocks_AESNI(AESNI_Enc_Block, AESNI_Enc_4_Blocks,
|
||||||
subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
|
sk, rounds, ib, xb, outBlocks, length, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Rijndael_Dec_AdvancedProcessBlocks_AESNI(MAYBE_CONST word32 *subKeys, size_t rounds,
|
size_t Rijndael_Dec_AdvancedProcessBlocks_AESNI(const word32 *subKeys, size_t rounds,
|
||||||
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
|
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
|
||||||
{
|
{
|
||||||
|
MAYBE_CONST word32* sk = MAYBE_UNCONST_CAST(word32*, subKeys);
|
||||||
|
MAYBE_CONST byte* ib = MAYBE_UNCONST_CAST(byte*, inBlocks);
|
||||||
|
MAYBE_CONST byte* xb = MAYBE_UNCONST_CAST(byte*, xorBlocks);
|
||||||
|
|
||||||
return Rijndael_AdvancedProcessBlocks_AESNI(AESNI_Dec_Block, AESNI_Dec_4_Blocks,
|
return Rijndael_AdvancedProcessBlocks_AESNI(AESNI_Dec_Block, AESNI_Dec_4_Blocks,
|
||||||
subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
|
sk, rounds, ib, xb, outBlocks, length, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rijndael_UncheckedSetKey_SSE4_AESNI(const byte *userKey, size_t keyLen, word32 *rk)
|
void Rijndael_UncheckedSetKey_SSE4_AESNI(const byte *userKey, size_t keyLen, word32 *rk)
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,6 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
# define CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS 1
|
# define CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Hack for SunCC, http://github.com/weidai11/cryptopp/issues/224
|
|
||||||
#if (__SUNPRO_CC >= 0x5130)
|
|
||||||
# define MAYBE_CONST
|
|
||||||
#else
|
|
||||||
# define MAYBE_CONST const
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Clang __m128i casts
|
// Clang __m128i casts
|
||||||
#define M128I_CAST(x) ((__m128i *)(void *)(x))
|
#define M128I_CAST(x) ((__m128i *)(void *)(x))
|
||||||
#define CONST_M128I_CAST(x) ((const __m128i *)(const void *)(x))
|
#define CONST_M128I_CAST(x) ((const __m128i *)(const void *)(x))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue