pqc/crypto_sign/dilithium3/clean/poly.h
Matthias J. Kannwischer e56b2e5556
Add Dilithium (#172)
* fixes dynamic memory allocation test. previously a function called freeze() would trigger it

* this adds DilithiumII. Preprocessor conditionals still need to be removed

* fix ms Makefile

* fix MS compiler warnings

* clean-up

* remove preprocessor conditionals

* add dilithium3

* add dilithium4

* add duplicate consistency checks

* SHA2 state constants in common

* clean up symmetric.h

* Port SPHINCS+-SHA256 to sha256ctx struct

* Implement ctx struct for fips202

* Port Kyber{512,768,1024} to fips202 ctx struct

* Port NewHope to fips202 structs

* Port SPHINCS+-SHAKE256 to fips202 ctx structs

* Use opaque fips202 structs in MQDSS

* port dilithium to use fips202 ctx structs

* include -Wredundant-decls

* remove comment; format NTT constants

* reduce casts in power2round
2019-06-11 04:18:05 -05:00

54 lines
2.1 KiB
C

#ifndef POLY_H
#define POLY_H
#include "params.h"
#include <stdint.h>
typedef struct {
uint32_t coeffs[N];
} poly;
void PQCLEAN_DILITHIUM3_CLEAN_poly_reduce(poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_csubq(poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_freeze(poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_add(poly *c, const poly *a, const poly *b);
void PQCLEAN_DILITHIUM3_CLEAN_poly_sub(poly *c, const poly *a, const poly *b);
void PQCLEAN_DILITHIUM3_CLEAN_poly_shiftl(poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_ntt(poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_invntt_montgomery(poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_pointwise_invmontgomery(poly *c, const poly *a, const poly *b);
void PQCLEAN_DILITHIUM3_CLEAN_poly_power2round(poly *a1, poly *a0, const poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_poly_decompose(poly *a1, poly *a0, const poly *a);
unsigned int PQCLEAN_DILITHIUM3_CLEAN_poly_make_hint(poly *h, const poly *a0, const poly *a1);
void PQCLEAN_DILITHIUM3_CLEAN_poly_use_hint(poly *a, const poly *b, const poly *h);
int PQCLEAN_DILITHIUM3_CLEAN_poly_chknorm(const poly *a, uint32_t B);
void PQCLEAN_DILITHIUM3_CLEAN_poly_uniform(poly *a,
const unsigned char seed[SEEDBYTES],
uint16_t nonce);
void PQCLEAN_DILITHIUM3_CLEAN_poly_uniform_eta(poly *a,
const unsigned char seed[SEEDBYTES],
uint16_t nonce);
void PQCLEAN_DILITHIUM3_CLEAN_poly_uniform_gamma1m1(poly *a,
const unsigned char seed[CRHBYTES],
uint16_t nonce);
void PQCLEAN_DILITHIUM3_CLEAN_polyeta_pack(unsigned char *r, const poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyeta_unpack(poly *r, const unsigned char *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyt1_pack(unsigned char *r, const poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyt1_unpack(poly *r, const unsigned char *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyt0_pack(unsigned char *r, const poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyt0_unpack(poly *r, const unsigned char *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyz_pack(unsigned char *r, const poly *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyz_unpack(poly *r, const unsigned char *a);
void PQCLEAN_DILITHIUM3_CLEAN_polyw1_pack(unsigned char *r, const poly *a);
#endif