8#include <botan/internal/cpuid.h>
10#if defined(BOTAN_TARGET_ARCH_IS_ARM32)
12 #include <botan/internal/os_utils.h>
16uint32_t CPUID::CPUID_Data::detect_cpu_features() {
17 uint32_t detected_features = 0;
19 #if defined(BOTAN_TARGET_OS_HAS_GETAUXVAL) || defined(BOTAN_TARGET_OS_HAS_ELF_AUX_INFO)
35 ARCH_hwcap_crypto = 26,
38 const unsigned long hwcap_neon =
OS::get_auxval(ARM_hwcap_bit::ARCH_hwcap_neon);
39 if(hwcap_neon & ARM_hwcap_bit::NEON_bit) {
40 detected_features |= CPUID::CPUID_ARM_NEON_BIT;
42 const unsigned long hwcap_crypto =
OS::get_auxval(ARM_hwcap_bit::ARCH_hwcap_crypto);
43 if(hwcap_crypto & ARM_hwcap_bit::AES_bit)
44 detected_features |= CPUID::CPUID_ARM_AES_BIT;
45 if(hwcap_crypto & ARM_hwcap_bit::PMULL_bit)
46 detected_features |= CPUID::CPUID_ARM_PMULL_BIT;
47 if(hwcap_crypto & ARM_hwcap_bit::SHA1_bit)
48 detected_features |= CPUID::CPUID_ARM_SHA1_BIT;
49 if(hwcap_crypto & ARM_hwcap_bit::SHA2_bit)
50 detected_features |= CPUID::CPUID_ARM_SHA2_BIT;
54 return detected_features;
unsigned long get_auxval(unsigned long id)