mirror of
https://github.com/henrydcase/pqc.git
synced 2024-12-04 21:34:01 +00:00
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
|
#ifndef SPX_PARAMS_H
|
||
|
#define SPX_PARAMS_H
|
||
|
|
||
|
/* Hash output length in bytes. */
|
||
|
#define SPX_N 24
|
||
|
/* Height of the hypertree. */
|
||
|
#define SPX_FULL_HEIGHT 64
|
||
|
/* Number of subtree layer. */
|
||
|
#define SPX_D 8
|
||
|
/* FORS tree dimensions. */
|
||
|
#define SPX_FORS_HEIGHT 16
|
||
|
#define SPX_FORS_TREES 14
|
||
|
/* Winternitz parameter, */
|
||
|
#define SPX_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 SPX_ADDR_BYTES 32
|
||
|
|
||
|
/* WOTS parameters. */
|
||
|
#define SPX_WOTS_LOGW 4
|
||
|
|
||
|
#define SPX_WOTS_LEN1 (8 * SPX_N / SPX_WOTS_LOGW)
|
||
|
|
||
|
/* SPX_WOTS_LEN2 is floor(log(len_1 * (w - 1)) / log(w)) + 1; we precompute */
|
||
|
#define SPX_WOTS_LEN2 3
|
||
|
|
||
|
#define SPX_WOTS_LEN (SPX_WOTS_LEN1 + SPX_WOTS_LEN2)
|
||
|
#define SPX_WOTS_BYTES (SPX_WOTS_LEN * SPX_N)
|
||
|
#define SPX_WOTS_PK_BYTES SPX_WOTS_BYTES
|
||
|
|
||
|
/* Subtree size. */
|
||
|
#define SPX_TREE_HEIGHT (SPX_FULL_HEIGHT / SPX_D)
|
||
|
|
||
|
/* FORS parameters. */
|
||
|
#define SPX_FORS_MSG_BYTES ((SPX_FORS_HEIGHT * SPX_FORS_TREES + 7) / 8)
|
||
|
#define SPX_FORS_BYTES ((SPX_FORS_HEIGHT + 1) * SPX_FORS_TREES * SPX_N)
|
||
|
#define SPX_FORS_PK_BYTES SPX_N
|
||
|
|
||
|
/* Resulting SPX sizes. */
|
||
|
#define SPX_BYTES (SPX_N + SPX_FORS_BYTES + SPX_D * SPX_WOTS_BYTES +\
|
||
|
SPX_FULL_HEIGHT * SPX_N)
|
||
|
#define SPX_PK_BYTES (2 * SPX_N)
|
||
|
#define SPX_SK_BYTES (2 * SPX_N + SPX_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 SPX_OPTRAND_BYTES 32
|
||
|
|
||
|
#endif
|