summaryrefslogtreecommitdiff
path: root/validat1.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-07-15 08:35:14 -0400
committerGitHub <noreply@github.com>2018-07-15 08:35:14 -0400
commit4e3a1ea962d8f8cc58b97d2dd59554479a2b2db9 (patch)
tree8671ea037c90d6c316d83a1b9e5fca5c9b1e14e2 /validat1.cpp
parent2600f6dcc2c7adc001959309bb944384f352e111 (diff)
downloadcryptopp-git-4e3a1ea962d8f8cc58b97d2dd59554479a2b2db9.tar.gz
Add ARMv8.4 cpu feature detection support (GH #685) (#687)
This PR adds ARMv8.4 cpu feature detection support. Previously we only needed ARMv8.1 and things were much easier. For example, ARMv8.1 `__ARM_FEATURE_CRYPTO` meant PMULL, AES, SHA-1 and SHA-256 were available. ARMv8.4 `__ARM_FEATURE_CRYPTO` means PMULL, AES, SHA-1, SHA-256, SHA-512, SHA-3, SM3 and SM4 are available. We still use the same pattern as before. We make something available based on compiler version and/or preprocessor macros. But this time around we had to tighten things up a bit to ensure ARMv8.4 did not cross-pollinate down into ARMv8.1. ARMv8.4 is largely untested at the moment. There is no hardware in the field and CI lacks QEMU with the relevant patches/support. We will probably have to revisit some of this stuff in the future. Since this update applies to ARM gadgets we took the time to expand Android and iOS testing on Travis. Travis now tests more platforms, and includes Autotools and CMake builds, too.
Diffstat (limited to 'validat1.cpp')
-rw-r--r--validat1.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/validat1.cpp b/validat1.cpp
index 77dba93f..1eec0a6f 100644
--- a/validat1.cpp
+++ b/validat1.cpp
@@ -381,19 +381,31 @@ bool TestSettings()
std::cout << "\n";
#elif (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARM64)
+
+# if defined(__arm__)
bool hasARMv7 = HasARMv7();
bool hasNEON = HasNEON();
+
+ std::cout << "passed: ";
+ std::cout << "hasARMv7 == " << hasARMv7 << ", hasNEON == " << hasNEON << "\n";
+# else // __arch32__ and __aarch64__
bool hasCRC32 = HasCRC32();
bool hasPMULL = HasPMULL();
bool hasAES = HasAES();
bool hasSHA1 = HasSHA1();
bool hasSHA2 = HasSHA2();
+ bool hasSHA512 = HasSHA512();
+ bool hasSHA3 = HasSHA3();
+ bool hasSM3 = HasSM3();
+ bool hasSM4 = HasSM4();
std::cout << "passed: ";
- std::cout << "hasARMv7 == " << hasARMv7 << ", hasNEON == " << hasNEON;
- std::cout << ", hasCRC32 == " << hasCRC32 << ", hasPMULL == " << hasPMULL;
- std::cout << ", hasAES == " << hasAES << ", hasSHA1 == " << hasSHA1;
- std::cout << ", hasSHA2 == " << hasSHA2 << "\n";
+ std::cout << ", hasCRC32 == " << hasCRC32 << ", hasAES == " << hasAES;
+ std::cout << ", hasPMULL == " << hasPMULL << ", hasSHA1 == " << hasSHA1;
+ std::cout << ", hasSHA2 == " << hasSHA2 << ", hasSHA512 == " << hasSHA512;
+ std::cout << ", hasSHA3 == " << hasSHA3 << ", hasSM3 == " << hasSM3;
+ std::cout << ", hasSM4 == " << hasSM4 << "\n";
+# endif
#elif (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
const bool hasAltivec = HasAltivec();