Browse Source

has_armcrypto_aes -> has_armcrypto

master
Frank Denis 5 years ago
parent
commit
c8b6906c60
  1. 2
      dist-build/emscripten-symbols.def
  2. 2
      src/libsodium/include/sodium/runtime.h
  3. 18
      src/libsodium/sodium/runtime.c
  4. 2
      test/default/sodium_core.c
  5. 2
      test/symbols/all-symbols.txt

2
dist-build/emscripten-symbols.def

@ -606,7 +606,7 @@ _sodium_runtime_has_avx 0 0
_sodium_runtime_has_avx2 0 0 _sodium_runtime_has_avx2 0 0
_sodium_runtime_has_avx512f 0 0 _sodium_runtime_has_avx512f 0 0
_sodium_runtime_has_neon 0 0 _sodium_runtime_has_neon 0 0
_sodium_runtime_has_armcrypto_aes 0 0 _sodium_runtime_has_armcrypto 0 0
_sodium_runtime_has_pclmul 0 0 _sodium_runtime_has_pclmul 0 0
_sodium_runtime_has_rdrand 0 0 _sodium_runtime_has_rdrand 0 0
_sodium_runtime_has_sse2 0 0 _sodium_runtime_has_sse2 0 0

2
src/libsodium/include/sodium/runtime.h

@ -12,7 +12,7 @@ SODIUM_EXPORT_WEAK
int sodium_runtime_has_neon(void); int sodium_runtime_has_neon(void);
SODIUM_EXPORT_WEAK SODIUM_EXPORT_WEAK
int sodium_runtime_has_armcrypto_aes(void); int sodium_runtime_has_armcrypto(void);
SODIUM_EXPORT_WEAK SODIUM_EXPORT_WEAK
int sodium_runtime_has_sse2(void); int sodium_runtime_has_sse2(void);

18
src/libsodium/sodium/runtime.c

@ -18,7 +18,7 @@
typedef struct CPUFeatures_ { typedef struct CPUFeatures_ {
int initialized; int initialized;
int has_neon; int has_neon;
int has_armcrypto_aes; int has_armcrypto;
int has_sse2; int has_sse2;
int has_sse3; int has_sse3;
int has_ssse3; int has_ssse3;
@ -58,7 +58,7 @@ static int
_sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features) _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
{ {
cpu_features->has_neon = 0; cpu_features->has_neon = 0;
cpu_features->has_armcrypto_aes = 0; cpu_features->has_armcrypto = 0;
#ifndef __ARM_ARCH #ifndef __ARM_ARCH
return -1; /* LCOV_EXCL_LINE */ return -1; /* LCOV_EXCL_LINE */
@ -80,7 +80,7 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
} }
#if __ARM_FEATURE_CRYPTO #if __ARM_FEATURE_CRYPTO
cpu_features->has_armcrypto_aes = 1; cpu_features->has_armcrypto = 1;
#elif defined(__APPLE__) && defined(CPU_TYPE_ARM64) && defined(CPU_SUBTYPE_ARM64E) #elif defined(__APPLE__) && defined(CPU_TYPE_ARM64) && defined(CPU_SUBTYPE_ARM64E)
{ {
cpu_type_t cpu_type; cpu_type_t cpu_type;
@ -94,16 +94,16 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
NULL, 0) == 0 && NULL, 0) == 0 &&
(cpu_subtype == CPU_SUBTYPE_ARM64E || (cpu_subtype == CPU_SUBTYPE_ARM64E ||
cpu_subtype == CPU_SUBTYPE_ARM64_V8)) { cpu_subtype == CPU_SUBTYPE_ARM64_V8)) {
cpu_features->has_armcrypto_aes = 1; cpu_features->has_armcrypto = 1;
} }
} }
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_AES) #elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_AES)
cpu_features->has_armcrypto_aes = cpu_features->has_armcrypto =
(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 = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
#elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP2) && defined(__arm__) #elif defined(HAVE_GETAUXVAL) && defined(AT_HWCAP2) && defined(__arm__)
cpu_features->has_armcrypto_aes = (getauxval(AT_HWCAP2) & (1L << 0)) != 0; cpu_features->has_armcrypto = (getauxval(AT_HWCAP2) & (1L << 0)) != 0;
#endif #endif
return 0; return 0;
@ -289,9 +289,9 @@ sodium_runtime_has_neon(void)
} }
int int
sodium_runtime_has_armcrypto_aes(void) sodium_runtime_has_armcrypto(void)
{ {
return _cpu_features.has_armcrypto_aes; return _cpu_features.has_armcrypto;
} }
int int

2
test/default/sodium_core.c

@ -19,7 +19,7 @@ main(void)
assert(sodium_init() == 1); assert(sodium_init() == 1);
(void) sodium_runtime_has_neon(); (void) sodium_runtime_has_neon();
(void) sodium_runtime_has_armcrypto_aes(); (void) sodium_runtime_has_armcrypto();
(void) sodium_runtime_has_sse2(); (void) sodium_runtime_has_sse2();
(void) sodium_runtime_has_sse3(); (void) sodium_runtime_has_sse3();
(void) sodium_runtime_has_ssse3(); (void) sodium_runtime_has_ssse3();

2
test/symbols/all-symbols.txt

@ -680,7 +680,7 @@ sodium_munlock
sodium_munshield sodium_munshield
sodium_pad sodium_pad
sodium_runtime_has_aesni sodium_runtime_has_aesni
sodium_runtime_has_armcrypto_aes sodium_runtime_has_armcrypto
sodium_runtime_has_avx sodium_runtime_has_avx
sodium_runtime_has_avx2 sodium_runtime_has_avx2
sodium_runtime_has_avx512f sodium_runtime_has_avx512f

Loading…
Cancel
Save