diff options
author | Jeffrey Walton <noloader@gmail.com> | 2019-01-16 17:06:39 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2019-01-16 17:06:39 -0500 |
commit | e86a6b32eb5633e820578b97be7b2d79640bfe47 (patch) | |
tree | 778e320937aec6ec3ac4a868b663b342575a94e7 | |
parent | 7969f7181fadba2e89b3a0054315f108dc2afeb7 (diff) | |
download | cryptopp-git-e86a6b32eb5633e820578b97be7b2d79640bfe47.tar.gz |
Add CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE (GH #782)
I also suspect this has something to do with GH #768 and several others
-rw-r--r-- | config.h | 20 | ||||
-rw-r--r-- | lea.h | 4 | ||||
-rw-r--r-- | simon.h | 8 | ||||
-rw-r--r-- | sm4.h | 4 | ||||
-rw-r--r-- | speck.h | 8 |
5 files changed, 35 insertions, 9 deletions
@@ -291,12 +291,26 @@ const lword LWORD_MAX = W64LIT(0xffffffffffffffff); #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
#endif
-// Some Clang cannot handle mixed asm with positional arguments, where the
-// body is Intel style with no prefix and the templates are AT&T style.
-// Define this is the Makefile misdetects the configuration.
+// Some Clang and SunCC cannot handle mixed asm with positional arguments,
+// where the body is Intel style with no prefix and the templates are
+// AT&T style. Define this is the Makefile misdetects the configuration.
// Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
// #define CRYPTOPP_DISABLE_MIXED_ASM 1
+// Several compilers discard SIMD code that loads unaligned data. For example,
+// Power7 can load unaligned data using vec_vsx_ld but GCC and Clang require
+// 16-byte aligned arrays when using builtin function. Define this to disable
+// Crypto++ code that uses problematic builtins or intrinsics.
+// #define CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE 1
+
+// This list will probably grow over time as more compilers are identified.
+#if defined(CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE)
+# define CRYPTOPP_DISABLE_LEA_SIMD 1
+# define CRYPTOPP_DISABLE_SIMON_SIMD 1
+# define CRYPTOPP_DISABLE_SPECK_SIMD 1
+# define CRYPTOPP_DISABLE_SM4_SIMD 1
+#endif
+
// define hword, word, and dword. these are used for multiprecision integer arithmetic
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
#if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
@@ -16,7 +16,9 @@ #include "algparam.h"
#if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8)
-# define CRYPTOPP_LEA_ADVANCED_PROCESS_BLOCKS 1
+# ifndef CRYPTOPP_DISABLE_LEA_SIMD
+# define CRYPTOPP_LEA_ADVANCED_PROCESS_BLOCKS 1
+# endif
#endif
// Yet another SunStudio/SunCC workaround. Failed self tests
@@ -20,13 +20,17 @@ #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \
CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \
CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64
-# define CRYPTOPP_SIMON64_ADVANCED_PROCESS_BLOCKS 1
+# ifndef CRYPTOPP_DISABLE_SIMON_SIMD
+# define CRYPTOPP_SIMON64_ADVANCED_PROCESS_BLOCKS 1
+# endif
#endif
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \
CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \
CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64
-# define CRYPTOPP_SIMON128_ADVANCED_PROCESS_BLOCKS 1
+# ifndef CRYPTOPP_DISABLE_SIMON_SIMD
+# define CRYPTOPP_SIMON128_ADVANCED_PROCESS_BLOCKS 1
+# endif
#endif
// Yet another SunStudio/SunCC workaround. Failed self tests
@@ -19,7 +19,9 @@ #include "secblock.h"
#if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86)
-# define CRYPTOPP_SM4_ADVANCED_PROCESS_BLOCKS 1
+# ifndef CRYPTOPP_DISABLE_SM4_SIMD
+# define CRYPTOPP_SM4_ADVANCED_PROCESS_BLOCKS 1
+# endif
#endif
NAMESPACE_BEGIN(CryptoPP)
@@ -20,13 +20,17 @@ #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \
CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \
CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64
-# define CRYPTOPP_SPECK64_ADVANCED_PROCESS_BLOCKS 1
+# ifndef CRYPTOPP_DISABLE_SPECK_SIMD
+# define CRYPTOPP_SPECK64_ADVANCED_PROCESS_BLOCKS 1
+# endif
#endif
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \
CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \
CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64
-# define CRYPTOPP_SPECK128_ADVANCED_PROCESS_BLOCKS 1
+# ifndef CRYPTOPP_DISABLE_SPECK_SIMD
+# define CRYPTOPP_SPECK128_ADVANCED_PROCESS_BLOCKS 1
+# endif
#endif
// Yet another SunStudio/SunCC workaround. Failed self tests
|