Botan 3.12.0
Crypto and TLS for C&
sphincsplus.cpp
Go to the documentation of this file.
1/*
2* SLH-DSA - Stateless Hash-Based Digital Signature Standard - FIPS 205
3* (C) 2023 Jack Lloyd
4* 2023 Fabian Albert, René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7**/
8
9#include <botan/sphincsplus.h>
10
11#include <botan/rng.h>
12#include <botan/internal/buffer_slicer.h>
13#include <botan/internal/buffer_stuffer.h>
14#include <botan/internal/concat_util.h>
15#include <botan/internal/int_utils.h>
16#include <botan/internal/pk_ops_impl.h>
17#include <botan/internal/sp_fors.h>
18#include <botan/internal/sp_hash.h>
19#include <botan/internal/sp_hypertree.h>
20#include <botan/internal/sp_treehash.h>
21#include <botan/internal/sp_types.h>
22#include <botan/internal/sp_wots.h>
23#include <botan/internal/sp_xmss.h>
24
25#include <utility>
26
27#if !defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHA2) and !defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHAKE) and \
28 !defined(BOTAN_HAS_SLH_DSA_WITH_SHA2) and !defined(BOTAN_HAS_SLH_DSA_WITH_SHAKE)
29static_assert(
30 false,
31 "botan module 'sphincsplus_common' is useful only when enabling at least 'sphincsplus_sha2', 'sphincsplus_shake', 'slh_dsa_sha2', or 'slh_dsa_shake'");
32#endif
33
34namespace Botan {
35
36namespace {
37// FIPS 205, Algorithm 22, line 8
39 const Sphincs_Parameters& params,
41 BOTAN_ARG_CHECK(params.is_slh_dsa() || context.empty(), "Context is not supported for SPHINCS+");
42#if defined(BOTAN_HAS_SLH_DSA_WITH_SHA2) || defined(BOTAN_HAS_SLH_DSA_WITH_SHAKE)
43 if(params.is_slh_dsa()) {
44 // prefix (no pre-hash mode): input mode byte + |ctx| + ctx
45 const uint8_t input_mode_byte = 0x00; // Pure (TODO: pre-hash mode: 0x01)
46 return {
48 store_be(input_mode_byte), store_be(checked_cast_to<uint8_t>(context.size())), context),
49 .message = std::move(msg),
50 };
51 }
52#endif
53#if defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHA2) || defined(BOTAN_HAS_SPHINCS_PLUS_WITH_SHAKE)
54 if(!params.is_slh_dsa()) {
55 // SPHINCS+ Round 3.1 uses the message without any prefix
56 return {
57 .prefix = {}, // SPHINCS+ has no prefix
58 .message = std::move(msg),
59 };
60 }
61#endif
62 throw Internal_Error("Missing message preparation logic for SLH-DSA or SPHINCS+");
63}
64} // namespace
65
66class SphincsPlus_PublicKeyInternal final {
67 public:
68 SphincsPlus_PublicKeyInternal(Sphincs_Parameters params,
69 SphincsPublicSeed public_seed,
70 SphincsTreeNode sphincs_root) :
71 m_params(params), m_public_seed(std::move(public_seed)), m_sphincs_root(std::move(sphincs_root)) {}
72
73 SphincsPlus_PublicKeyInternal(Sphincs_Parameters params, std::span<const uint8_t> key_bits) : m_params(params) {
74 if(key_bits.size() != m_params.public_key_bytes()) {
75 throw Decoding_Error("SLH-DSA (or SPHINCS+) Public Key doesn't have the expected length");
76 }
77
78 BufferSlicer s(key_bits);
79 m_public_seed = s.copy<SphincsPublicSeed>(params.n());
80 m_sphincs_root = s.copy<SphincsTreeNode>(params.n());
81
82 BOTAN_ASSERT_NOMSG(s.empty());
83 }
84
85 std::vector<uint8_t> key_bits() const { return concat<std::vector<uint8_t>>(m_public_seed, m_sphincs_root); }
86
87 const SphincsPublicSeed& seed() const { return m_public_seed; }
88
89 const SphincsTreeNode& root() const { return m_sphincs_root; }
90
91 const Sphincs_Parameters& parameters() const { return m_params; }
92
93 private:
94 Sphincs_Parameters m_params;
95 SphincsPublicSeed m_public_seed;
96 SphincsTreeNode m_sphincs_root;
97};
98
99class SphincsPlus_PrivateKeyInternal final {
100 public:
101 SphincsPlus_PrivateKeyInternal(SphincsSecretSeed secret_seed, SphincsSecretPRF prf) :
102 m_secret_seed(std::move(secret_seed)), m_prf(std::move(prf)) {}
103
104 SphincsPlus_PrivateKeyInternal(const Sphincs_Parameters& params, std::span<const uint8_t> key_bits) {
105 if(key_bits.size() != params.private_key_bytes() - params.public_key_bytes()) {
106 throw Decoding_Error("SLH-DSA (or SPHINCS+) Private Key doesn't have the expected length");
107 }
108
109 BufferSlicer s(key_bits);
110 m_secret_seed = s.copy<SphincsSecretSeed>(params.n());
111 m_prf = s.copy<SphincsSecretPRF>(params.n());
112
113 BOTAN_ASSERT_NOMSG(s.empty());
114 }
115
116 const SphincsSecretSeed& seed() const { return m_secret_seed; }
117
118 const SphincsSecretPRF& prf() const { return m_prf; }
119
120 secure_vector<uint8_t> key_bits() const { return concat<secure_vector<uint8_t>>(m_secret_seed, m_prf); }
121
122 private:
123 SphincsSecretSeed m_secret_seed;
124 SphincsSecretPRF m_prf;
125};
126
127SphincsPlus_PublicKey::SphincsPlus_PublicKey(std::span<const uint8_t> pub_key,
129 Sphincs_Hash_Type hash) :
130 SphincsPlus_PublicKey(pub_key, Sphincs_Parameters::create(type, hash)) {}
131
132SphincsPlus_PublicKey::SphincsPlus_PublicKey(std::span<const uint8_t> pub_key, Sphincs_Parameters params) :
133 m_public(std::make_shared<SphincsPlus_PublicKeyInternal>(params, pub_key)) {
134 if(!params.is_available()) {
135 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
136 }
137}
138
139SphincsPlus_PublicKey::SphincsPlus_PublicKey(const AlgorithmIdentifier& alg_id, std::span<const uint8_t> key_bits) :
140 SphincsPlus_PublicKey(key_bits, Sphincs_Parameters::create(alg_id.oid())) {}
141
143
145 return m_public->parameters().n() * 8;
146}
147
149 return m_public->parameters().is_slh_dsa() ? "SLH-DSA" : "SPHINCS+";
150}
151
153 return m_public->parameters().bitsec();
154}
155
157 return m_public->parameters().algorithm_identifier();
158}
159
161 return m_public->parameters().object_identifier();
162}
163
164bool SphincsPlus_PublicKey::check_key(RandomNumberGenerator& /*rng*/, bool /*strong*/) const {
165 // Nothing to check for the public key. It's literally just hashes. :-)
166 // A sign/verify roundtrip for the private key could be added for strong
167 // validation, but SLH-DSA signing is very expensive.
168 return true;
169}
170
171std::vector<uint8_t> SphincsPlus_PublicKey::raw_public_key_bits() const {
172 return m_public->key_bits();
173}
174
175std::vector<uint8_t> SphincsPlus_PublicKey::public_key_bits() const {
176 // Currently, there isn't a finalized definition of an ASN.1 structure for
177 // SLH-DSA or SPHINCS+ public keys. Therefore, we return the raw public key bits.
178 return raw_public_key_bits();
179}
180
181std::unique_ptr<Private_Key> SphincsPlus_PublicKey::generate_another(RandomNumberGenerator& rng) const {
182 return std::make_unique<SphincsPlus_PrivateKey>(rng, m_public->parameters());
183}
184
185namespace {
186
187class SphincsPlus_Verification_Operation final : public PK_Ops::Verification {
188 public:
189 explicit SphincsPlus_Verification_Operation(std::shared_ptr<SphincsPlus_PublicKeyInternal> pub_key) :
190 m_public(std::move(pub_key)),
191 m_hashes(Botan::Sphincs_Hash_Functions::create(m_public->parameters(), m_public->seed())),
192 m_context(/* TODO: Add API */ {}) {
193 BOTAN_ARG_CHECK(m_context.size() <= 255, "Context must not exceed 255 bytes");
194
195 if(!m_public->parameters().is_available()) {
196 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
197 }
198 }
199
200 /**
201 * Add more data to the message currently being signed
202 * @param msg the message
203 */
204 void update(std::span<const uint8_t> msg) override {
205 // TODO(For Pre-Hash Mode): We need to stream the message into a hash function.
206 m_msg_buffer.get().insert(m_msg_buffer.end(), msg.begin(), msg.end());
207 }
208
209 /**
210 * Perform a verification operation
211 */
212 bool is_valid_signature(std::span<const uint8_t> sig) override {
213 const auto internal_msg = prepare_message(std::exchange(m_msg_buffer, {}), m_public->parameters(), m_context);
214 return slh_verify_internal(internal_msg, sig);
215 }
216
217 std::string hash_function() const override { return m_hashes->msg_hash_function_name(); }
218
219 private:
220 /// FIPS 205, Algorithm 20
221 bool slh_verify_internal(const SphincsMessageInternal& msg, std::span<const uint8_t> sig) {
222 const auto& p = m_public->parameters();
223 if(sig.size() != p.sphincs_signature_bytes()) {
224 return false;
225 }
226
227 BufferSlicer s(sig);
228 // Compute leaf and tree index from R
229 const auto msg_random_s = s.take<SphincsMessageRandomness>(p.n());
230 auto [mhash, tree_idx, leaf_idx] = m_hashes->H_msg(msg_random_s, m_public->root(), msg);
231
232 // Reconstruct the FORS tree
233 Sphincs_Address fors_addr(Sphincs_Address_Type::ForsTree);
234 fors_addr.set_tree_address(tree_idx).set_keypair_address(leaf_idx);
235 const auto fors_sig_s = s.take<ForsSignature>(p.fors_signature_bytes());
236 auto fors_root = fors_public_key_from_signature(mhash, fors_sig_s, fors_addr, p, *m_hashes);
237
238 // Verify the hypertree signature
239 const auto ht_sig_s = s.take<SphincsHypertreeSignature>(p.ht_signature_bytes());
240 BOTAN_ASSERT_NOMSG(s.empty());
241 return ht_verify(fors_root, ht_sig_s, m_public->root(), tree_idx, leaf_idx, p, *m_hashes);
242 }
243
244 std::shared_ptr<SphincsPlus_PublicKeyInternal> m_public;
245 std::unique_ptr<Sphincs_Hash_Functions> m_hashes;
246 SphincsInputMessage m_msg_buffer;
247 SphincsContext m_context;
248};
249
250} // namespace
251
252std::unique_ptr<PK_Ops::Verification> SphincsPlus_PublicKey::create_verification_op(std::string_view /*params*/,
253 std::string_view provider) const {
254 if(provider.empty() || provider == "base") {
255 return std::make_unique<SphincsPlus_Verification_Operation>(m_public);
256 }
257 throw Provider_Not_Found(algo_name(), provider);
258}
259
260std::unique_ptr<PK_Ops::Verification> SphincsPlus_PublicKey::create_x509_verification_op(
261 const AlgorithmIdentifier& signature_algorithm, std::string_view provider) const {
262 if(provider.empty() || provider == "base") {
263 if(signature_algorithm != this->algorithm_identifier()) {
264 throw Decoding_Error("Unexpected AlgorithmIdentifier for SLH-DSA (or SPHINCS+) signature");
265 }
266 return std::make_unique<SphincsPlus_Verification_Operation>(m_public);
267 }
268 throw Provider_Not_Found(algo_name(), provider);
269}
270
274
275namespace {
276
277std::span<const uint8_t> slice_off_public_key(const OID& oid, std::span<const uint8_t> key_bits) {
278 const auto params = Sphincs_Parameters::create(oid);
279 // Note: We need to transiently instantiate the `Sphincs_Parameters` object
280 // to know the size of the public/private key. That's slightly
281 // inefficient but was the best we could do. Once we get rid of the
282 // PublicKey-PrivateKey inheritance, we might want to reconsider this
283 // control flow.
284 if(key_bits.size() != params.private_key_bytes()) {
285 throw Decoding_Error("Sphincs Private Key doesn't have the expected length");
286 }
287
288 return key_bits.subspan(params.private_key_bytes() - params.public_key_bytes());
289}
290
291} // namespace
292
293SphincsPlus_PrivateKey::SphincsPlus_PrivateKey(std::span<const uint8_t> private_key,
295 Sphincs_Hash_Type hash) :
296 SphincsPlus_PrivateKey(private_key, Sphincs_Parameters::create(type, hash)) {}
297
298SphincsPlus_PrivateKey::SphincsPlus_PrivateKey(const AlgorithmIdentifier& alg_id, std::span<const uint8_t> key_bits) :
299 SphincsPlus_PrivateKey(key_bits, Sphincs_Parameters::create(alg_id.oid())) {}
300
301SphincsPlus_PrivateKey::SphincsPlus_PrivateKey(std::span<const uint8_t> private_key, Sphincs_Parameters params) :
302 SphincsPlus_PublicKey(slice_off_public_key(params.object_identifier(), private_key), params) {
303 if(!params.is_available()) {
304 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
305 }
306
307 const auto private_portion_bytes = params.private_key_bytes() - params.public_key_bytes();
308 BOTAN_ASSERT_NOMSG(private_key.size() >= private_portion_bytes);
309
310 m_private = std::make_shared<SphincsPlus_PrivateKeyInternal>(params, private_key.first(private_portion_bytes));
311}
312
317
318// FIPS 205, Algorithm 21
320 if(!params.is_available()) {
321 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
322 }
323 auto sk_seed = rng.random_vec<SphincsSecretSeed>(params.n());
324 auto sk_prf = rng.random_vec<SphincsSecretPRF>(params.n());
325
326 m_private = std::make_shared<SphincsPlus_PrivateKeyInternal>(std::move(sk_seed), std::move(sk_prf));
327
328 auto pub_seed = rng.random_vec<SphincsPublicSeed>(params.n());
329 auto hashes = Sphincs_Hash_Functions::create(params, pub_seed);
330 auto root = xmss_gen_root(params, m_private->seed(), *hashes);
331
332 m_public = std::make_shared<SphincsPlus_PublicKeyInternal>(params, std::move(pub_seed), std::move(root));
333}
334
336
338 return concat(m_private->key_bits(), m_public->key_bits());
339}
340
344
345std::unique_ptr<Public_Key> SphincsPlus_PrivateKey::public_key() const {
346 return std::make_unique<SphincsPlus_PublicKey>(*this);
347}
348
349namespace {
350
351class SphincsPlus_Signature_Operation final : public PK_Ops::Signature {
352 public:
353 SphincsPlus_Signature_Operation(std::shared_ptr<SphincsPlus_PrivateKeyInternal> private_key,
354 std::shared_ptr<SphincsPlus_PublicKeyInternal> public_key,
355 bool randomized) :
356 m_private(std::move(private_key)),
357 m_public(std::move(public_key)),
358 m_hashes(Botan::Sphincs_Hash_Functions::create(m_public->parameters(), m_public->seed())),
359 m_randomized(randomized),
360 m_context(/* TODO: add API for context */ {}) {
361 BOTAN_ARG_CHECK(m_context.size() <= 255, "Context must not exceed 255 bytes");
362 BOTAN_ARG_CHECK(m_public->parameters().is_available(),
363 "The selected SLH-DSA (or SPHINCS+) instance is not available in this build.");
364 }
365
366 void update(std::span<const uint8_t> msg) override {
367 // TODO(For Pre-Hash Mode): We need to stream the message into a hash function.
368 m_msg_buffer.get().insert(m_msg_buffer.end(), msg.begin(), msg.end());
369 }
370
371 std::vector<uint8_t> sign(RandomNumberGenerator& rng) override {
372 std::optional<SphincsOptionalRandomness> addrnd = std::nullopt;
373 if(m_randomized) {
374 addrnd = rng.random_vec<SphincsOptionalRandomness>(m_public->parameters().n());
375 }
376 auto internal_msg = prepare_message(std::exchange(m_msg_buffer, {}), m_public->parameters(), m_context);
377
378 return slh_sign_internal(internal_msg, addrnd);
379 }
380
381 size_t signature_length() const override { return m_public->parameters().sphincs_signature_bytes(); }
382
383 AlgorithmIdentifier algorithm_identifier() const override {
384 return m_public->parameters().algorithm_identifier();
385 }
386
387 std::string hash_function() const override { return m_hashes->msg_hash_function_name(); }
388
389 private:
390 // FIPS 205, Algorithm 19
391 std::vector<uint8_t> slh_sign_internal(const SphincsMessageInternal& message,
392 std::optional<StrongSpan<const SphincsOptionalRandomness>> addrnd) {
393 const auto& p = m_public->parameters();
394
395 std::vector<uint8_t> sphincs_sig_buffer(p.sphincs_signature_bytes());
396 BufferStuffer sphincs_sig(sphincs_sig_buffer);
397
398 // Compute and append the digest randomization value (R of spec).
399 // Use addrng for the randomized variant. Use the public seed for the deterministic one.
400 const auto opt_rand =
401 (addrnd.has_value()) ? addrnd.value() : StrongSpan<const SphincsOptionalRandomness>(m_public->seed());
402
403 auto msg_random_s = sphincs_sig.next<SphincsMessageRandomness>(p.n());
404 m_hashes->PRF_msg(msg_random_s, m_private->prf(), opt_rand, message);
405
406 // Derive the message digest and leaf index from R, PK and M.
407 auto [mhash, tree_idx, leaf_idx] = m_hashes->H_msg(msg_random_s, m_public->root(), message);
408
409 // Compute and append the FORS signature
410 Sphincs_Address fors_addr(Sphincs_Address_Type::ForsTree);
411 fors_addr.set_tree_address(tree_idx).set_keypair_address(leaf_idx);
412 auto fors_root = fors_sign_and_pkgen(sphincs_sig.next<ForsSignature>(p.fors_signature_bytes()),
413 mhash,
414 m_private->seed(),
415 fors_addr,
416 p,
417 *m_hashes);
418
419 // Compute and append the XMSS hypertree signature
420 ht_sign(sphincs_sig.next<SphincsHypertreeSignature>(p.ht_signature_bytes()),
421 fors_root,
422 m_private->seed(),
423 tree_idx,
424 leaf_idx,
425 p,
426 *m_hashes);
427
428 BOTAN_ASSERT_NOMSG(sphincs_sig.full());
429 return sphincs_sig_buffer;
430 }
431
432 std::shared_ptr<SphincsPlus_PrivateKeyInternal> m_private;
433 std::shared_ptr<SphincsPlus_PublicKeyInternal> m_public;
434 std::unique_ptr<Sphincs_Hash_Functions> m_hashes;
435 SphincsInputMessage m_msg_buffer;
436 bool m_randomized;
437 SphincsContext m_context;
438};
439
440} // namespace
441
443 std::string_view params,
444 std::string_view provider) const {
445 BOTAN_UNUSED(rng);
446 BOTAN_ARG_CHECK(params.empty() || params == "Deterministic" || params == "Randomized",
447 "Unexpected parameters for signing with SLH-DSA (or SPHINCS+)");
448
449 // FIPS 205, Section 9.2
450 // The hedged variant is the default and should be used on platforms where
451 // side-channel attacks are a concern.
452 const bool randomized = (params.empty() || params == "Randomized");
453 if(provider.empty() || provider == "base") {
454 return std::make_unique<SphincsPlus_Signature_Operation>(m_private, m_public, randomized);
455 }
456 throw Provider_Not_Found(algo_name(), provider);
457}
458
459} // namespace Botan
#define BOTAN_UNUSED
Definition assert.h:144
#define BOTAN_ASSERT_NOMSG(expr)
Definition assert.h:75
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:33
void random_vec(std::span< uint8_t > v)
Definition rng.h:204
secure_vector< uint8_t > raw_private_key_bits() const override
std::unique_ptr< PK_Ops::Signature > create_signature_op(RandomNumberGenerator &rng, std::string_view params, std::string_view provider) const override
SphincsPlus_PrivateKey(std::span< const uint8_t > private_key, Sphincs_Parameter_Set type, Sphincs_Hash_Type hash)
secure_vector< uint8_t > private_key_bits() const override
std::unique_ptr< Public_Key > public_key() const override
std::vector< uint8_t > public_key_bits() const override
std::vector< uint8_t > raw_public_key_bits() const override
std::unique_ptr< PK_Ops::Verification > create_x509_verification_op(const AlgorithmIdentifier &signature_algorithm, std::string_view provider) const override
std::unique_ptr< PK_Ops::Verification > create_verification_op(std::string_view params, std::string_view provider) const override
bool supports_operation(PublicKeyOperation op) const override
std::string algo_name() const override
size_t key_length() const override
std::unique_ptr< Private_Key > generate_another(RandomNumberGenerator &rng) const final
bool check_key(RandomNumberGenerator &rng, bool strong) const override
AlgorithmIdentifier algorithm_identifier() const override
std::shared_ptr< SphincsPlus_PublicKeyInternal > m_public
Definition sphincsplus.h:68
size_t estimated_strength() const override
SphincsPlus_PublicKey(std::span< const uint8_t > pub_key, Sphincs_Parameter_Set type, Sphincs_Hash_Type hash)
OID object_identifier() const override
static std::unique_ptr< Sphincs_Hash_Functions > create(const Sphincs_Parameters &sphincs_params, const SphincsPublicSeed &pub_seed)
Definition sp_hash.cpp:32
uint32_t private_key_bytes() const
uint32_t public_key_bytes() const
static Sphincs_Parameters create(Sphincs_Parameter_Set set, Sphincs_Hash_Type hash)
Gf448Elem root(const Gf448Elem &elem)
Compute the root of elem in the field.
Strong< std::vector< uint8_t >, struct SphincsTreeNode_ > SphincsTreeNode
Either an XMSS or FORS tree node or leaf.
Definition sp_types.h:70
SphincsTreeNode xmss_gen_root(const Sphincs_Parameters &params, const SphincsSecretSeed &secret_seed, Sphincs_Hash_Functions &hashes)
Definition sp_xmss.cpp:58
Strong< secure_vector< uint8_t >, struct SphincsMessageRandomness_ > SphincsMessageRandomness
Definition sp_types.h:64
Sphincs_Parameter_Set
SphincsTreeNode fors_sign_and_pkgen(StrongSpan< ForsSignature > sig_out, const SphincsHashedMessage &hashed_message, const SphincsSecretSeed &secret_seed, const Sphincs_Address &address, const Sphincs_Parameters &params, Sphincs_Hash_Functions &hashes)
FIPS 205, Algorithm 16: fors_sign (with simultaneous FORS pk generation).
Definition sp_fors.cpp:63
Strong< std::vector< uint8_t >, struct ForsSignature_ > ForsSignature
Definition sp_types.h:72
constexpr RT checked_cast_to(AT i)
Definition int_utils.h:74
void ht_sign(StrongSpan< SphincsHypertreeSignature > out_sig, const SphincsTreeNode &message_to_sign, const SphincsSecretSeed &secret_seed, XmssTreeIndexInLayer tree_index_in_layer, TreeNodeIndex idx_leaf, const Sphincs_Parameters &params, Sphincs_Hash_Functions &hashes)
FIPS 205, Algorithm 12: ht_sign.
Sphincs_Hash_Type
bool ht_verify(const SphincsTreeNode &signed_msg, StrongSpan< const SphincsHypertreeSignature > ht_sig, const SphincsTreeNode &pk_root, XmssTreeIndexInLayer tree_index_in_layer, TreeNodeIndex idx_leaf, const Sphincs_Parameters &params, Sphincs_Hash_Functions &hashes)
FIPS 205, Algorithm 13: ht_verify.
Strong< std::vector< uint8_t >, struct SphincsXmssSignature_ > SphincsHypertreeSignature
Definition sp_types.h:66
Strong< std::vector< uint8_t >, struct SphincsInputMessage_ > SphincsInputMessage
Definition sp_types.h:49
Strong< std::vector< uint8_t >, struct SphincsPublicSeed_ > SphincsPublicSeed
Definition sp_types.h:60
Strong< secure_vector< uint8_t >, struct SphincsSecretSeed_ > SphincsSecretSeed
Definition sp_types.h:61
Strong< secure_vector< uint8_t >, struct SphincsSecretPRF_ > SphincsSecretPRF
Definition sp_types.h:62
PublicKeyOperation
Definition pk_keys.h:46
constexpr auto concat(Rs &&... ranges)
Definition concat_util.h:90
SphincsTreeNode fors_public_key_from_signature(const SphincsHashedMessage &hashed_message, StrongSpan< const ForsSignature > signature, const Sphincs_Address &address, const Sphincs_Parameters &params, Sphincs_Hash_Functions &hashes)
FIPS 205, Algorithm 17: fors_pkFromSig.
Definition sp_fors.cpp:130
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:68
Strong< secure_vector< uint8_t >, struct SphincsOptionalRandomness_ > SphincsOptionalRandomness
Definition sp_types.h:63
constexpr auto store_be(ParamTs &&... params)
Definition loadstor.h:745
Strong< std::vector< uint8_t >, struct SphincsContext_ > SphincsContext
Definition sp_types.h:57
M' representation of FIPS 205 (the input to slh_sign_internal and slh_verify_internal).
Definition sp_types.h:52