Botan 3.4.0
Crypto and TLS for C&
Public Member Functions | Static Public Member Functions | List of all members
Botan::Sphincs_Parameters Class Referencefinal

#include <sp_parameters.h>

Public Member Functions

uint32_t a () const
 
AlgorithmIdentifier algorithm_identifier () const
 
uint32_t bitsec () const
 
uint32_t d () const
 
uint32_t fors_message_bytes () const
 
uint32_t fors_signature_bytes () const
 
uint32_t h () const
 
uint32_t h_msg_digest_bytes () const
 
std::string hash_name () const
 
Sphincs_Hash_Type hash_type () const
 
uint32_t ht_signature_bytes () const
 
uint32_t k () const
 
uint32_t leaf_digest_bytes () const
 
uint32_t log_w () const
 
uint32_t n () const
 
OID object_identifier () const
 
Sphincs_Parameter_Set parameter_set () const
 
uint32_t private_key_bytes () const
 
uint32_t public_key_bytes () const
 
uint32_t sphincs_signature_bytes () const
 
std::string to_string () const
 
uint32_t tree_digest_bytes () const
 
uint32_t w () const
 
uint32_t wots_bytes () const
 
uint32_t wots_checksum_bytes () const
 
uint32_t wots_len () const
 
uint32_t wots_len_1 () const
 
uint32_t wots_len_2 () const
 
uint32_t xmss_signature_bytes () const
 
uint32_t xmss_tree_height () const
 

Static Public Member Functions

static Sphincs_Parameters create (const OID &oid)
 
static Sphincs_Parameters create (Sphincs_Parameter_Set set, Sphincs_Hash_Type hash)
 
static Sphincs_Parameters create (std::string_view name)
 

Detailed Description

Container for all SPHINCS+ parameters defined by a specific instance (see Table 3 of Sphincs+ round 3.1 spec). Also contains getters for various parameters that are derived from the given parameters.

Definition at line 38 of file sp_parameters.h.

Member Function Documentation

◆ a()

uint32_t Botan::Sphincs_Parameters::a ( ) const
inline

This is the desired height of the FORS trees, aka log(t) with t being the number of leaves in each FORS tree.

Returns
Height of the FORS trees

Definition at line 95 of file sp_parameters.h.

95{ return m_a; }

Referenced by Botan::fors_public_key_from_signature(), and Botan::fors_sign_and_pkgen().

◆ algorithm_identifier()

AlgorithmIdentifier Botan::Sphincs_Parameters::algorithm_identifier ( ) const
Returns
the algorithm specifier for the selected parameter set

Definition at line 204 of file sp_parameters.cpp.

204 {
205 return AlgorithmIdentifier(object_identifier(), AlgorithmIdentifier::USE_EMPTY_PARAM);
206}

◆ bitsec()

uint32_t Botan::Sphincs_Parameters::bitsec ( ) const
inline
Returns
the bit security given by Table 3 (NIST R3.1 submission, page 39) for the selected parameter set

Definition at line 111 of file sp_parameters.h.

111{ return m_bitsec; }

◆ create() [1/3]

Sphincs_Parameters Botan::Sphincs_Parameters::create ( const OID & oid)
static

Definition at line 196 of file sp_parameters.cpp.

196 {
197 return Sphincs_Parameters::create(oid.to_formatted_string());
198}
static Sphincs_Parameters create(Sphincs_Parameter_Set set, Sphincs_Hash_Type hash)

References Botan::OID::to_formatted_string().

◆ create() [2/3]

Sphincs_Parameters Botan::Sphincs_Parameters::create ( Sphincs_Parameter_Set set,
Sphincs_Hash_Type hash )
static

Definition at line 155 of file sp_parameters.cpp.

155 {
156 // See "Table 3" in SPHINCS+ specification (NIST R3.1 submission, page 39)
157 switch(set) {
159 return Sphincs_Parameters(set, hash, 16, 63, 7, 12, 14, 16, 133);
161 return Sphincs_Parameters(set, hash, 16, 66, 22, 6, 33, 16, 128);
162
164 return Sphincs_Parameters(set, hash, 24, 63, 7, 14, 17, 16, 193);
166 return Sphincs_Parameters(set, hash, 24, 66, 22, 8, 33, 16, 194);
167
169 return Sphincs_Parameters(set, hash, 32, 64, 8, 14, 22, 16, 255);
171 return Sphincs_Parameters(set, hash, 32, 68, 17, 9, 35, 16, 255);
172 }
174}
#define BOTAN_ASSERT_UNREACHABLE()
Definition assert.h:137

