mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-24 04:25:10 -07:00
Detect NEON and ARMCRYPTO on ARM32
Which doesn't mean that the compiler will support these opcodes, so we need to autoconf magic as well.
This commit is contained in:
parent
456a57f235
commit
1910ca83d8
@ -71,6 +71,8 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
|
|||||||
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
|
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
|
||||||
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP) && defined(__aarch64__)
|
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP) && defined(__aarch64__)
|
||||||
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
|
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
|
||||||
|
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP) && defined(__arm__)
|
||||||
|
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 12)) != 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cpu_features->has_neon == 0) {
|
if (cpu_features->has_neon == 0) {
|
||||||
@ -98,6 +100,8 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
|
|||||||
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_AES) != 0x0;
|
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_AES) != 0x0;
|
||||||
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP) && defined(__aarch64__)
|
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP) && defined(__aarch64__)
|
||||||
cpu_features->has_armcrypto_aes = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
|
cpu_features->has_armcrypto_aes = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
|
||||||
|
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP) && defined(__arm__)
|
||||||
|
cpu_features->has_armcrypto_aes = (getauxval(AT_HWCAP2) & (1L << 0)) != 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user