Botan 2.1.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 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 <cstddef>
12 #include <map>
13 #include <string>
14 #include <botan/assert.h>
15 #include <botan/types.h>
16 #include <botan/xmss_wots_parameters.h>
17
18 namespace Botan {
19
20 /**
21 * Descibes a signature method for XMSS, as defined in:
22 * [1] XMSS: Extended Hash-Based Signatures,
23 * draft-itrf-cfrg-xmss-hash-based-signatures-06
24 * Release: July 2016.
25 * https://datatracker.ietf.org/doc/
26 * draft-irtf-cfrg-xmss-hash-based-signatures/?include_text=1
27 **/
28 class BOTAN_DLL XMSS_Parameters
29 {
30 public:
31 enum xmss_algorithm_t
32 {
33 XMSS_SHA2_256_W16_H10 = 0x01000001,
34 XMSS_SHA2_256_W16_H16 = 0x02000002,
35 XMSS_SHA2_256_W16_H20 = 0x03000003,
36 XMSS_SHA2_512_W16_H10 = 0x04000004,
37 XMSS_SHA2_512_W16_H16 = 0x05000005,
38 XMSS_SHA2_512_W16_H20 = 0x06000006,
39 XMSS_SHAKE128_W16_H10 = 0x07000007,
40 XMSS_SHAKE128_W16_H16 = 0x08000008,
41 XMSS_SHAKE128_W16_H20 = 0x09000009,
42 XMSS_SHAKE256_W16_H10 = 0x0a00000a,
43 XMSS_SHAKE256_W16_H16 = 0x0b00000b,
44 XMSS_SHAKE256_W16_H20 = 0x0c00000c
45 };
46
47 static xmss_algorithm_t xmss_id_from_string(const std::string& algo_name);
48
49 XMSS_Parameters(const std::string& algo_name);
50 XMSS_Parameters(xmss_algorithm_t oid);
51
52 /**
53 * @return XMSS registry name for the chosen parameter set.
54 **/
55 const std::string& name() const
56 {
57 return m_name;
58 }
59
60 const std::string& hash_function_name() const
61 {
62 return m_hash_name;
63 }
64
65 /**
66 * Retrieves the uniform length of a message, and the size of
67 * each node. This correlates to XMSS parameter "n" defined
68 * in [1].
69 *
70 * @return element length in bytes.
71 **/
72 size_t element_size() const { return m_element_size; }
73
74 /**
75 * @returns The height (number of levels - 1) of the tree
76 **/
77 size_t tree_height() const { return m_tree_height; }
78
79 /**
80 * The Winternitz parameter.
81 *
82 * @return numeric base used for internal representation of
83 * data.
84 **/
85 size_t wots_parameter() const { return m_w; }
86
87 size_t len() const { return m_len; }
88
89 xmss_algorithm_t oid() const { return m_oid; }
90
91 XMSS_WOTS_Parameters::ots_algorithm_t ots_oid() const
92 {
93 return m_wots_oid;
94 }
95
96 /**
97 * Returns the estimated pre-quantum security level of
98 * the chosen algorithm.
99 **/
100 size_t estimated_strength() const
101 {
102 return m_strength;
103 }
104
105 bool operator==(const XMSS_Parameters& p) const
106 {
107 return m_oid == p.m_oid;
108 }
109
110 private:
111 xmss_algorithm_t m_oid;
112 XMSS_WOTS_Parameters::ots_algorithm_t m_wots_oid;
113 std::string m_name;
114 std::string m_hash_name;
115 size_t m_element_size;
116 size_t m_tree_height;
117 size_t m_w;
118 size_t m_len;
119 size_t m_strength;
120 };
121
122 }
123
124 #endif
Botan::XMSS_Parameters::element_size
size_t element_size() const
Definition: xmss_parameters.h:72
m_name
std::string m_name
Definition: openssl_hash.cpp:69
Botan::XMSS_Parameters::ots_oid
XMSS_WOTS_Parameters::ots_algorithm_t ots_oid() const
Definition: xmss_parameters.h:91
Botan::XMSS_Parameters::tree_height
size_t tree_height() const
Definition: xmss_parameters.h:77
m_oid
OID m_oid
Definition: x509_ext.cpp:682
Botan::XMSS_Parameters
Definition: xmss_parameters.h:28
Botan::XMSS_Parameters::operator==
bool operator==(const XMSS_Parameters &p) const
Definition: xmss_parameters.h:105
Botan::XMSS_Parameters::oid
xmss_algorithm_t oid() const
Definition: xmss_parameters.h:89
Botan::XMSS_Parameters::wots_parameter
size_t wots_parameter() const
Definition: xmss_parameters.h:85
Botan
Definition: alg_id.cpp:13
Botan::XMSS_Parameters::name
const std::string & name() const
Definition: xmss_parameters.h:55
Botan::XMSS_WOTS_Parameters::ots_algorithm_t
ots_algorithm_t
Definition: xmss_wots_parameters.h:37
Botan::XMSS_Parameters::len
size_t len() const
Definition: xmss_parameters.h:87
Botan::XMSS_Parameters::xmss_algorithm_t
xmss_algorithm_t
Definition: xmss_parameters.h:31
Botan::XMSS_Parameters::estimated_strength
size_t estimated_strength() const
Definition: xmss_parameters.h:100
Botan::XMSS_Parameters::hash_function_name
const std::string & hash_function_name() const
Definition: xmss_parameters.h:60