1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-30 03:11:43 +00:00
pqcrypto/crypto_sign/sphincs-shake256-128f-simple/avx2/params.h
Thom Wiggers facb527c7c SPHINCS+ optimized implementations (#253)
* Add state destroy to SHA2 API

* Include optimized SPHINCS+ implementations

I've generated new implementations from the sphincsplus repository.

* Don't destroy sha256ctx after finalize

* Attempt to shut up MSVC

* Make sure to drop errors in rmtree
2021-03-24 21:02:45 +00:00

54 lines
3.2 KiB
C

#ifndef PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_PARAMS_H
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_PARAMS_H
/* Hash output length in bytes. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N 16
/* Height of the hypertree. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FULL_HEIGHT 60
/* Number of subtree layer. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_D 20
/* FORS tree dimensions. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_HEIGHT 9
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_TREES 30
/* Winternitz parameter, */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_W 16
/* The hash function is defined by linking a different hash.c file, as opposed
to setting a #define constant. */
/* For clarity */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_ADDR_BYTES 32
/* WOTS parameters. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LOGW 4
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN1 (8 * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N / PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LOGW)
/* PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN2 is floor(log(len_1 * (w - 1)) / log(w)) + 1; we precompute */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN2 3
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN (PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN1 + PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN2)
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_BYTES (PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_LEN * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N)
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_PK_BYTES PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_BYTES
/* Subtree size. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_TREE_HEIGHT (PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FULL_HEIGHT / PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_D)
/* FORS parameters. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_MSG_BYTES ((PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_HEIGHT * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_TREES + 7) / 8)
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_BYTES ((PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_HEIGHT + 1) * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_TREES * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N)
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_PK_BYTES PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N
/* Resulting SPX sizes. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_BYTES (PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FORS_BYTES + PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_D * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_WOTS_BYTES +\
PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_FULL_HEIGHT * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N)
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_PK_BYTES (2 * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N)
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_SK_BYTES (2 * PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_PK_BYTES)
/* Optionally, signing can be made non-deterministic using optrand.
This can help counter side-channel attacks that would benefit from
getting a large number of traces when the signer uses the same nodes. */
#define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_OPTRAND_BYTES 32
#endif