aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/s2n/pq-crypto/kyber_r2/poly.h
blob: ecdc7c29511422da8090bc86f5be04fa6db36353 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef POLY_H
#define POLY_H

#include "params.h"

#include <stdint.h>
/*
 * Elements of R_q = Z_q[X]/(X^n + 1). Represents polynomial
 * coeffs[0] + X*coeffs[1] + X^2*xoeffs[2] + ... + X^{n-1}*coeffs[n-1]
 */
typedef struct {
    int16_t coeffs[KYBER_N];
} poly;

void PQCLEAN_KYBER512_CLEAN_poly_compress(uint8_t *r, poly *a);
void PQCLEAN_KYBER512_CLEAN_poly_decompress(poly *r, const uint8_t *a);

void PQCLEAN_KYBER512_CLEAN_poly_tobytes(uint8_t *r, poly *a);
void PQCLEAN_KYBER512_CLEAN_poly_frombytes(poly *r, const uint8_t *a);

void PQCLEAN_KYBER512_CLEAN_poly_frommsg(poly *r, const uint8_t msg[KYBER_SYMBYTES]);
void PQCLEAN_KYBER512_CLEAN_poly_tomsg(uint8_t msg[KYBER_SYMBYTES], poly *a);

void PQCLEAN_KYBER512_CLEAN_poly_getnoise(poly *r, const uint8_t *seed, uint8_t nonce);

void PQCLEAN_KYBER512_CLEAN_poly_ntt(poly *r);
void PQCLEAN_KYBER512_CLEAN_poly_invntt(poly *r);
void PQCLEAN_KYBER512_CLEAN_poly_basemul(poly *r, const poly *a, const poly *b);
void PQCLEAN_KYBER512_CLEAN_poly_frommont(poly *r);

void PQCLEAN_KYBER512_CLEAN_poly_reduce(poly *r);
void PQCLEAN_KYBER512_CLEAN_poly_csubq(poly *r);

void PQCLEAN_KYBER512_CLEAN_poly_add(poly *r, const poly *a, const poly *b);
void PQCLEAN_KYBER512_CLEAN_poly_sub(poly *r, const poly *a, const poly *b);

#endif