diff options
author | Robert Relyea <rrelyea@redhat.com> | 2023-02-27 14:46:39 -0800 |
---|---|---|
committer | Robert Relyea <rrelyea@redhat.com> | 2023-02-27 14:46:39 -0800 |
commit | 9a7e1bc157adb261651fefb791901614460843a1 (patch) | |
tree | d35359ce38e48a2ffbb7247a8a5ad32e9e7e5ed2 /lib/liboqs/src/sig/sphincs/pqclean_sphincs-shake256-256f-simple_clean/hash_state.h | |
parent | a0b5910d52112e6e32c5f54ad37533cde603feae (diff) | |
download | nss-hg-9a7e1bc157adb261651fefb791901614460843a1.tar.gz |
Add liboqs
Diffstat (limited to 'lib/liboqs/src/sig/sphincs/pqclean_sphincs-shake256-256f-simple_clean/hash_state.h')
-rw-r--r-- | lib/liboqs/src/sig/sphincs/pqclean_sphincs-shake256-256f-simple_clean/hash_state.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/liboqs/src/sig/sphincs/pqclean_sphincs-shake256-256f-simple_clean/hash_state.h b/lib/liboqs/src/sig/sphincs/pqclean_sphincs-shake256-256f-simple_clean/hash_state.h new file mode 100644 index 000000000..7d92ef872 --- /dev/null +++ b/lib/liboqs/src/sig/sphincs/pqclean_sphincs-shake256-256f-simple_clean/hash_state.h @@ -0,0 +1,30 @@ +#ifndef SPX_HASH_STATE_H +#define SPX_HASH_STATE_H + +/** + * Defines the type of the hash function state. + * + * Don't be fooled into thinking this instance of SPHINCS+ isn't stateless! + * + * From Section 7.2.2 from the SPHINCS+ round-2 specification: + * + * Each of the instances of the tweakable hash function take PK.seed as its + * first input, which is constant for a given key pair – and, thus, across + * a single signature. This leads to a lot of redundant computation. To remedy + * this, we pad PK.seed to the length of a full 64-byte SHA-256 input block. + * Because of the Merkle-Damgård construction that underlies SHA-256, this + * allows for reuse of the intermediate SHA-256 state after the initial call to + * the compression function which improves performance. + * + * We pass this hash state around in functions, because otherwise we need to + * have a global variable. + * + * SHAKE256 does not need this state. Because this implementation is generated + * from a shared code base, we still need to specify some hash_state as it is + * still passed around. We chose to use an `int` as a placeholder for this + * purpose. + */ + +#define hash_state int + +#endif |