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