kyber512r3_fips202x4_avx2.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #include <stddef.h>
  3. #include <stdint.h>
  4. #include "kyber512r3_params.h"
  5. #if defined(S2N_KYBER512R3_AVX2_BMI2)
  6. #include <immintrin.h>
  7. #define keccakx4_state S2N_KYBER_512_R3_NAMESPACE(keccakx4_state)
  8. typedef struct {
  9. __m256i s[25];
  10. } keccakx4_state;
  11. #define shake128x4_absorb_once S2N_KYBER_512_R3_NAMESPACE(shake128x4_absorb_once)
  12. void shake128x4_absorb_once(keccakx4_state *state,
  13. const uint8_t *in0,
  14. const uint8_t *in1,
  15. const uint8_t *in2,
  16. const uint8_t *in3,
  17. size_t inlen);
  18. #define shake128x4_squeezeblocks S2N_KYBER_512_R3_NAMESPACE(shake128x4_squeezeblocks)
  19. void shake128x4_squeezeblocks(uint8_t *out0,
  20. uint8_t *out1,
  21. uint8_t *out2,
  22. uint8_t *out3,
  23. size_t nblocks,
  24. keccakx4_state *state);
  25. #define shake256x4_absorb_once S2N_KYBER_512_R3_NAMESPACE(shake256x4_absorb_once)
  26. void shake256x4_absorb_once(keccakx4_state *state,
  27. const uint8_t *in0,
  28. const uint8_t *in1,
  29. const uint8_t *in2,
  30. const uint8_t *in3,
  31. size_t inlen);
  32. #define shake256x4_squeezeblocks S2N_KYBER_512_R3_NAMESPACE(shake256x4_squeezeblocks)
  33. void shake256x4_squeezeblocks(uint8_t *out0,
  34. uint8_t *out1,
  35. uint8_t *out2,
  36. uint8_t *out3,
  37. size_t nblocks,
  38. keccakx4_state *state);
  39. #define shake128x4 S2N_KYBER_512_R3_NAMESPACE(shake128x4)
  40. void shake128x4(uint8_t *out0,
  41. uint8_t *out1,
  42. uint8_t *out2,
  43. uint8_t *out3,
  44. size_t outlen,
  45. const uint8_t *in0,
  46. const uint8_t *in1,
  47. const uint8_t *in2,
  48. const uint8_t *in3,
  49. size_t inlen);
  50. #define shake256x4 S2N_KYBER_512_R3_NAMESPACE(shake256x4)
  51. void shake256x4(uint8_t *out0,
  52. uint8_t *out1,
  53. uint8_t *out2,
  54. uint8_t *out3,
  55. size_t outlen,
  56. const uint8_t *in0,
  57. const uint8_t *in1,
  58. const uint8_t *in2,
  59. const uint8_t *in3,
  60. size_t inlen);
  61. #endif