Botan
3.14.1
Crypto and TLS for C&
src
lib
utils
cpuid
cpuid_aarch64
cpuid_features.h
Go to the documentation of this file.
1
/**
2
* (C) 2025 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#ifndef BOTAN_CPUID_FEATURES_H_
8
#define BOTAN_CPUID_FEATURES_H_
9
10
#include <botan/api.h>
11
#include <cstdint>
12
#include <optional>
13
#include <string>
14
#include <string_view>
15
16
namespace
Botan
{
17
18
class
BOTAN_TEST_API
CPUFeature
final {
19
public
:
20
enum
Bit
: uint32_t
/* NOLINT(*-use-enum-class) */
{
21
NEON
= (1U << 0),
22
SVE
= (1U << 1),
23
AES
= (1U << 16),
24
PMULL
= (1U << 17),
25
SHA1
= (1U << 18),
26
SHA2
= (1U << 19),
27
SHA3
= (1U << 20),
28
SHA2_512
= (1U << 21),
29
SM3
= (1U << 22),
30
SM4
= (1U << 23),
31
RNG
= (1U << 24),
32
33
SIMD_4X32
=
NEON
,
34
SIMD_2X64
=
NEON
,
35
HW_AES
=
AES
,
36
HW_CLMUL
=
PMULL
,
37
};
38
39
CPUFeature
(
Bit
b) : m_bit(b) {}
// NOLINT(*-explicit-conversions,*-explicit-constructor)
40
41
uint32_t
as_u32
()
const
{
return
static_cast<
uint32_t
>
(m_bit); }
42
43
std::string
to_string
()
const
;
44
45
static
std::optional<CPUFeature>
from_string
(std::string_view s);
46
47
private
:
48
Bit
m_bit;
49
};
50
51
}
// namespace Botan
52
53
#endif
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition
api.h:41
Botan::CPUFeature
Definition
cpuid.h:23
Botan::CPUFeature::as_u32
uint32_t as_u32() const
Definition
cpuid_features.h:41
Botan::CPUFeature::CPUFeature
CPUFeature(Bit b)
Definition
cpuid_features.h:39
Botan::CPUFeature::Bit
Bit
Definition
cpuid.h:25
Botan::CPUFeature::SVE
@ SVE
Definition
cpuid_features.h:22
Botan::CPUFeature::HW_CLMUL
@ HW_CLMUL
Definition
cpuid_features.h:36
Botan::CPUFeature::SHA1
@ SHA1
Definition
cpuid_features.h:25
Botan::CPUFeature::HW_AES
@ HW_AES
Definition
cpuid_features.h:35
Botan::CPUFeature::NEON
@ NEON
Definition
cpuid_features.h:21
Botan::CPUFeature::SM4
@ SM4
Definition
cpuid_features.h:30
Botan::CPUFeature::PMULL
@ PMULL
Definition
cpuid_features.h:24
Botan::CPUFeature::SHA3
@ SHA3
Definition
cpuid_features.h:27
Botan::CPUFeature::AES
@ AES
Definition
cpuid_features.h:23
Botan::CPUFeature::SIMD_2X64
@ SIMD_2X64
Definition
cpuid_features.h:34
Botan::CPUFeature::RNG
@ RNG
Definition
cpuid_features.h:31
Botan::CPUFeature::SIMD_4X32
@ SIMD_4X32
Definition
cpuid_features.h:33
Botan::CPUFeature::SM3
@ SM3
Definition
cpuid_features.h:29
Botan::CPUFeature::SHA2
@ SHA2
Definition
cpuid_features.h:26
Botan::CPUFeature::SHA2_512
@ SHA2_512
Definition
cpuid_features.h:28
Botan::CPUFeature::from_string
static std::optional< CPUFeature > from_string(std::string_view s)
Botan::CPUFeature::to_string
std::string to_string() const
Botan
Definition
alg_id.cpp:14
Generated by
1.16.1