2019-01-16 09:15:18 +00:00
|
|
|
#ifndef REDUCE_H
|
|
|
|
#define REDUCE_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define MONT 4193792U // 2^32 % Q
|
|
|
|
#define QINV 4236238847U // -q^(-1) mod 2^32
|
|
|
|
|
|
|
|
/* a <= Q*2^32 => r < 2*Q */
|
2019-02-26 16:27:32 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_montgomery_reduce(uint64_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
/* r < 2*Q */
|
2019-02-26 16:27:32 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_reduce32(uint32_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
/* a < 2*Q => r < Q */
|
2019-02-26 16:27:32 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_csubq(uint32_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
/* r < Q */
|
2019-02-26 16:27:32 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_freeze(uint32_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
#endif
|