You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. #ifndef SPX_PARAMS_H
  2. #define SPX_PARAMS_H
  3. /* Hash output length in bytes. */
  4. #define SPX_N 16
  5. /* Height of the hypertree. */
  6. #define SPX_FULL_HEIGHT 60
  7. /* Number of subtree layer. */
  8. #define SPX_D 20
  9. /* FORS tree dimensions. */
  10. #define SPX_FORS_HEIGHT 9
  11. #define SPX_FORS_TREES 30
  12. /* Winternitz parameter, */
  13. #define SPX_WOTS_W 16
  14. /* The hash function is defined by linking a different hash.c file, as opposed
  15. to setting a #define constant. */
  16. /* For clarity */
  17. #define SPX_ADDR_BYTES 32
  18. /* WOTS parameters. */
  19. #define SPX_WOTS_LOGW 4
  20. #define SPX_WOTS_LEN1 (8 * SPX_N / SPX_WOTS_LOGW)
  21. /* SPX_WOTS_LEN2 is floor(log(len_1 * (w - 1)) / log(w)) + 1; we precompute */
  22. #define SPX_WOTS_LEN2 3
  23. #define SPX_WOTS_LEN (SPX_WOTS_LEN1 + SPX_WOTS_LEN2)
  24. #define SPX_WOTS_BYTES (SPX_WOTS_LEN * SPX_N)
  25. #define SPX_WOTS_PK_BYTES SPX_WOTS_BYTES
  26. /* Subtree size. */
  27. #define SPX_TREE_HEIGHT (SPX_FULL_HEIGHT / SPX_D)
  28. /* FORS parameters. */
  29. #define SPX_FORS_MSG_BYTES ((SPX_FORS_HEIGHT * SPX_FORS_TREES + 7) / 8)
  30. #define SPX_FORS_BYTES ((SPX_FORS_HEIGHT + 1) * SPX_FORS_TREES * SPX_N)
  31. #define SPX_FORS_PK_BYTES SPX_N
  32. /* Resulting SPX sizes. */
  33. #define SPX_BYTES (SPX_N + SPX_FORS_BYTES + SPX_D * SPX_WOTS_BYTES +\
  34. SPX_FULL_HEIGHT * SPX_N)
  35. #define SPX_PK_BYTES (2 * SPX_N)
  36. #define SPX_SK_BYTES (2 * SPX_N + SPX_PK_BYTES)
  37. /* Optionally, signing can be made non-deterministic using optrand.
  38. This can help counter side-channel attacks that would benefit from
  39. getting a large number of traces when the signer uses the same nodes. */
  40. #define SPX_OPTRAND_BYTES 32
  41. #endif