Hi Everyone,
ARMv8 has optional Crypto extensions, and they are available in A-53, A-57, etc. The Crypto extension collectively refers to AES, SAH1, SHA224 and SHA-256. To enable them, you compile with:
export CXXFLAGS="... -march=armv8-a+crypto -mcpu=cortex-a53"
According to the ARM Cortex-A53 MPCore Processor (
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0500d/DDI0500D_cortex_a53_r0p2_trm.pdf), the constituent parts can be selectively disabled. That is, AES could be disabled, or SHA-1 could be disabled, etc.
Testing for the features is not as easy as IA-32's CPUID because reading an ARM Machine Status Register (MSR) is a privileged operation. Attempting to read it results in a SIGILL. The best way I've found to determine features is runtime testing, and catching the SIGILL (Linux) and EXCEPTION_ILLEGAL_INSTRUCTION (Windows). Also see around line 260 of
http://github.com/weidai11/cryptopp/blob/arm-neon/cpu.cpp#L259 .
I have not encountered a condition where AES is enabled, but SHA1 is disabled. However, iOS comes close because both NEON and Crypto extensions are available, but CRC32 extensions are not available. Its unclear what Microsoft is doing in Store 10 and Phone 10 because their production-released compilers do not currently support ARM-64.
My question is, should we collectively use "hasCrypto", or should we break them out and use "hasAES", "hasSHA1", etc?
Jeff