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