Botan 2.19.0
Crypto and TLS for C&
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.h>
12#include <string>
13
14namespace 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 **/
24 {
25 public:
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
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;
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
size_t estimated_strength() const
size_t wots_parameter() const
size_t tree_height() const
xmss_algorithm_t oid() const
const std::string & hash_function_name() const
XMSS_WOTS_Parameters::ots_algorithm_t ots_oid() const
const std::string & name() const
size_t element_size() const
bool operator==(const XMSS_Parameters &p) const
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Definition: alg_id.cpp:13