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-01-22 16:38:22 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_montgomery_reduce(uint64_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
/* r < 2*Q */
|
2019-01-22 16:38:22 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_reduce32(uint32_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
/* a < 2*Q => r < Q */
|
2019-01-22 16:38:22 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_csubq(uint32_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
/* r < Q */
|
2019-01-22 16:38:22 +00:00
|
|
|
uint32_t PQCLEAN_DILITHIUMIII_freeze(uint32_t a);
|
2019-01-16 09:15:18 +00:00
|
|
|
|
|
|
|
#endif
|