Botan
3.9.0
Crypto and TLS for C&
src
lib
utils
cpuid
cpuid_riscv64
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
{
19
public
:
20
enum
Bit
: uint32_t {
21
SCALAR_AES
= (1U << 0),
22
SCALAR_SHA256
= (1U << 1),
23
SCALAR_SM3
= (1U << 2),
24
SCALAR_SM4
= (1U << 3),
25
26
VECTOR
= (1 << 16),
27
VECTOR_AES
= (1U << 17),
28
VECTOR_SHA256
= (1U << 18),
29
VECTOR_SM3
= (1U << 19),
30
VECTOR_SM4
= (1U << 20),
31
};
32
33
CPUFeature
(
Bit
b) : m_bit(b) {}
34
35
uint32_t
as_u32
()
const
{
return
static_cast<
uint32_t
>
(m_bit); }
36
37
std::string
to_string
()
const
;
38
39
static
std::optional<CPUFeature>
from_string
(std::string_view s);
40
41
private
:
42
Bit
m_bit;
43
};
44
45
}
// namespace Botan
46
47
#endif
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition
api.h:41
Botan::CPUFeature
Definition
cpuid.h:24
Botan::CPUFeature::as_u32
uint32_t as_u32() const
Definition
cpuid_features.h:35
Botan::CPUFeature::CPUFeature
CPUFeature(Bit b)
Definition
cpuid_features.h:33
Botan::CPUFeature::Bit
Bit
Definition
cpuid.h:26
Botan::CPUFeature::VECTOR_SHA256
@ VECTOR_SHA256
Definition
cpuid_features.h:28
Botan::CPUFeature::VECTOR_SM3
@ VECTOR_SM3
Definition
cpuid_features.h:29
Botan::CPUFeature::VECTOR_AES
@ VECTOR_AES
Definition
cpuid_features.h:27
Botan::CPUFeature::SCALAR_AES
@ SCALAR_AES
Definition
cpuid_features.h:21
Botan::CPUFeature::VECTOR
@ VECTOR
Definition
cpuid_features.h:26
Botan::CPUFeature::SCALAR_SHA256
@ SCALAR_SHA256
Definition
cpuid_features.h:22
Botan::CPUFeature::SCALAR_SM3
@ SCALAR_SM3
Definition
cpuid_features.h:23
Botan::CPUFeature::SCALAR_SM4
@ SCALAR_SM4
Definition
cpuid_features.h:24
Botan::CPUFeature::VECTOR_SM4
@ VECTOR_SM4
Definition
cpuid_features.h:30
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:13
Generated by
1.14.0