Use ANDROID_CPU_ARM64_FEATURE_AES for AES detection on Android/aarch64

This commit is contained in:
Frank Denis 2023-09-13 08:51:13 +02:00
parent a589d64b42
commit 61674c6c87

View File

@ -66,9 +66,9 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
#if defined(__ARM_NEON) || defined(__aarch64__) || defined(_M_ARM64)
cpu_features->has_neon = 1;
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_NEON)
#elif defined(HAVE_ANDROID_GETCPUFEATURES)
cpu_features->has_neon =
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
(android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_ASIMD) != 0x0;
#elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
# ifdef HAVE_GETAUXVAL
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
@ -117,9 +117,9 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
cpu_features->has_armcrypto = 1;
}
}
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_AES)
#elif defined(HAVE_ANDROID_GETCPUFEATURES)
cpu_features->has_armcrypto =
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_AES) != 0x0;
(android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_AES) != 0x0;
#elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
# ifdef HAVE_GETAUXVAL
cpu_features->has_armcrypto = (getauxval(AT_HWCAP) & (1L << 3)) != 0;