From 0aa217b91c0de1deb90ebee606b8e8502be9eb7d Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 9 Dec 2018 10:24:55 -0500 Subject: [PATCH] Update comments in config.h Some comments in config.h were old. Time for a refresh. Switch from CRYPTOPP_BOOL_ARM64 to CRYPTOPP_BOOL_ARMV8. Aarch32 is ARMv8, and that's the important part. --- TestScripts/setenv-travis.sh | 2 ++ config.h | 33 +++++++++++++-------------------- cpu.cpp | 4 ++-- cpu.h | 4 ++-- crc_simd.cpp | 2 +- gcm_simd.cpp | 2 +- lea.h | 2 +- rijndael.h | 2 +- rijndael_simd.cpp | 2 +- sha_simd.cpp | 2 +- simon.h | 4 ++-- speck.h | 4 ++-- validat3.cpp | 2 +- 13 files changed, 30 insertions(+), 35 deletions(-) diff --git a/TestScripts/setenv-travis.sh b/TestScripts/setenv-travis.sh index 3f7614fd..43920fb6 100755 --- a/TestScripts/setenv-travis.sh +++ b/TestScripts/setenv-travis.sh @@ -14,3 +14,5 @@ mkdir -p "$ANDROID_NDK_ROOT" # https://stackoverflow.com/a/47028911/608639 touch "$ANDROID_HOME/repositories.cfg" + +[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 diff --git a/config.h b/config.h index a71e5cf5..9f637919 100644 --- a/config.h +++ b/config.h @@ -57,7 +57,7 @@ // Define this to disable ASM, intrinsics and built-ins. The library will be // compiled using C++ only. The library code will not include SSE2 (and -// above), NEON, Aarch32, Aarch64, Power4, Power7 or Power8. Note the compiler +// above), NEON, Aarch32, Aarch64, or Altivec (and above). Note the compiler // may use higher ISAs depending on compiler options, but the library will not // explictly use the ISAs. When disabling ASM, it is best to do it from // config.h to ensure the library and all programs share the setting. @@ -400,16 +400,8 @@ NAMESPACE_END #ifdef _MSC_VER // 4127: conditional expression is constant - // 4231: nonstandard extension used : 'extern' before template explicit instantiation - // 4250: dominance - // 4251: member needs to have dll-interface - // 4275: base needs to have dll-interface - // 4505: unreferenced local function // 4512: assignment operator not generated - // 4660: explicitly instantiating a class that's already implicitly instantiated // 4661: no suitable definition provided for explicit template instantiation request - // 4786: identifier was truncated in debug information - // 4355: 'this' : used in base member initializer list // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation # pragma warning(disable: 4127 4512 4661 4910) // Security related, possible defects @@ -441,9 +433,11 @@ NAMESPACE_END // ***************** Platform and CPU features ******************** -// Linux provides X32, which is 32-bit integers, longs and pointers on x86_64 using the full x86_64 register set. -// Detect via __ILP32__ (http://wiki.debian.org/X32Port). However, __ILP32__ shows up in more places than -// the System V ABI specs calls out, like on some Solaris installations and just about any 32-bit system with Clang. +// Linux provides X32, which is 32-bit integers, longs and pointers on x86_64 +// using the full x86_64 register set. Detect via __ILP32__ +// (http://wiki.debian.org/X32Port). However, __ILP32__ shows up in more places +// than the System V ABI specs calls out, like on some Solaris installations +// and just about any 32-bit system with Clang. #if (defined(__ILP32__) || defined(_ILP32)) && defined(__x86_64__) #define CRYPTOPP_BOOL_X32 1 #endif @@ -457,23 +451,22 @@ NAMESPACE_END #define CRYPTOPP_BOOL_X64 1 #endif -// Undo the ASM and Intrinsic related defines due to X32. +// Undo the ASM related defines due to X32. #if CRYPTOPP_BOOL_X32 # undef CRYPTOPP_BOOL_X64 # undef CRYPTOPP_X64_ASM_AVAILABLE # undef CRYPTOPP_X64_MASM_AVAILABLE #endif -// Microsoft plans to support ARM-64, but its not clear how to detect it. -// TODO: Add MSC_VER and ARM-64 platform define when available -#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) - #define CRYPTOPP_BOOL_ARM64 1 -#elif defined(__arm__) || defined(__aarch32__) || defined(_M_ARM) +// Microsoft added ARM64 define December 2017. +#if defined(__arm64__) || defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64) + #define CRYPTOPP_BOOL_ARMV8 1 +#elif defined(__arm__) || defined(_M_ARM) #define CRYPTOPP_BOOL_ARM32 1 #endif // AltiVec and Power8 crypto -#if defined(__powerpc64__) || defined(_ARCH_PPC64) +#if defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64) #define CRYPTOPP_BOOL_PPC64 1 #elif defined(__powerpc__) || defined(_ARCH_PPC) #define CRYPTOPP_BOOL_PPC32 1 @@ -629,7 +622,7 @@ NAMESPACE_END // ***************** ARM CPU features ******************** -#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) // We don't have an ARM big endian test rig. Disable // ARM-BE ASM and instrinsics until we can test it. diff --git a/cpu.cpp b/cpu.cpp index 6d51e892..b60ef1df 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -435,7 +435,7 @@ void DetectX86Features() // *************************** ARM-32, Aarch32 and Aarch64 *************************** -#elif (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#elif (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) bool CRYPTOPP_SECTION_INIT g_ArmDetectionDone = false; bool CRYPTOPP_SECTION_INIT g_hasARMv7 = false; @@ -1050,7 +1050,7 @@ public: { #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 CryptoPP::DetectX86Features(); -#elif CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 +#elif CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 CryptoPP::DetectArmFeatures(); #elif CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 CryptoPP::DetectPowerpcFeatures(); diff --git a/cpu.h b/cpu.h index f7b554db..00ca75cc 100644 --- a/cpu.h +++ b/cpu.h @@ -337,7 +337,7 @@ inline int GetCacheLineSize() // ***************************** ARM-32, Aarch32 and Aarch64 ***************************** // -#if CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 || CRYPTOPP_DOXYGEN_PROCESSING +#if CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || CRYPTOPP_DOXYGEN_PROCESSING // Hide from Doxygen #ifndef CRYPTOPP_DOXYGEN_PROCESSING @@ -579,7 +579,7 @@ inline bool HasSM4() //@} -#endif // CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 +#endif // CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 // ***************************** PowerPC ***************************** // diff --git a/crc_simd.cpp b/crc_simd.cpp index 84a4a081..4699953a 100644 --- a/crc_simd.cpp +++ b/crc_simd.cpp @@ -49,7 +49,7 @@ extern "C" { } #endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY -#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) bool CPU_ProbeCRC32() { diff --git a/gcm_simd.cpp b/gcm_simd.cpp index 767de9f8..8d81c839 100644 --- a/gcm_simd.cpp +++ b/gcm_simd.cpp @@ -277,7 +277,7 @@ extern "C" { } #endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY -#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) bool CPU_ProbePMULL() { #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) diff --git a/lea.h b/lea.h index 1c51952c..ab0cf568 100644 --- a/lea.h +++ b/lea.h @@ -15,7 +15,7 @@ #include "secblock.h" #include "algparam.h" -#if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) # define CRYPTOPP_LEA_ADVANCED_PROCESS_BLOCKS 1 #endif diff --git a/rijndael.h b/rijndael.h index 65512f59..0b384c4d 100644 --- a/rijndael.h +++ b/rijndael.h @@ -20,7 +20,7 @@ #endif #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || \ - CRYPTOPP_BOOL_ARM64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 + CRYPTOPP_BOOL_ARMV8 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 # define CRYPTOPP_RIJNDAEL_ADVANCED_PROCESS_BLOCKS 1 #endif diff --git a/rijndael_simd.cpp b/rijndael_simd.cpp index 9fde6c8c..36ad06ac 100644 --- a/rijndael_simd.cpp +++ b/rijndael_simd.cpp @@ -75,7 +75,7 @@ extern "C" { } #endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY -#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) bool CPU_ProbeAES() { #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) diff --git a/sha_simd.cpp b/sha_simd.cpp index 497d9f92..95ac10fc 100644 --- a/sha_simd.cpp +++ b/sha_simd.cpp @@ -73,7 +73,7 @@ extern "C" { } #endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY -#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) bool CPU_ProbeSHA1() { #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) diff --git a/simon.h b/simon.h index 6eff55e0..2bcb0e5e 100644 --- a/simon.h +++ b/simon.h @@ -18,13 +18,13 @@ #include "secblock.h" #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \ - CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 || \ + CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \ CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 # define CRYPTOPP_SIMON64_ADVANCED_PROCESS_BLOCKS 1 #endif #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \ - CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 || \ + CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \ CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 # define CRYPTOPP_SIMON128_ADVANCED_PROCESS_BLOCKS 1 #endif diff --git a/speck.h b/speck.h index 37dbce5d..09fb26ee 100644 --- a/speck.h +++ b/speck.h @@ -18,13 +18,13 @@ #include "secblock.h" #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \ - CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 || \ + CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \ CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 # define CRYPTOPP_SPECK64_ADVANCED_PROCESS_BLOCKS 1 #endif #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || \ - CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64 || \ + CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || \ CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 # define CRYPTOPP_SPECK128_ADVANCED_PROCESS_BLOCKS 1 #endif diff --git a/validat3.cpp b/validat3.cpp index fb55dd54..3a703ecb 100644 --- a/validat3.cpp +++ b/validat3.cpp @@ -356,7 +356,7 @@ bool TestSettings() std::cout << ", hasSHA == " << hasSHA << ", isP4 == " << isP4; std::cout << "\n"; -#elif (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64) +#elif (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) # if defined(__arm__) bool hasARMv7 = HasARMv7();