pqc/crypto_kem/ntruhps2048509/clean/poly.h
Douglas Stebila e72fd489ba
Add ntruhps2048509 (#105)
* Initial ntruhps2048509 implementation

* Turn compile-time #if's into runtime if's

* Test vector hash

* Resolve linter complaints

* Apply astyle

* Address Windows compiler complaints

* Address more Windows compiler complaints

* More Windows compiler complaints

* Apply astyle

* Add -Wmissing-prototypes

Co-Authored-By: dstebila <dstebila@users.noreply.github.com>

* Fix -Wmissing-prototypes errors, update LICENSE
2019-04-13 13:08:07 -04:00

39 lines
1.5 KiB
C
Executable File

#ifndef POLY_H
#define POLY_H
#include <stdint.h>
#include "params.h"
#define MODQ(X) ((X) & (NTRU_Q-1))
uint16_t PQCLEAN_NTRUHPS2048509_CLEAN_mod3(uint16_t a);
typedef struct {
uint16_t coeffs[NTRU_N];
} poly;
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Sq_tobytes(unsigned char *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Sq_frombytes(poly *r, const unsigned char *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Rq_sum_zero_tobytes(unsigned char *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Rq_sum_zero_frombytes(poly *r, const unsigned char *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_S3_tobytes(unsigned char msg[NTRU_PACK_TRINARY_BYTES], const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_S3_frombytes(poly *r, const unsigned char msg[NTRU_PACK_TRINARY_BYTES]);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Sq_mul(poly *r, const poly *a, const poly *b);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Rq_mul(poly *r, const poly *a, const poly *b);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Rq_mul_x_minus_1(poly *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_S3_mul(poly *r, const poly *a, const poly *b);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_lift(poly *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Rq_to_S3(poly *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Rq_inv(poly *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_S3_inv(poly *r, const poly *a);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_Z3_to_Zq(poly *r);
void PQCLEAN_NTRUHPS2048509_CLEAN_poly_trinary_Zq_to_Z3(poly *r);
#endif