From 61674c6c871957f673622f9f9a824e7b7e027c7a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 13 Sep 2023 08:51:13 +0200 Subject: [PATCH] Use ANDROID_CPU_ARM64_FEATURE_AES for AES detection on Android/aarch64 --- src/libsodium/sodium/runtime.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libsodium/sodium/runtime.c b/src/libsodium/sodium/runtime.c index 48339955..c3fc2e03 100644 --- a/src/libsodium/sodium/runtime.c +++ b/src/libsodium/sodium/runtime.c @@ -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;