8#include <botan/internal/cpuid.h>
10#include <botan/internal/target_info.h>
12#if defined(BOTAN_HAS_OS_UTILS)
13 #include <botan/internal/os_utils.h>
18uint32_t CPUID::CPUID_Data::detect_cpu_features(uint32_t allowed) {
21#if defined(BOTAN_HAS_OS_UTILS)
24 const auto [hwcap_neon, hwcap_crypto] = *auxval;
33 enum class ARM_hwcap_bit : uint64_t {
41 feat |=
if_set(hwcap_neon, ARM_hwcap_bit::NEON_bit, CPUFeature::Bit::NEON, allowed);
43 if(feat & CPUFeature::Bit::NEON) {
44 feat |=
if_set(hwcap_crypto, ARM_hwcap_bit::AES_bit, CPUFeature::Bit::AES, allowed);
45 feat |=
if_set(hwcap_crypto, ARM_hwcap_bit::PMULL_bit, CPUFeature::Bit::PMULL, allowed);
46 feat |=
if_set(hwcap_crypto, ARM_hwcap_bit::SHA1_bit, CPUFeature::Bit::SHA1, allowed);
47 feat |=
if_set(hwcap_crypto, ARM_hwcap_bit::SHA2_bit, CPUFeature::Bit::SHA2, allowed);
static uint32_t if_set(uint64_t cpuid, T flag, CPUID::Feature bit, uint32_t allowed)
std::optional< std::pair< unsigned long, unsigned long > > get_auxval_hwcap()