Botan 3.6.1
Crypto and TLS for C&
Botan::FrodoKEMMode Class Reference

#include <frodo_mode.h>

Public Types

enum  Mode {
  FrodoKEM640_SHAKE , FrodoKEM976_SHAKE , FrodoKEM1344_SHAKE , eFrodoKEM640_SHAKE ,
  eFrodoKEM976_SHAKE , eFrodoKEM1344_SHAKE , FrodoKEM640_AES , FrodoKEM976_AES ,
  FrodoKEM1344_AES , eFrodoKEM640_AES , eFrodoKEM976_AES , eFrodoKEM1344_AES
}
 

Public Member Functions

 FrodoKEMMode (const OID &oid)
 
 FrodoKEMMode (Mode mode)
 
 FrodoKEMMode (std::string_view str)
 
bool is_aes () const
 
bool is_available () const
 
bool is_ephemeral () const
 
bool is_shake () const
 
bool is_static () const
 
Mode mode () const
 
OID object_identifier () const
 
bool operator!= (const FrodoKEMMode &other) const
 
bool operator== (const FrodoKEMMode &other) const
 
std::string to_string () const
 

Detailed Description

Definition at line 20 of file frodo_mode.h.

Member Enumeration Documentation

◆ Mode

Enumerator
FrodoKEM640_SHAKE 
FrodoKEM976_SHAKE 
FrodoKEM1344_SHAKE 
eFrodoKEM640_SHAKE 
eFrodoKEM976_SHAKE 
eFrodoKEM1344_SHAKE 
FrodoKEM640_AES 
FrodoKEM976_AES 
FrodoKEM1344_AES 
eFrodoKEM640_AES 
eFrodoKEM976_AES 
eFrodoKEM1344_AES 

Definition at line 22 of file frodo_mode.h.

Constructor & Destructor Documentation

◆ FrodoKEMMode() [1/3]

Botan::FrodoKEMMode::FrodoKEMMode ( Mode mode)

Definition at line 69 of file frodo_mode.cpp.

69: m_mode(mode) {}
Mode mode() const
Definition frodo_mode.h:44

◆ FrodoKEMMode() [2/3]

Botan::FrodoKEMMode::FrodoKEMMode ( const OID & oid)
explicit

Definition at line 71 of file frodo_mode.cpp.

71: m_mode(FrodoKEM_mode_from_string(oid.to_formatted_string())) {}

◆ FrodoKEMMode() [3/3]

Botan::FrodoKEMMode::FrodoKEMMode ( std::string_view str)
explicit

Definition at line 73 of file frodo_mode.cpp.

73: m_mode(FrodoKEM_mode_from_string(str)) {}

Member Function Documentation

◆ is_aes()

bool Botan::FrodoKEMMode::is_aes ( ) const
inline

Definition at line 61 of file frodo_mode.h.

61 {
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 }

Referenced by Botan::create_aes_row_generator().

◆ is_available()

bool Botan::FrodoKEMMode::is_available ( ) const
inline

Definition at line 66 of file frodo_mode.h.

66 {
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 }
bool is_aes() const
Definition frodo_mode.h:61
bool is_shake() const
Definition frodo_mode.h:56

Referenced by Botan::FrodoKEMConstants::FrodoKEMConstants().

◆ is_ephemeral()

bool Botan::FrodoKEMMode::is_ephemeral ( ) const
inline

Definition at line 46 of file frodo_mode.h.

46 {
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 }

Referenced by Botan::FrodoKEMConstants::FrodoKEMConstants().

◆ is_shake()

bool Botan::FrodoKEMMode::is_shake ( ) const
inline

Definition at line 56 of file frodo_mode.h.

56 {
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 }

Referenced by Botan::create_shake_row_generator().

◆ is_static()

bool Botan::FrodoKEMMode::is_static ( ) const
inline

Definition at line 51 of file frodo_mode.h.

51 {
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 }

Referenced by Botan::FrodoKEMConstants::FrodoKEMConstants().

◆ mode()

Mode Botan::FrodoKEMMode::mode ( ) const
inline

Definition at line 44 of file frodo_mode.h.

44{ return m_mode; }

Referenced by Botan::FrodoKEMConstants::FrodoKEMConstants().

◆ object_identifier()

OID Botan::FrodoKEMMode::object_identifier ( ) const

Definition at line 75 of file frodo_mode.cpp.

75 {
77}
std::string to_string() const
static OID from_string(std::string_view str)
Definition asn1_oid.cpp:86

References Botan::OID::from_string(), and to_string().

◆ operator!=()

bool Botan::FrodoKEMMode::operator!= ( const FrodoKEMMode & other) const
inline

Definition at line 81 of file frodo_mode.h.

81{ return !(*this == other); }

◆ operator==()

bool Botan::FrodoKEMMode::operator== ( const FrodoKEMMode & other) const
inline

Definition at line 79 of file frodo_mode.h.

79{ return m_mode == other.m_mode; }

◆ to_string()

std::string Botan::FrodoKEMMode::to_string ( ) const

Definition at line 79 of file frodo_mode.cpp.

79 {
80 switch(m_mode) {
82 return "FrodoKEM-640-SHAKE";
84 return "FrodoKEM-976-SHAKE";
86 return "FrodoKEM-1344-SHAKE";
88 return "eFrodoKEM-640-SHAKE";
90 return "eFrodoKEM-976-SHAKE";
92 return "eFrodoKEM-1344-SHAKE";
93
94 case FrodoKEM640_AES:
95 return "FrodoKEM-640-AES";
96 case FrodoKEM976_AES:
97 return "FrodoKEM-976-AES";
99 return "FrodoKEM-1344-AES";
100 case eFrodoKEM640_AES:
101 return "eFrodoKEM-640-AES";
102 case eFrodoKEM976_AES:
103 return "eFrodoKEM-976-AES";
105 return "eFrodoKEM-1344-AES";
106 }
107
109}
#define BOTAN_ASSERT_UNREACHABLE()
Definition assert.h:137

References BOTAN_ASSERT_UNREACHABLE, eFrodoKEM1344_AES, eFrodoKEM1344_SHAKE, eFrodoKEM640_AES, eFrodoKEM640_SHAKE, eFrodoKEM976_AES, eFrodoKEM976_SHAKE, FrodoKEM1344_AES, FrodoKEM1344_SHAKE, FrodoKEM640_AES, FrodoKEM640_SHAKE, FrodoKEM976_AES, and FrodoKEM976_SHAKE.

Referenced by object_identifier().


The documentation for this class was generated from the following files: