kyber512r3_poly_avx2.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. #include <stdint.h>
  3. #include "kyber512r3_align_avx2.h"
  4. #include "kyber512r3_params.h"
  5. #if defined(S2N_KYBER512R3_AVX2_BMI2)
  6. #define poly S2N_KYBER_512_R3_NAMESPACE(poly)
  7. typedef ALIGNED_INT16(S2N_KYBER_512_R3_N) poly;
  8. #define poly_compress_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_compress_avx2)
  9. void poly_compress_avx2(uint8_t r[S2N_KYBER_512_R3_POLYCOMPRESSEDBYTES], const poly *a);
  10. #define poly_decompress_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_decompress_avx2)
  11. void poly_decompress_avx2(poly *r, const uint8_t a[S2N_KYBER_512_R3_POLYCOMPRESSEDBYTES]);
  12. #define poly_tobytes_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_tobytes_avx2)
  13. void poly_tobytes_avx2(uint8_t r[S2N_KYBER_512_R3_POLYBYTES], const poly *a);
  14. #define poly_frombytes_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_frombytes_avx2)
  15. void poly_frombytes_avx2(poly *r, const uint8_t a[S2N_KYBER_512_R3_POLYBYTES]);
  16. #define poly_frommsg_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_frommsg_avx2)
  17. void poly_frommsg_avx2(poly *r, const uint8_t msg[S2N_KYBER_512_R3_INDCPA_MSGBYTES]);
  18. #define poly_tomsg_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_tomsg_avx2)
  19. void poly_tomsg_avx2(uint8_t msg[S2N_KYBER_512_R3_INDCPA_MSGBYTES], const poly *r);
  20. #define poly_getnoise_eta1_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_getnoise_eta1_avx2)
  21. void poly_getnoise_eta1_avx2(poly *r, const uint8_t seed[S2N_KYBER_512_R3_SYMBYTES], uint8_t nonce);
  22. #define poly_getnoise_eta2_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_getnoise_eta2_avx2)
  23. void poly_getnoise_eta2_avx2(poly *r, const uint8_t seed[S2N_KYBER_512_R3_SYMBYTES], uint8_t nonce);
  24. #define poly_getnoise_eta1_4x S2N_KYBER_512_R3_NAMESPACE(poly_getnoise_eta2_4x)
  25. void poly_getnoise_eta1_4x(poly *r0,
  26. poly *r1,
  27. poly *r2,
  28. poly *r3,
  29. const uint8_t seed[32],
  30. uint8_t nonce0,
  31. uint8_t nonce1,
  32. uint8_t nonce2,
  33. uint8_t nonce3);
  34. #define poly_getnoise_eta1122_4x S2N_KYBER_512_R3_NAMESPACE(poly_getnoise_eta1122_4x)
  35. void poly_getnoise_eta1122_4x(poly *r0,
  36. poly *r1,
  37. poly *r2,
  38. poly *r3,
  39. const uint8_t seed[32],
  40. uint8_t nonce0,
  41. uint8_t nonce1,
  42. uint8_t nonce2,
  43. uint8_t nonce3);
  44. #define poly_ntt_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_ntt_avx2)
  45. void poly_ntt_avx2(poly *r);
  46. #define poly_invntt_tomont_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_invntt_tomont_avx2)
  47. void poly_invntt_tomont_avx2(poly *r);
  48. #define poly_nttunpack_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_nttunpack_avx2)
  49. void poly_nttunpack_avx2(poly *r);
  50. #define poly_basemul_montgomery_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_basemul_montgomery_avx2)
  51. void poly_basemul_montgomery_avx2(poly *r, const poly *a, const poly *b);
  52. #define poly_tomont_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_tomont_avx2)
  53. void poly_tomont_avx2(poly *r);
  54. #define poly_reduce_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_reduce_avx2)
  55. void poly_reduce_avx2(poly *r);
  56. #define poly_add_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_add_avx2)
  57. void poly_add_avx2(poly *r, const poly *a, const poly *b);
  58. #define poly_sub_avx2 S2N_KYBER_512_R3_NAMESPACE(poly_sub_avx2)
  59. void poly_sub_avx2(poly *r, const poly *a, const poly *b);
  60. #endif