References BOTAN_ASSERT_UNREACHABLE.

Referenced by Botan::create_private_key().

◆ create() [3/3]

Sphincs_Parameters Botan::Sphincs_Parameters::create ( std::string_view name)
static

Definition at line 176 of file sp_parameters.cpp.

176 {
177 return Sphincs_Parameters::create(set_from_name(name), hash_from_name(name));
178}
std::string name

References name.

◆ d()

uint32_t Botan::Sphincs_Parameters::d ( ) const
inline
Returns
Number of XMSS layers in the SPHINCS+ hypertree

Definition at line 87 of file sp_parameters.h.

87{ return m_d; }

Referenced by Botan::ht_sign(), Botan::ht_verify(), and Botan::xmss_gen_root().

◆ fors_message_bytes()

uint32_t Botan::Sphincs_Parameters::fors_message_bytes ( ) const
inline
Returns
the byte length of the FORS input message

Definition at line 166 of file sp_parameters.h.

166{ return m_fors_message_bytes; }

◆ fors_signature_bytes()

uint32_t Botan::Sphincs_Parameters::fors_signature_bytes ( ) const
inline
Returns
the byte length of a FORS signature

Definition at line 161 of file sp_parameters.h.

161{ return m_fors_sig_bytes; }

Referenced by Botan::fors_sign_and_pkgen().

◆ h()

uint32_t Botan::Sphincs_Parameters::h ( ) const
inline
Returns
Height of the SPHINCS+ hypertree

Definition at line 82 of file sp_parameters.h.

82{ return m_h; }

◆ h_msg_digest_bytes()

uint32_t Botan::Sphincs_Parameters::h_msg_digest_bytes ( ) const
inline
Returns
the byte length of the output of H_msg. Corresponds to m in the specification of H_msg in Section 7.2

Definition at line 197 of file sp_parameters.h.

197{ return m_h_msg_digest_bytes; }

◆ hash_name()

std::string Botan::Sphincs_Parameters::hash_name ( ) const
Returns
the algorithm specifier of the hash function to be used

Definition at line 180 of file sp_parameters.cpp.

180 {
181 switch(m_hash_type) {
183 return "SHA-256";
185 return fmt("SHAKE-256({})", 8 * n());
187 return "Haraka";
188 }
190}
std::string fmt(std::string_view format, const T &... args)
Definition fmt.h:53
@ Haraka
Haraka is currently not supported.

References BOTAN_ASSERT_UNREACHABLE, and Botan::fmt().

◆ hash_type()

Sphincs_Hash_Type Botan::Sphincs_Parameters::hash_type ( ) const
inline
Returns
the hash type used by those parameters

Definition at line 57 of file sp_parameters.h.

57{ return m_hash_type; }

Referenced by Botan::Sphincs_Hash_Functions::create().

◆ ht_signature_bytes()

uint32_t Botan::Sphincs_Parameters::ht_signature_bytes ( ) const
inline
Returns
the byte length of a the xmss hypertree signature

Definition at line 126 of file sp_parameters.h.

126{ return m_ht_sig_bytes; }

Referenced by Botan::ht_sign(), and Botan::ht_verify().

◆ k()

uint32_t Botan::Sphincs_Parameters::k ( ) const
inline
Returns
Number of FORS trees to use

Definition at line 100 of file sp_parameters.h.

100{ return m_k; }

Referenced by Botan::fors_public_key_from_signature(), and Botan::fors_sign_and_pkgen().

◆ leaf_digest_bytes()

uint32_t Botan::Sphincs_Parameters::leaf_digest_bytes ( ) const
inline
Returns
the byte length of the leaf index output of H_msg

Definition at line 191 of file sp_parameters.h.

191{ return m_leaf_digest_bytes; }

◆ log_w()

uint32_t Botan::Sphincs_Parameters::log_w ( ) const
inline
Returns
the base 2 logarithm of the Winternitz parameter for WOTS+ signatures

Definition at line 131 of file sp_parameters.h.

131{ return m_log_w; }

◆ n()

uint32_t Botan::Sphincs_Parameters::n ( ) const
inline

◆ object_identifier()

OID Botan::Sphincs_Parameters::object_identifier ( ) const
Returns
the OID of the algorithm specified by those parameters

Definition at line 200 of file sp_parameters.cpp.

200 {
201 return OID::from_string(to_string());
202}
static OID from_string(std::string_view str)
Definition asn1_oid.cpp:74
std::string to_string() const

◆ parameter_set()

Sphincs_Parameter_Set Botan::Sphincs_Parameters::parameter_set ( ) const
inline
Returns
the generic algorithm parameterization set to be used by those parameters

