Botan 3.9.0
Crypto and TLS for C&
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
16namespace Botan {
17
19 public:
20 enum Bit : uint32_t {
21 NEON = (1U << 0),
22 AES = (1U << 16),
23 PMULL = (1U << 17),
24 SHA1 = (1U << 18),
25 SHA2 = (1U << 19),
26
28 HW_AES = AES,
30 };
31
32 CPUFeature(Bit b) : m_bit(b) {} // NOLINT(*-explicit-conversions)
33
34 uint32_t as_u32() const { return static_cast<uint32_t>(m_bit); }
35
36 std::string to_string() const;
37
38 static std::optional<CPUFeature> from_string(std::string_view s);
39
40 private:
41 Bit m_bit;
42};
43
44} // namespace Botan
45
46#endif
#define BOTAN_TEST_API
Definition api.h:41
uint32_t as_u32() const
static std::optional< CPUFeature > from_string(std::string_view s)
std::string to_string() const