2019-12-06 15:16:41 +00:00
|
|
|
#ifndef PQCLEAN_DILITHIUM2_CLEAN_POLYVEC_H
|
|
|
|
#define PQCLEAN_DILITHIUM2_CLEAN_POLYVEC_H
|
2019-06-11 10:18:05 +01:00
|
|
|
#include "params.h"
|
|
|
|
#include "poly.h"
|
2021-02-01 05:32:40 +00:00
|
|
|
#include <stdint.h>
|
2019-06-11 10:18:05 +01:00
|
|
|
|
|
|
|
/* Vectors of polynomials of length L */
|
|
|
|
typedef struct {
|
|
|
|
poly vec[L];
|
|
|
|
} polyvecl;
|
|
|
|
|
2021-02-01 05:32:40 +00:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_uniform_eta(polyvecl *v, const uint8_t seed[SEEDBYTES], uint16_t nonce);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_uniform_gamma1(polyvecl *v, const uint8_t seed[CRHBYTES], uint16_t nonce);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_reduce(polyvecl *v);
|
|
|
|
|
2019-06-11 10:18:05 +01:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_freeze(polyvecl *v);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_add(polyvecl *w, const polyvecl *u, const polyvecl *v);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_ntt(polyvecl *v);
|
2021-02-01 05:32:40 +00:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_invntt_tomont(polyvecl *v);
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_pointwise_poly_montgomery(polyvecl *r, const poly *a, const polyvecl *v);
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvecl_pointwise_acc_montgomery(poly *w,
|
|
|
|
const polyvecl *u,
|
|
|
|
const polyvecl *v);
|
2019-06-11 10:18:05 +01:00
|
|
|
|
2021-02-01 05:32:40 +00:00
|
|
|
|
|
|
|
int PQCLEAN_DILITHIUM2_CLEAN_polyvecl_chknorm(const polyvecl *v, int32_t B);
|
2019-06-11 10:18:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Vectors of polynomials of length K */
|
|
|
|
typedef struct {
|
|
|
|
poly vec[K];
|
|
|
|
} polyveck;
|
|
|
|
|
2021-02-01 05:32:40 +00:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_uniform_eta(polyveck *v, const uint8_t seed[SEEDBYTES], uint16_t nonce);
|
|
|
|
|
2019-06-11 10:18:05 +01:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_reduce(polyveck *v);
|
2021-02-01 05:32:40 +00:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_caddq(polyveck *v);
|
2019-06-11 10:18:05 +01:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_freeze(polyveck *v);
|
|
|
|
|
2021-02-01 05:32:40 +00:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_add(polyveck *w, const polyveck *u, const polyveck *v);
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_sub(polyveck *w, const polyveck *u, const polyveck *v);
|
2019-06-11 10:18:05 +01:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_shiftl(polyveck *v);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_ntt(polyveck *v);
|
2021-02-01 05:32:40 +00:00
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_invntt_tomont(polyveck *v);
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_pointwise_poly_montgomery(polyveck *r, const poly *a, const polyveck *v);
|
|
|
|
|
|
|
|
int PQCLEAN_DILITHIUM2_CLEAN_polyveck_chknorm(const polyveck *v, int32_t B);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_power2round(polyveck *v1, polyveck *v0, const polyveck *v);
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_decompose(polyveck *v1, polyveck *v0, const polyveck *v);
|
|
|
|
unsigned int PQCLEAN_DILITHIUM2_CLEAN_polyveck_make_hint(polyveck *h,
|
|
|
|
const polyveck *v0,
|
|
|
|
const polyveck *v1);
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_use_hint(polyveck *w, const polyveck *u, const polyveck *h);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyveck_pack_w1(uint8_t r[K * POLYW1_PACKEDBYTES], const polyveck *w1);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvec_matrix_expand(polyvecl mat[K], const uint8_t rho[SEEDBYTES]);
|
|
|
|
|
|
|
|
void PQCLEAN_DILITHIUM2_CLEAN_polyvec_matrix_pointwise_montgomery(polyveck *t, const polyvecl mat[K], const polyvecl *v);
|
2019-06-11 10:18:05 +01:00
|
|
|
|
|
|
|
#endif
|