Definition at line 62 of file sp_parameters.h.

62{ return m_set; }

◆ private_key_bytes()

uint32_t Botan::Sphincs_Parameters::private_key_bytes ( ) const
inline
Returns
the byte length of an encoded private key for this parameter set

Definition at line 181 of file sp_parameters.h.

181{ return m_n * 2 + public_key_bytes(); }
uint32_t public_key_bytes() const

Referenced by Botan::SphincsPlus_PrivateKey::SphincsPlus_PrivateKey().

◆ public_key_bytes()

uint32_t Botan::Sphincs_Parameters::public_key_bytes ( ) const
inline
Returns
the byte length of an encoded public key for this parameter set

Definition at line 176 of file sp_parameters.h.

176{ return m_n * 2; }

Referenced by Botan::SphincsPlus_PrivateKey::SphincsPlus_PrivateKey().

◆ sphincs_signature_bytes()

uint32_t Botan::Sphincs_Parameters::sphincs_signature_bytes ( ) const
inline
Returns
the byte length of a Sphincs+ signature

Definition at line 171 of file sp_parameters.h.

171{ return m_sp_sig_bytes; }

◆ to_string()

std::string Botan::Sphincs_Parameters::to_string ( ) const
Returns
a string representation of this parameter set

Definition at line 192 of file sp_parameters.cpp.

192 {
193 return fmt("SphincsPlus-{}-{}", as_string(m_hash_type), as_string(m_set));
194}

References Botan::fmt().

◆ tree_digest_bytes()

uint32_t Botan::Sphincs_Parameters::tree_digest_bytes ( ) const
inline
Returns
the byte length of the tree index output of H_msg

Definition at line 186 of file sp_parameters.h.

186{ return m_tree_digest_bytes; }

◆ w()

uint32_t Botan::Sphincs_Parameters::w ( ) const
inline
Returns
the Winternitz parameter for WOTS+ signatures

Definition at line 105 of file sp_parameters.h.

105{ return m_w; }

Referenced by Botan::wots_public_key_from_signature(), and Botan::wots_sign_and_pkgen().

◆ wots_bytes()

uint32_t Botan::Sphincs_Parameters::wots_bytes ( ) const
inline
Returns
the byte length of a WOTS+ signature

Definition at line 151 of file sp_parameters.h.

151{ return m_wots_bytes; }

Referenced by Botan::ht_verify(), Botan::wots_sign_and_pkgen(), Botan::xmss_gen_root(), and Botan::xmss_sign_and_pkgen().

◆ wots_checksum_bytes()

uint32_t Botan::Sphincs_Parameters::wots_checksum_bytes ( ) const
inline
Returns
the number of bytes a WOTS+ signature consists of

Definition at line 156 of file sp_parameters.h.

156{ return m_wots_checksum_bytes; }

◆ wots_len()

uint32_t Botan::Sphincs_Parameters::wots_len ( ) const
inline
Returns
the len parameter for WOTS+ signatures

Definition at line 146 of file sp_parameters.h.

146{ return m_wots_len; }

Referenced by Botan::wots_public_key_from_signature(), and Botan::wots_sign_and_pkgen().

◆ wots_len_1()

uint32_t Botan::Sphincs_Parameters::wots_len_1 ( ) const
inline
Returns
the len1 parameter for WOTS+ signatures

Definition at line 136 of file sp_parameters.h.

136{ return m_wots_len1; }

Referenced by Botan::chain_lengths().

◆ wots_len_2()

uint32_t Botan::Sphincs_Parameters::wots_len_2 ( ) const
inline
Returns
the len2 parameter for WOTS+ signatures

Definition at line 141 of file sp_parameters.h.

141{ return m_wots_len2; }

Referenced by Botan::chain_lengths().

◆ xmss_signature_bytes()

uint32_t Botan::Sphincs_Parameters::xmss_signature_bytes ( ) const
inline
Returns
the byte length of a single xmss signature

Definition at line 121 of file sp_parameters.h.

121{ return m_xmss_sig_bytes; }

Referenced by Botan::ht_sign().

◆ xmss_tree_height()

uint32_t Botan::Sphincs_Parameters::xmss_tree_height ( ) const
inline
Returns
the tree height of an XMSS tree

Definition at line 116 of file sp_parameters.h.

116{ return m_xmss_tree_height; }

Referenced by Botan::ht_sign(), Botan::ht_verify(), Botan::xmss_gen_root(), and Botan::xmss_sign_and_pkgen().


The documentation for this class was generated from the following files: