Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

xmss_parameters.h
Go to the documentation of this file.
1 /*
2 * XMSS Parameters
3 * (C) 2016,2018 Matthias Gierlings
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 **/
7
8 #ifndef BOTAN_XMSS_PARAMETERS_H_
9 #define BOTAN_XMSS_PARAMETERS_H_
10
11 #include <botan/xmss_wots_parameters.h>
12 #include <string>
13
14 namespace Botan {
15
16 /**
17 * Descibes a signature method for XMSS, as defined in:
18 * [1] XMSS: Extended Hash-Based Signatures,
19 * Request for Comments: 8391
20 * Release: May 2018.
21 * https://datatracker.ietf.org/doc/rfc8391/
22 **/
23 class BOTAN_PUBLIC_API(2,0) XMSS_Parameters
24 {
25 public:
26 enum xmss_algorithm_t
27 {
28 XMSS_SHA2_10_256 = 0x00000001,
29 XMSS_SHA2_16_256 = 0x00000002,
30 XMSS_SHA2_20_256 = 0x00000003,
31 XMSS_SHA2_10_512 = 0x00000004,
32 XMSS_SHA2_16_512 = 0x00000005,
33 XMSS_SHA2_20_512 = 0x00000006,
34 XMSS_SHAKE_10_256 = 0x00000007,
35 XMSS_SHAKE_16_256 = 0x00000008,
36 XMSS_SHAKE_20_256 = 0x00000009,
37 XMSS_SHAKE_10_512 = 0x0000000a,
38 XMSS_SHAKE_16_512 = 0x0000000b,
39 XMSS_SHAKE_20_512 = 0x0000000c
40 };
41
42 static xmss_algorithm_t xmss_id_from_string(const std::string& algo_name);
43
44 XMSS_Parameters(const std::string& algo_name);
45 XMSS_Parameters(xmss_algorithm_t oid);
46
47 /**
48 * @return XMSS registry name for the chosen parameter set.
49 **/
50 const std::string& name() const
51 {
52 return m_name;
53 }
54
55 const std::string& hash_function_name() const
56 {
57 return m_hash_name;
58 }
59
60 /**
61 * Retrieves the uniform length of a message, and the size of
62 * each node. This correlates to XMSS parameter "n" defined
63 * in [1].
64 *
65 * @return element length in bytes.
66 **/
67 size_t element_size() const { return m_element_size; }
68
69 /**
70 * @returns The height (number of levels - 1) of the tree
71 **/
72 size_t tree_height() const { return m_tree_height; }
73
74 /**
75 * The Winternitz parameter.
76 *
77 * @return numeric base used for internal representation of
78 * data.
79 **/
80 size_t wots_parameter() const { return m_w; }
81
82 size_t len() const { return m_len; }
83
84 xmss_algorithm_t oid() const { return m_oid; }
85
86 XMSS_WOTS_Parameters::ots_algorithm_t ots_oid() const
87 {
88 return m_wots_oid;
89 }
90
91 /**
92 * Returns the estimated pre-quantum security level of
93 * the chosen algorithm.
94 **/
95 size_t estimated_strength() const
96 {
97 return m_strength;
98 }
99
100 bool operator==(const XMSS_Parameters& p) const
101 {
102 return m_oid == p.m_oid;
103 }
104
105 private:
106 xmss_algorithm_t m_oid;
107 XMSS_WOTS_Parameters::ots_algorithm_t m_wots_oid;
108 std::string m_name;
109 std::string m_hash_name;
110 size_t m_element_size;
111 size_t m_tree_height;
112 size_t m_w;
113 size_t m_len;
114 size_t m_strength;
115 };
116
117 }
118
119 #endif
Botan::XMSS_Parameters::element_size
size_t element_size() const
Definition: xmss_parameters.h:67
m_name
std::string m_name
Definition: openssl_hash.cpp:97
Botan::XMSS_Parameters::ots_oid
XMSS_WOTS_Parameters::ots_algorithm_t ots_oid() const
Definition: xmss_parameters.h:86
Botan::XMSS_Parameters::tree_height
size_t tree_height() const
Definition: xmss_parameters.h:72
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
m_oid
OID m_oid
Definition: x509_ext.cpp:747
Botan::XMSS_Parameters
Definition: xmss_parameters.h:23
Botan::XMSS_Parameters::operator==
bool operator==(const XMSS_Parameters &p) const
Definition: xmss_parameters.h:100
Botan::XMSS_Parameters::oid
xmss_algorithm_t oid() const
Definition: xmss_parameters.h:84
Botan::XMSS_Parameters::wots_parameter
size_t wots_parameter() const
Definition: xmss_parameters.h:80
Botan
Definition: alg_id.cpp:13
Botan::XMSS_Parameters::name
const std::string & name() const
Definition: xmss_parameters.h:50
Botan::XMSS_WOTS_Parameters::ots_algorithm_t
ots_algorithm_t
Definition: xmss_wots_parameters.h:29
Botan::XMSS_Parameters::len
size_t len() const
Definition: xmss_parameters.h:82
Botan::XMSS_Parameters::xmss_algorithm_t
xmss_algorithm_t
Definition: xmss_parameters.h:26
Botan::XMSS_Parameters::estimated_strength
size_t estimated_strength() const
Definition: xmss_parameters.h:95
Botan::XMSS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_parameters.h:55
m_len
size_t m_len
Definition: mem_pool.cpp:192