Botan
3.4.0
Crypto and TLS for C&
src
lib
pubkey
sphincsplus
sphincsplus_common
sp_types.h
Go to the documentation of this file.
1
/*
2
* SPHINCS+ 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
15
namespace
Botan
{
16
17
/*
18
* The following gives an overview about the different building blocks of
19
* Sphincs+ 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
* Sphincs+ secret key is built up like the following:
25
* [SphincsSecretSeed || SphincsSecretPRF || SphincsPublicSeed || SphincsTreeNode] (the last chunk is the root node of Sphincs+' topmost XMSS tree)
26
*
27
* Sphincs+ public key is built up like the following:
28
* [SphincsPublicSeed || SphincsTreeNode] (the last chunk is the root node of Sphincs+' topmost XMSS tree)]
29
*
30
* Sphincs+ 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
using
SphincsHashedMessage
=
Strong<std::vector<uint8_t>
,
struct
SphincsHashedMessage_>;
46
using
SphincsPublicSeed
=
Strong<std::vector<uint8_t>
,
struct
SphincsPublicSeed_>;
47
using
SphincsSecretSeed
=
Strong<secure_vector<uint8_t>
,
struct
SphincsSecretSeed_>;
48
using
SphincsSecretPRF
=
Strong<secure_vector<uint8_t>
,
struct
SphincsSecretPRF_>;
49
using
SphincsOptionalRandomness
=
Strong<secure_vector<uint8_t>
,
struct
SphincsOptionalRandomness_>;
50
using
SphincsMessageRandomness
=
Strong<secure_vector<uint8_t>
,
struct
SphincsMessageRandomness_>;
51
using
SphincsXmssSignature
=
Strong<std::vector<uint8_t>
,
struct
SphincsXmssSignature_>;
52
using
SphincsHypertreeSignature
=
Strong<std::vector<uint8_t>
,
struct
SphincsXmssSignature_>;
53
using
SphincsAuthenticationPath
=
Strong<std::vector<uint8_t>
,
struct
SphincsAuthenticationPath_>;
54
55
/// Either an XMSS or FORS tree node or leaf
56
using
SphincsTreeNode
=
Strong<std::vector<uint8_t>
,
struct
SphincsTreeNode_>;
57
using
ForsLeafSecret
=
Strong<secure_vector<uint8_t>
,
struct
ForsLeafSecret_>;
58
using
ForsSignature
=
Strong<std::vector<uint8_t>
,
struct
ForsSignature_>;
59
using
WotsPublicKey
=
Strong<std::vector<uint8_t>
,
struct
WotsPublicKey_>;
60
61
/// End node of a WOTS+ chain (part of the WOTS+ public key)
62
using
WotsPublicKeyNode
=
Strong<std::vector<uint8_t>
,
struct
WotsPublicKeyNode_>;
63
64
/// Start (or intermediate) node of a WOTS+ chain
65
using
WotsNode
=
Strong<secure_vector<uint8_t>
,
struct
WotsNode_>;
66
using
WotsSignature
=
Strong<secure_vector<uint8_t>
,
struct
WotsSignature_>;
67
68
/// Index of the layer within a FORS/XMSS tree
69
using
TreeLayerIndex
=
Strong<uint32_t, struct TreeLayerIndex_, EnableArithmeticWithPlainNumber>
;
70
71
/// Index of a layer in the XMSS hyper-tree
72
using
HypertreeLayerIndex
=
Strong<uint32_t, struct HypertreeLayerIndex_>
;
73
74
/// Index of an XMSS tree (unique for just the local hyper-tree layer)
75
using
XmssTreeIndexInLayer
=
Strong<uint64_t, struct XmssTreeIndexInLayer_, EnableArithmeticWithPlainNumber>
;
76
77
/// Index of an individual node inside an XMSS or FORS tree
78
using
TreeNodeIndex
=
Strong<uint32_t, struct TreeNodeIndex_, EnableArithmeticWithPlainNumber>
;
79
80
/// Index of a WOTS chain within a single usage of WOTS
81
using
WotsChainIndex
=
Strong<uint32_t, struct WotsChainIndex_>
;
82
83
/// Index of a hash application inside a single WOTS chain (integers in "base_w")
84
using
WotsHashIndex
=
Strong<uint8_t, struct WotsHashIndex_, EnableArithmeticWithPlainNumber>
;
85
86
}
// namespace Botan
87
88
#endif
Botan::Strong
Definition
strong_type.h:162
Botan
Definition
alg_id.cpp:13
Generated by
1.10.0