From e9249a2bee906abeffb168ab9604e14da2609179 Mon Sep 17 00:00:00 2001 From: Kris Kwiatkowski Date: Tue, 25 May 2021 22:18:22 +0100 Subject: [PATCH] remove duplication --- src/kem/kyber/common/reduce.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/kem/kyber/common/reduce.h diff --git a/src/kem/kyber/common/reduce.h b/src/kem/kyber/common/reduce.h new file mode 100644 index 00000000..ffe54437 --- /dev/null +++ b/src/kem/kyber/common/reduce.h @@ -0,0 +1,22 @@ +#ifndef KYBER_REDUCE_H +#define KYBER_REDUCE_H + +#include + +// TODO: Remove those once not used +#define PQCLEAN_KYBER512_CLEAN_montgomery_reduce kyber_montgomery_reduce +#define PQCLEAN_KYBER768_CLEAN_montgomery_reduce kyber_montgomery_reduce +#define PQCLEAN_KYBER1024_CLEAN_montgomery_reduce kyber_montgomery_reduce + +#define PQCLEAN_KYBER512_CLEAN_barrett_reduce kyber_barrett_reduce +#define PQCLEAN_KYBER768_CLEAN_barrett_reduce kyber_barrett_reduce +#define PQCLEAN_KYBER1024_CLEAN_barrett_reduce kyber_barrett_reduce + +#define MONT 2285 // 2^16 mod q +#define QINV 62209 // q^-1 mod 2^16 + +int16_t kyber_montgomery_reduce(int32_t a); + +int16_t kyber_barrett_reduce(int16_t a); + +#endif