Botan 3.4.0
Crypto and TLS for C&
sp_hypertree.h
Go to the documentation of this file.
1/*
2 * Sphincs+ hypertree logic
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 * Creates a SPHINCS+ XMSS hypertree signature of @p message_to_sign. The signature is written
24 * into the buffer defined by @p out_sig. @p tree_index_in_layer and @p idx_leaf define which
25 * XMSS tree of the hypertree and which leaf of this XMSS tree is used for signing.
26 */
27void ht_sign(StrongSpan<SphincsHypertreeSignature> out_sig,
28 const SphincsTreeNode& message_to_sign,
29 const SphincsSecretSeed& secret_seed,
30 XmssTreeIndexInLayer tree_index_in_layer,
31 TreeNodeIndex idx_leaf,
32 const Sphincs_Parameters& params,
33 Sphincs_Hash_Functions& hashes);
34
35/**
36 * Given a message @p signed_msg the SPHINCS+ XMSS hypertree is reconstructed
37 * using a hypertree signature @p ht_sig. @p tree_index_in_layer and @p idx_leaf
38 * define which XMSS tree of the hypertree and which leaf of this XMSS tree was
39 * used for signing.
40 *
41 * @returns true iff the top-most reconstructed root equals @p pk_root
42 */
43bool ht_verify(const SphincsTreeNode& signed_msg,
44 StrongSpan<const SphincsHypertreeSignature> ht_sig,
45 const SphincsTreeNode& pk_root,
46 XmssTreeIndexInLayer tree_index_in_layer,
47 TreeNodeIndex idx_leaf,
48 const Sphincs_Parameters& params,
49 Sphincs_Hash_Functions& hashes);
50
51} // namespace Botan
52#endif
Strong< std::vector< uint8_t >, struct SphincsTreeNode_ > SphincsTreeNode
Either an XMSS or FORS tree node or leaf.
Definition sp_types.h:56
Strong< uint64_t, struct XmssTreeIndexInLayer_, EnableArithmeticWithPlainNumber > XmssTreeIndexInLayer
Index of an XMSS tree (unique for just the local hyper-tree layer)
Definition sp_types.h:75
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)
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)
Strong< secure_vector< uint8_t >, struct SphincsSecretSeed_ > SphincsSecretSeed
Definition sp_types.h:47
Strong< uint32_t, struct TreeNodeIndex_, EnableArithmeticWithPlainNumber > TreeNodeIndex
Index of an individual node inside an XMSS or FORS tree.
Definition sp_types.h:78