summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-01-16 17:06:39 -0500
committerJeffrey Walton <noloader@gmail.com>2019-01-16 17:06:39 -0500
commite86a6b32eb5633e820578b97be7b2d79640bfe47 (patch)
tree778e320937aec6ec3ac4a868b663b342575a94e7
parent7969f7181fadba2e89b3a0054315f108dc2afeb7 (diff)
downloadcryptopp-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.h20
-rw-r--r--lea.h4
-rw-r--r--simon.h8
-rw-r--r--sm4.h4
-rw-r--r--speck.h8
5 files changed, 35 insertions, 9 deletions
diff --git a/config.h b/config.h
index ee076fa8..08f9f02d 100644
--- a/config.h
+++ b/config.h
@@ -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__))
diff --git a/lea.h b/lea.h
index a3482d5d..a41bd221 100644
--- a/lea.h
+++ b/lea.h
@@ -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
diff --git a/simon.h b/simon.h
index 2bcb0e5e..ae37503e 100644
--- a/simon.h
+++ b/simon.h
@@ -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
diff --git a/sm4.h b/sm4.h
index 92883a31..efc0c4d8 100644
--- a/sm4.h
+++ b/sm4.h
@@ -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)
diff --git a/speck.h b/speck.h
index 09fb26ee..a01c50fd 100644
--- a/speck.h
+++ b/speck.h
@@ -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