Botan
3.6.1
Crypto and TLS for C&
src
lib
pubkey
frodokem
frodokem_common
frodo_mode.h
Go to the documentation of this file.
1
/*
2
* FrodoKEM modes and constants
3
*
4
* The Fellowship of the FrodoKEM:
5
* (C) 2023 Jack Lloyd
6
* 2023 René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity
7
*
8
* Botan is released under the Simplified BSD License (see license.txt)
9
*/
10
11
#ifndef BOTAN_FRODOKEM_MODE_H_
12
#define BOTAN_FRODOKEM_MODE_H_
13
14
#include <botan/asn1_obj.h>
15
16
#include <vector>
17
18
namespace
Botan
{
19
20
class
BOTAN_PUBLIC_API
(3, 3)
FrodoKEMMode
{
21
public
:
22
enum
Mode
{
23
FrodoKEM640_SHAKE
,
24
FrodoKEM976_SHAKE
,
25
FrodoKEM1344_SHAKE
,
26
eFrodoKEM640_SHAKE
,
27
eFrodoKEM976_SHAKE
,
28
eFrodoKEM1344_SHAKE
,
29
FrodoKEM640_AES
,
30
FrodoKEM976_AES
,
31
FrodoKEM1344_AES
,
32
eFrodoKEM640_AES
,
33
eFrodoKEM976_AES
,
34
eFrodoKEM1344_AES
35
};
36
37
FrodoKEMMode
(Mode mode);
38
explicit
FrodoKEMMode
(
const
OID
& oid);
39
explicit
FrodoKEMMode
(std::string_view str);
40
41
OID
object_identifier()
const
;
42
std::string to_string()
const
;
43
44
Mode
mode
()
const
{
return
m_mode; }
45
46
bool
is_ephemeral
()
const
{
47
return
m_mode == eFrodoKEM640_SHAKE || m_mode == eFrodoKEM976_SHAKE || m_mode == eFrodoKEM1344_SHAKE ||
48
m_mode == eFrodoKEM640_AES || m_mode == eFrodoKEM976_AES || m_mode == eFrodoKEM1344_AES;
49
}
50
51
bool
is_static
()
const
{
52
return
m_mode == FrodoKEM640_SHAKE || m_mode == FrodoKEM976_SHAKE || m_mode == FrodoKEM1344_SHAKE ||
53
m_mode == FrodoKEM640_AES || m_mode == FrodoKEM976_AES || m_mode == FrodoKEM1344_AES;
54
}
55
56
bool
is_shake
()
const
{
57
return
m_mode == eFrodoKEM640_SHAKE || m_mode == eFrodoKEM976_SHAKE || m_mode == eFrodoKEM1344_SHAKE ||
58
m_mode == FrodoKEM640_SHAKE || m_mode == FrodoKEM976_SHAKE || m_mode == FrodoKEM1344_SHAKE;
59
}
60
61
bool
is_aes
()
const
{
62
return
m_mode == eFrodoKEM640_AES || m_mode == eFrodoKEM976_AES || m_mode == eFrodoKEM1344_AES ||
63
m_mode == FrodoKEM640_AES || m_mode == FrodoKEM976_AES || m_mode == FrodoKEM1344_AES;
64
}
65
66
bool
is_available
()
const
{
67
return
68
#if defined(BOTAN_HAS_FRODOKEM_AES)
69
is_aes() ||
70
#endif
71
72
#if defined(BOTAN_HAS_FRODOKEM_SHAKE)
73
is_shake() ||
74
#endif
75
76
false
;
77
}
78
79
bool
operator==
(
const
FrodoKEMMode
& other)
const
{
return
m_mode == other.m_mode; }
80
81
bool
operator!=
(
const
FrodoKEMMode
& other)
const
{
return
!(*
this
== other); }
82
83
private
:
84
Mode m_mode;
85
};
86
87
}
// namespace Botan
88
89
#endif
Botan::FrodoKEMMode
Definition
frodo_mode.h:20
Botan::FrodoKEMMode::is_static
bool is_static() const
Definition
frodo_mode.h:51
Botan::FrodoKEMMode::is_aes
bool is_aes() const
Definition
frodo_mode.h:61
Botan::FrodoKEMMode::is_available
bool is_available() const
Definition
frodo_mode.h:66
Botan::FrodoKEMMode::mode
Mode mode() const
Definition
frodo_mode.h:44
Botan::FrodoKEMMode::is_ephemeral
bool is_ephemeral() const
Definition
frodo_mode.h:46
Botan::FrodoKEMMode::operator==
bool operator==(const FrodoKEMMode &other) const
Definition
frodo_mode.h:79
Botan::FrodoKEMMode::is_shake
bool is_shake() const
Definition
frodo_mode.h:56
Botan::FrodoKEMMode::operator!=
bool operator!=(const FrodoKEMMode &other) const
Definition
frodo_mode.h:81
Botan::FrodoKEMMode::Mode
Mode
Definition
frodo_mode.h:22
Botan::FrodoKEMMode::eFrodoKEM976_SHAKE
@ eFrodoKEM976_SHAKE
Definition
frodo_mode.h:27
Botan::FrodoKEMMode::FrodoKEM976_AES
@ FrodoKEM976_AES
Definition
frodo_mode.h:30
Botan::FrodoKEMMode::eFrodoKEM976_AES
@ eFrodoKEM976_AES
Definition
frodo_mode.h:33
Botan::FrodoKEMMode::FrodoKEM640_AES
@ FrodoKEM640_AES
Definition
frodo_mode.h:29
Botan::FrodoKEMMode::FrodoKEM1344_SHAKE
@ FrodoKEM1344_SHAKE
Definition
frodo_mode.h:25
Botan::FrodoKEMMode::eFrodoKEM640_AES
@ eFrodoKEM640_AES
Definition
frodo_mode.h:32
Botan::FrodoKEMMode::FrodoKEM1344_AES
@ FrodoKEM1344_AES
Definition
frodo_mode.h:31
Botan::FrodoKEMMode::FrodoKEM640_SHAKE
@ FrodoKEM640_SHAKE
Definition
frodo_mode.h:23
Botan::FrodoKEMMode::FrodoKEM976_SHAKE
@ FrodoKEM976_SHAKE
Definition
frodo_mode.h:24
Botan::FrodoKEMMode::eFrodoKEM1344_SHAKE
@ eFrodoKEM1344_SHAKE
Definition
frodo_mode.h:28
Botan::FrodoKEMMode::eFrodoKEM640_SHAKE
@ eFrodoKEM640_SHAKE
Definition
frodo_mode.h:26
Botan::OID
Definition
asn1_obj.h:216
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition
compiler.h:31
Botan
Definition
alg_id.cpp:13
Generated by
1.12.0