mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-23 16:08:59 +00:00
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
|
#ifndef POLYVEC_H
|
||
|
#define POLYVEC_H
|
||
|
|
||
|
#include "params.h"
|
||
|
#include "poly.h"
|
||
|
#include <stdint.h>
|
||
|
|
||
|
/* Vectors of polynomials of length L */
|
||
|
typedef struct {
|
||
|
poly vec[L];
|
||
|
} polyvecl;
|
||
|
|
||
|
void polyvecl_freeze(polyvecl *v);
|
||
|
|
||
|
void polyvecl_add(polyvecl *w, const polyvecl *u, const polyvecl *v);
|
||
|
|
||
|
void polyvecl_ntt(polyvecl *v);
|
||
|
void polyvecl_pointwise_acc_invmontgomery(poly *w, const polyvecl *u,
|
||
|
const polyvecl *v);
|
||
|
|
||
|
int polyvecl_chknorm(const polyvecl *v, uint32_t B);
|
||
|
|
||
|
/* Vectors of polynomials of length K */
|
||
|
typedef struct {
|
||
|
poly vec[K];
|
||
|
} polyveck;
|
||
|
|
||
|
void polyveck_reduce(polyveck *v);
|
||
|
void polyveck_csubq(polyveck *v);
|
||
|
void polyveck_freeze(polyveck *v);
|
||
|
|
||
|
void polyveck_add(polyveck *w, const polyveck *u, const polyveck *v);
|
||
|
void polyveck_sub(polyveck *w, const polyveck *u, const polyveck *v);
|
||
|
void polyveck_shiftl(polyveck *v, unsigned int k);
|
||
|
|
||
|
void polyveck_ntt(polyveck *v);
|
||
|
void polyveck_invntt_montgomery(polyveck *v);
|
||
|
|
||
|
int polyveck_chknorm(const polyveck *v, uint32_t B);
|
||
|
|
||
|
void polyveck_power2round(polyveck *v1, polyveck *v0, const polyveck *v);
|
||
|
void polyveck_decompose(polyveck *v1, polyveck *v0, const polyveck *v);
|
||
|
unsigned int polyveck_make_hint(polyveck *h, const polyveck *u,
|
||
|
const polyveck *v);
|
||
|
void polyveck_use_hint(polyveck *w, const polyveck *v, const polyveck *h);
|
||
|
|
||
|
#endif
|