Botan 3.6.1
Crypto and TLS for C&
sp_hypertree.h
Go to the documentation of this file.
1/*
2 * SLH-DSA's Hypertree Logic (FIPS 205, Section 7)
3 * (C) 2023 Jack Lloyd
4 * 2023 Fabian Albert, René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity
5 *
6 * Parts of this file have been adapted from https://github.com/sphincs/sphincsplus
7 *
8 * Botan is released under the Simplified BSD License (see license.txt)
9 */
10
11#ifndef BOTAN_SP_HYPERTREE_H_
12#define BOTAN_SP_HYPERTREE_H_
13
14#include <botan/internal/sp_types.h>
15
16namespace Botan {
17
18class Sphincs_Address;
19class Sphincs_Hash_Functions;
20class Sphincs_Parameters;
21
22/**
23 * @brief FIPS 205, Algorithm 12: ht_sign
24 *
25 * Creates a SLH-DSA XMSS hypertree signature of @p message_to_sign. The signature is written
26 * into the buffer defined by @p out_sig. @p tree_index_in_layer and @p idx_leaf define which
27 * XMSS tree of the hypertree and which leaf of this XMSS tree is used for signing.
28 */
29void ht_sign(StrongSpan<SphincsHypertreeSignature> out_sig,
30 const SphincsTreeNode& message_to_sign,
31 const SphincsSecretSeed& secret_seed,
32 XmssTreeIndexInLayer tree_index_in_layer,
33 TreeNodeIndex idx_leaf,
34 const Sphincs_Parameters& params,
35 Sphincs_Hash_Functions& hashes);
36
37/**
38 * @brief FIPS 205, Algorithm 13: ht_verify
39 *
40 * Given a message @p signed_msg the SLH-DSA XMSS hypertree is reconstructed
41 * using a hypertree signature @p ht_sig. @p tree_index_in_layer and @p idx_leaf
42 * define which XMSS tree of the hypertree and which leaf of this XMSS tree was
43 * used for signing.
44 *
45 * @returns true iff the top-most reconstructed root equals @p pk_root
46 */
47bool ht_verify(const SphincsTreeNode& signed_msg,
48 StrongSpan<const SphincsHypertreeSignature> ht_sig,
49 const SphincsTreeNode& pk_root,
50 XmssTreeIndexInLayer tree_index_in_layer,
51 TreeNodeIndex idx_leaf,
52 const Sphincs_Parameters& params,
53 Sphincs_Hash_Functions& hashes);
54
55} // namespace Botan
56#endif
Strong< std::vector< uint8_t >, struct SphincsTreeNode_ > SphincsTreeNode
Either an XMSS or FORS tree node or leaf.
Definition sp_types.h:70
Strong< uint64_t, struct XmssTreeIndexInLayer_, EnableArithmeticWithPlainNumber > XmssTreeIndexInLayer
Index of an XMSS tree (unique for just the local hyper-tree layer)
Definition sp_types.h:89
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.
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< secure_vector< uint8_t >, struct SphincsSecretSeed_ > SphincsSecretSeed
Definition sp_types.h:61
Strong< uint32_t, struct TreeNodeIndex_, EnableArithmeticWithPlainNumber > TreeNodeIndex
Index of an individual node inside an XMSS or FORS tree.
Definition sp_types.h:92