Botan 3.6.1
Crypto and TLS for C&
sp_types.h
Go to the documentation of this file.
1/*
2 * SLH-DSA Strong Type Definitions
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#ifndef BOTAN_SP_TYPES_H_
10#define BOTAN_SP_TYPES_H_
11
12#include <botan/secmem.h>
13#include <botan/strong_type.h>
14
15namespace Botan {
16
17/*
18 * The following gives an overview about the different building blocks of
19 * SLH-DSA and how they are connected. In general, we always consider sequences of bytes
20 * that are interpreted in the following manner (flattening the || operation, i.e.,
21 * mapping the byte sequence of a strong type onto the underlying byte sequence of the containing strong type).
22 * Only FORS indices are not seen as byte sequences.
23 *
24 * SLH-DSA secret key is built up like the following:
25 * [SphincsSecretSeed || SphincsSecretPRF || SphincsPublicSeed || SphincsTreeNode] (the last chunk is the root node of SLH-DSA' topmost XMSS tree)
26 *
27 * SLH-DSA public key is built up like the following:
28 * [SphincsPublicSeed || SphincsTreeNode] (the last chunk is the root node of SLH-DSA's topmost XMSS tree)]
29 *
30 * SLH-DSA signature is built up like the following:
31 * [SphincsMessageRandomness (n bytes) || ForsSignature (k(a+1)*n = fors_signature_bytes bytes) || SphincsHypertreeSignature]. SphincsHypertreeSignature contains a total of
32 * d SphincsXMSSSignatures, with (h+d*len)*n = xmss_signature_bytes bytes each.
33 *
34 * ForsSignature is built up like the following:
35 * [<Leaf Secret of FORS Subtree 1>(n bytes) || SphincsAuthenticationPath (Subtree 1, a*n bytes) || ... || <Leaf Secret of FORS Subtree k>(n bytes) || SphincsAuthenticationPath (Subtree k, a*n bytes)]
36 * We define no special type for the leaf secret. The leaf secret is the secret PRF output that is hashed to create a FORS subtree's leaf.
37 *
38 * SphincsXmssSignature is built up like the following:
39 * [WotsSignature || SphincsAuthenticationPath]
40 *
41 * WotsSignature is built up like the following:
42 * [WotsNode || ... || WotsNode] contains len WotsNodes, each of length n bytes.
43 */
44
45/// The prefix appended to the message in [hash_]slh_sign and slh_verify.
46/// E.g. for SLH-DSA (pure): 0x00 || |ctx| || ctx. Empty for SPHINCS+.
47using SphincsMessagePrefix = Strong<std::vector<uint8_t>, struct SphincsMessagePrefix_>;
48// The input to [hash_]slh_sign and [hash_]slh_verify
49using SphincsInputMessage = Strong<std::vector<uint8_t>, struct SphincsInputMessage_>;
50
51/// M' representation of FIPS 205 (the input to slh_sign_internal and slh_verify_internal)
56
57using SphincsContext = Strong<std::vector<uint8_t>, struct SphincsContext_>;
58
59using SphincsHashedMessage = Strong<std::vector<uint8_t>, struct SphincsHashedMessage_>;
60using SphincsPublicSeed = Strong<std::vector<uint8_t>, struct SphincsPublicSeed_>;
61using SphincsSecretSeed = Strong<secure_vector<uint8_t>, struct SphincsSecretSeed_>;
62using SphincsSecretPRF = Strong<secure_vector<uint8_t>, struct SphincsSecretPRF_>;
63using SphincsOptionalRandomness = Strong<secure_vector<uint8_t>, struct SphincsOptionalRandomness_>;
64using SphincsMessageRandomness = Strong<secure_vector<uint8_t>, struct SphincsMessageRandomness_>;
65using SphincsXmssSignature = Strong<std::vector<uint8_t>, struct SphincsXmssSignature_>;
66using SphincsHypertreeSignature = Strong<std::vector<uint8_t>, struct SphincsXmssSignature_>;
67using SphincsAuthenticationPath = Strong<std::vector<uint8_t>, struct SphincsAuthenticationPath_>;
68
69/// Either an XMSS or FORS tree node or leaf
70using SphincsTreeNode = Strong<std::vector<uint8_t>, struct SphincsTreeNode_>;
71using ForsLeafSecret = Strong<secure_vector<uint8_t>, struct ForsLeafSecret_>;
72using ForsSignature = Strong<std::vector<uint8_t>, struct ForsSignature_>;
73using WotsPublicKey = Strong<std::vector<uint8_t>, struct WotsPublicKey_>;
74
75/// End node of a WOTS+ chain (part of the WOTS+ public key)
76using WotsPublicKeyNode = Strong<std::vector<uint8_t>, struct WotsPublicKeyNode_>;
77
78/// Start (or intermediate) node of a WOTS+ chain
79using WotsNode = Strong<secure_vector<uint8_t>, struct WotsNode_>;
80using WotsSignature = Strong<secure_vector<uint8_t>, struct WotsSignature_>;
81
82/// Index of the layer within a FORS/XMSS tree
84
85/// Index of a layer in the XMSS hyper-tree
87
88/// Index of an XMSS tree (unique for just the local hyper-tree layer)
90
91/// Index of an individual node inside an XMSS or FORS tree
93
94/// Index of a WOTS chain within a single usage of WOTS
96
97/// Index of a hash application inside a single WOTS chain (integers in "base_w")
99
100} // namespace Botan
101
102#endif
M' representation of FIPS 205 (the input to slh_sign_internal and slh_verify_internal)
Definition sp_types.h:52
SphincsInputMessage message
Definition sp_types.h:54
SphincsMessagePrefix prefix
Definition sp_types.h:53