1 #ifndef SPX_HASH_STATE_H
2 #define SPX_HASH_STATE_H
3 
4 /**
5  * Defines the type of the hash function state.
6  *
7  * Don't be fooled into thinking this instance of SPHINCS+ isn't stateless!
8  *
9  * From Section 7.2.2 from the SPHINCS+ round-2 specification:
10  *
11  * Each of the instances of the tweakable hash function take PK.seed as its
12  * first input, which is constant for a given key pair – and, thus, across
13  * a single signature. This leads to a lot of redundant computation. To remedy
14  * this, we pad PK.seed to the length of a full 64-byte SHA-256 input block.
15  * Because of the Merkle-Damgård construction that underlies SHA-256, this
16  * allows for reuse of the intermediate SHA-256 state after the initial call to
17  * the compression function which improves performance.
18  *
19  * We pass this hash state around in functions, because otherwise we need to
20  * have a global variable.
21  */
22 
23 #include "sha2.h"
24 #define hash_state sha256ctx
25 
26 #endif
27