1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-24 00:11:27 +00:00
pqcrypto/crypto_sign/dilithium-iii/clean/reduce.h

22 lines
464 B
C
Raw Normal View History

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 */
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_montgomery_reduce(uint64_t a);
2019-01-16 09:15:18 +00:00
/* r < 2*Q */
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_reduce32(uint32_t a);
2019-01-16 09:15:18 +00:00
/* a < 2*Q => r < Q */
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_csubq(uint32_t a);
2019-01-16 09:15:18 +00:00
/* r < Q */
uint32_t PQCLEAN_DILITHIUMIII_CLEAN_freeze(uint32_t a);
2019-01-16 09:15:18 +00:00
#endif