Botan 3.11.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. It's literally just hashes. :-)
166 return true;
167}
168
169std::vector<uint8_t> SphincsPlus_PublicKey::raw_public_key_bits() const {
170 return m_public->key_bits();
171}
172
173std::vector<uint8_t> SphincsPlus_PublicKey::public_key_bits() const {
174 // Currently, there isn't a finalized definition of an ASN.1 structure for
175 // SLH-DSA or SPHINCS+ public keys. Therefore, we return the raw public key bits.
176 return raw_public_key_bits();
177}
178
179std::unique_ptr<Private_Key> SphincsPlus_PublicKey::generate_another(RandomNumberGenerator& rng) const {
180 return std::make_unique<SphincsPlus_PrivateKey>(rng, m_public->parameters());
181}
182
183namespace {
184
185class SphincsPlus_Verification_Operation final : public PK_Ops::Verification {
186 public:
187 explicit SphincsPlus_Verification_Operation(std::shared_ptr<SphincsPlus_PublicKeyInternal> pub_key) :
188 m_public(std::move(pub_key)),
189 m_hashes(Botan::Sphincs_Hash_Functions::create(m_public->parameters(), m_public->seed())),
190 m_context(/* TODO: Add API */ {}) {
191 BOTAN_ARG_CHECK(m_context.size() <= 255, "Context must not exceed 255 bytes");
192
193 if(!m_public->parameters().is_available()) {
194 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
195 }
196 }
197
198 /**
199 * Add more data to the message currently being signed
200 * @param msg the message
201 */
202 void update(std::span<const uint8_t> msg) override {
203 // TODO(For Pre-Hash Mode): We need to stream the message into a hash function.
204 m_msg_buffer.get().insert(m_msg_buffer.end(), msg.begin(), msg.end());
205 }
206
207 /**
208 * Perform a verification operation
209 */
210 bool is_valid_signature(std::span<const uint8_t> sig) override {
211 const auto internal_msg = prepare_message(std::exchange(m_msg_buffer, {}), m_public->parameters(), m_context);
212 return slh_verify_internal(internal_msg, sig);
213 }
214
215 std::string hash_function() const override { return m_hashes->msg_hash_function_name(); }
216
217 private:
218 /// FIPS 205, Algorithm 20
219 bool slh_verify_internal(const SphincsMessageInternal& msg, std::span<const uint8_t> sig) {
220 const auto& p = m_public->parameters();
221 if(sig.size() != p.sphincs_signature_bytes()) {
222 return false;
223 }
224
225 BufferSlicer s(sig);
226 // Compute leaf and tree index from R
227 const auto msg_random_s = s.take<SphincsMessageRandomness>(p.n());
228 auto [mhash, tree_idx, leaf_idx] = m_hashes->H_msg(msg_random_s, m_public->root(), msg);
229
230 // Reconstruct the FORS tree
231 Sphincs_Address fors_addr(Sphincs_Address_Type::ForsTree);
232 fors_addr.set_tree_address(tree_idx).set_keypair_address(leaf_idx);
233 const auto fors_sig_s = s.take<ForsSignature>(p.fors_signature_bytes());
234 auto fors_root = fors_public_key_from_signature(mhash, fors_sig_s, fors_addr, p, *m_hashes);
235
236 // Verify the hypertree signature
237 const auto ht_sig_s = s.take<SphincsHypertreeSignature>(p.ht_signature_bytes());
238 BOTAN_ASSERT_NOMSG(s.empty());
239 return ht_verify(fors_root, ht_sig_s, m_public->root(), tree_idx, leaf_idx, p, *m_hashes);
240 }
241
242 std::shared_ptr<SphincsPlus_PublicKeyInternal> m_public;
243 std::unique_ptr<Sphincs_Hash_Functions> m_hashes;
244 SphincsInputMessage m_msg_buffer;
245 SphincsContext m_context;
246};
247
248} // namespace
249
250std::unique_ptr<PK_Ops::Verification> SphincsPlus_PublicKey::create_verification_op(std::string_view /*params*/,
251 std::string_view provider) const {
252 if(provider.empty() || provider == "base") {
253 return std::make_unique<SphincsPlus_Verification_Operation>(m_public);
254 }
255 throw Provider_Not_Found(algo_name(), provider);
256}
257
258std::unique_ptr<PK_Ops::Verification> SphincsPlus_PublicKey::create_x509_verification_op(
259 const AlgorithmIdentifier& signature_algorithm, std::string_view provider) const {
260 if(provider.empty() || provider == "base") {
261 if(signature_algorithm != this->algorithm_identifier()) {
262 throw Decoding_Error("Unexpected AlgorithmIdentifier for SLH-DSA (or SPHINCS+) signature");
263 }
264 return std::make_unique<SphincsPlus_Verification_Operation>(m_public);
265 }
266 throw Provider_Not_Found(algo_name(), provider);
267}
268
272
273namespace {
274
275std::span<const uint8_t> slice_off_public_key(const OID& oid, std::span<const uint8_t> key_bits) {
276 const auto params = Sphincs_Parameters::create(oid);
277 // Note: We need to transiently instantiate the `Sphincs_Parameters` object
278 // to know the size of the public/private key. That's slightly
279 // inefficient but was the best we could do. Once we get rid of the
280 // PublicKey-PrivateKey inheritance, we might want to reconsider this
281 // control flow.
282 if(key_bits.size() != params.private_key_bytes()) {
283 throw Decoding_Error("Sphincs Private Key doesn't have the expected length");
284 }
285
286 return key_bits.subspan(params.private_key_bytes() - params.public_key_bytes());
287}
288
289} // namespace
290
291SphincsPlus_PrivateKey::SphincsPlus_PrivateKey(std::span<const uint8_t> private_key,
293 Sphincs_Hash_Type hash) :
294 SphincsPlus_PrivateKey(private_key, Sphincs_Parameters::create(type, hash)) {}
295
296SphincsPlus_PrivateKey::SphincsPlus_PrivateKey(const AlgorithmIdentifier& alg_id, std::span<const uint8_t> key_bits) :
297 SphincsPlus_PrivateKey(key_bits, Sphincs_Parameters::create(alg_id.oid())) {}
298
299SphincsPlus_PrivateKey::SphincsPlus_PrivateKey(std::span<const uint8_t> private_key, Sphincs_Parameters params) :
300 SphincsPlus_PublicKey(slice_off_public_key(params.object_identifier(), private_key), params) {
301 if(!params.is_available()) {
302 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
303 }
304
305 const auto private_portion_bytes = params.private_key_bytes() - params.public_key_bytes();
306 BOTAN_ASSERT_NOMSG(private_key.size() >= private_portion_bytes);
307
308 m_private = std::make_shared<SphincsPlus_PrivateKeyInternal>(params, private_key.first(private_portion_bytes));
309}
310
315
316// FIPS 205, Algorithm 21
318 if(!params.is_available()) {
319 throw Not_Implemented("This SPHINCS+ parameter set is not available in this configuration");
320 }
321 auto sk_seed = rng.random_vec<SphincsSecretSeed>(params.n());
322 auto sk_prf = rng.random_vec<SphincsSecretPRF>(params.n());
323
324 m_private = std::make_shared<SphincsPlus_PrivateKeyInternal>(std::move(sk_seed), std::move(sk_prf));
325
326 auto pub_seed = rng.random_vec<SphincsPublicSeed>(params.n());
327 auto hashes = Sphincs_Hash_Functions::create(params, pub_seed);
328 auto root = xmss_gen_root(params, m_private->seed(), *hashes);
329
330 m_public = std::make_shared<SphincsPlus_PublicKeyInternal>(params, std::move(pub_seed), std::move(root));
331}
332
334
336 return concat(m_private->key_bits(), m_public->key_bits());
337}
338
342
343std::unique_ptr<Public_Key> SphincsPlus_PrivateKey::public_key() const {
344 return std::make_unique<SphincsPlus_PublicKey>(*this);
345}
346
347namespace {
348
349class SphincsPlus_Signature_Operation final : public PK_Ops::Signature {
350 public:
351 SphincsPlus_Signature_Operation(std::shared_ptr<SphincsPlus_PrivateKeyInternal> private_key,
352 std::shared_ptr<SphincsPlus_PublicKeyInternal> public_key,
353 bool randomized) :
354 m_private(std::move(private_key)),
355 m_public(std::move(public_key)),
356 m_hashes(Botan::Sphincs_Hash_Functions::create(m_public->parameters(), m_public->seed())),
357 m_randomized(randomized),
358 m_context(/* TODO: add API for context */ {}) {
359 BOTAN_ARG_CHECK(m_context.size() <= 255, "Context must not exceed 255 bytes");
360 BOTAN_ARG_CHECK(m_public->parameters().is_available(),
361 "The selected SLH-DSA (or SPHINCS+) instance is not available in this build.");
362 }
363
364 void update(std::span<const uint8_t> msg) override {
365 // TODO(For Pre-Hash Mode): We need to stream the message into a hash function.
366 m_msg_buffer.get().insert(m_msg_buffer.end(), msg.begin(), msg.end());
367 }
368
369 std::vector<uint8_t> sign(RandomNumberGenerator& rng) override {
370 std::optional<SphincsOptionalRandomness> addrnd = std::nullopt;
371 if(m_randomized) {
372 addrnd = rng.random_vec<SphincsOptionalRandomness>(m_public->parameters().n());
373 }
374 auto internal_msg = prepare_message(std::exchange(m_msg_buffer, {}), m_public->parameters(), m_context);
375
376 return slh_sign_internal(internal_msg, addrnd);
377 }
378
379 size_t signature_length() const override { return m_public->parameters().sphincs_signature_bytes(); }
380
381 AlgorithmIdentifier algorithm_identifier() const override {
382 return m_public->parameters().algorithm_identifier();
383 }
384
385 std::string hash_function() const override { return m_hashes->msg_hash_function_name(); }
386
387 private:
388 // FIPS 205, Algorithm 19
389 std::vector<uint8_t> slh_sign_internal(const SphincsMessageInternal& message,
390 std::optional<StrongSpan<const SphincsOptionalRandomness>> addrnd) {
391 const auto& p = m_public->parameters();
392
393 std::vector<uint8_t> sphincs_sig_buffer(p.sphincs_signature_bytes());
394 BufferStuffer sphincs_sig(sphincs_sig_buffer);
395
396 // Compute and append the digest randomization value (R of spec).
397 // Use addrng for the randomized variant. Use the public seed for the deterministic one.
398 const auto opt_rand =
399 (addrnd.has_value()) ? addrnd.value() : StrongSpan<const SphincsOptionalRandomness>(m_public->seed());
400
401 auto msg_random_s = sphincs_sig.next<SphincsMessageRandomness>(p.n());
402 m_hashes->PRF_msg(msg_random_s, m_private->prf(), opt_rand, message);
403
404 // Derive the message digest and leaf index from R, PK and M.
405 auto [mhash, tree_idx, leaf_idx] = m_hashes->H_msg(msg_random_s, m_public->root(), message);
406
407 // Compute and append the FORS signature
408 Sphincs_Address fors_addr(Sphincs_Address_Type::ForsTree);
409 fors_addr.set_tree_address(tree_idx).set_keypair_address(leaf_idx);
410 auto fors_root = fors_sign_and_pkgen(sphincs_sig.next<ForsSignature>(p.fors_signature_bytes()),
411 mhash,
412 m_private->seed(),
413 fors_addr,
414 p,
415 *m_hashes);
416
417 // Compute and append the XMSS hypertree signature
418 ht_sign(sphincs_sig.next<SphincsHypertreeSignature>(p.ht_signature_bytes()),
419 fors_root,
420 m_private->seed(),
421 tree_idx,
422 leaf_idx,
423 p,
424 *m_hashes);
425
426 BOTAN_ASSERT_NOMSG(sphincs_sig.full());
427 return sphincs_sig_buffer;
428 }
429
430 std::shared_ptr<SphincsPlus_PrivateKeyInternal> m_private;
431 std::shared_ptr<SphincsPlus_PublicKeyInternal> m_public;
432 std::unique_ptr<Sphincs_Hash_Functions> m_hashes;
433 SphincsInputMessage m_msg_buffer;
434 bool m_randomized;
435 SphincsContext m_context;
436};
437
438} // namespace
439
441 std::string_view params,
442 std::string_view provider) const {
443 BOTAN_UNUSED(rng);
444 BOTAN_ARG_CHECK(params.empty() || params == "Deterministic" || params == "Randomized",
445 "Unexpected parameters for signing with SLH-DSA (or SPHINCS+)");
446
447 // FIPS 205, Section 9.2
448 // The hedged variant is the default and should be used on platforms where
449 // side-channel attacks are a concern.
450 const bool randomized = (params.empty() || params == "Randomized");
451 if(provider.empty() || provider == "base") {
452 return std::make_unique<SphincsPlus_Signature_Operation>(m_private, m_public, randomized);
453 }
454 throw Provider_Not_Found(algo_name(), provider);
455}
456
457} // 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
constexpr RT checked_cast_to(AT i)
Definition int_utils.h:74
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
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