Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

34 строки
1.1 KiB

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