1 #ifndef POLY_H 2 #define POLY_H 3 4 #include <stdint.h> 5 #include "params.h" 6 7 typedef struct { 8 int32_t coeffs[N]; 9 } poly; 10 11 #define poly_reduce DILITHIUM_NAMESPACE(poly_reduce) 12 void poly_reduce(poly *a); 13 #define poly_caddq DILITHIUM_NAMESPACE(poly_caddq) 14 void poly_caddq(poly *a); 15 16 #define poly_add DILITHIUM_NAMESPACE(poly_add) 17 void poly_add(poly *c, const poly *a, const poly *b); 18 #define poly_sub DILITHIUM_NAMESPACE(poly_sub) 19 void poly_sub(poly *c, const poly *a, const poly *b); 20 #define poly_shiftl DILITHIUM_NAMESPACE(poly_shiftl) 21 void poly_shiftl(poly *a); 22 23 #define poly_ntt DILITHIUM_NAMESPACE(poly_ntt) 24 void poly_ntt(poly *a); 25 #define poly_invntt_tomont DILITHIUM_NAMESPACE(poly_invntt_tomont) 26 void poly_invntt_tomont(poly *a); 27 #define poly_pointwise_montgomery DILITHIUM_NAMESPACE(poly_pointwise_montgomery) 28 void poly_pointwise_montgomery(poly *c, const poly *a, const poly *b); 29 30 #define poly_power2round DILITHIUM_NAMESPACE(poly_power2round) 31 void poly_power2round(poly *a1, poly *a0, const poly *a); 32 #define poly_decompose DILITHIUM_NAMESPACE(poly_decompose) 33 void poly_decompose(poly *a1, poly *a0, const poly *a); 34 #define poly_make_hint DILITHIUM_NAMESPACE(poly_make_hint) 35 unsigned int poly_make_hint(poly *h, const poly *a0, const poly *a1); 36 #define poly_use_hint DILITHIUM_NAMESPACE(poly_use_hint) 37 void poly_use_hint(poly *b, const poly *a, const poly *h); 38 39 #define poly_chknorm DILITHIUM_NAMESPACE(poly_chknorm) 40 int poly_chknorm(const poly *a, int32_t B); 41 #define poly_uniform DILITHIUM_NAMESPACE(poly_uniform) 42 void poly_uniform(poly *a, 43 const uint8_t seed[SEEDBYTES], 44 uint16_t nonce); 45 #define poly_uniform_eta DILITHIUM_NAMESPACE(poly_uniform_eta) 46 void poly_uniform_eta(poly *a, 47 const uint8_t seed[CRHBYTES], 48 uint16_t nonce); 49 #define poly_uniform_gamma1 DILITHIUM_NAMESPACE(poly_uniform_gamma1) 50 void poly_uniform_gamma1(poly *a, 51 const uint8_t seed[CRHBYTES], 52 uint16_t nonce); 53 #define poly_challenge DILITHIUM_NAMESPACE(poly_challenge) 54 void poly_challenge(poly *c, const uint8_t seed[SEEDBYTES]); 55 56 #define polyeta_pack DILITHIUM_NAMESPACE(polyeta_pack) 57 void polyeta_pack(uint8_t *r, const poly *a); 58 #define polyeta_unpack DILITHIUM_NAMESPACE(polyeta_unpack) 59 void polyeta_unpack(poly *r, const uint8_t *a); 60 61 #define polyt1_pack DILITHIUM_NAMESPACE(polyt1_pack) 62 void polyt1_pack(uint8_t *r, const poly *a); 63 #define polyt1_unpack DILITHIUM_NAMESPACE(polyt1_unpack) 64 void polyt1_unpack(poly *r, const uint8_t *a); 65 66 #define polyt0_pack DILITHIUM_NAMESPACE(polyt0_pack) 67 void polyt0_pack(uint8_t *r, const poly *a); 68 #define polyt0_unpack DILITHIUM_NAMESPACE(polyt0_unpack) 69 void polyt0_unpack(poly *r, const uint8_t *a); 70 71 #define polyz_pack DILITHIUM_NAMESPACE(polyz_pack) 72 void polyz_pack(uint8_t *r, const poly *a); 73 #define polyz_unpack DILITHIUM_NAMESPACE(polyz_unpack) 74 void polyz_unpack(poly *r, const uint8_t *a); 75 76 #define polyw1_pack DILITHIUM_NAMESPACE(polyw1_pack) 77 void polyw1_pack(uint8_t *r, const poly *a); 78 79 #endif 80