diff --git a/crypto_kem/hqc-128/avx2/fft.c b/crypto_kem/hqc-128/avx2/fft.c index 6e5039c6..cbac46e7 100644 --- a/crypto_kem/hqc-128/avx2/fft.c +++ b/crypto_kem/hqc-128/avx2/fft.c @@ -17,7 +17,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -47,7 +47,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; diff --git a/crypto_kem/hqc-128/clean/fft.c b/crypto_kem/hqc-128/clean/fft.c index 081a252f..3381f46f 100644 --- a/crypto_kem/hqc-128/clean/fft.c +++ b/crypto_kem/hqc-128/clean/fft.c @@ -17,7 +17,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix_t(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uint32_t m_f); static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uint32_t m_f); static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -50,7 +50,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; diff --git a/crypto_kem/hqc-128/clean/gf2x.c b/crypto_kem/hqc-128/clean/gf2x.c index e7c2fab6..91e9b7f3 100644 --- a/crypto_kem/hqc-128/clean/gf2x.c +++ b/crypto_kem/hqc-128/clean/gf2x.c @@ -42,10 +42,11 @@ static inline void swap(uint16_t *tab, uint16_t elt1, uint16_t elt2) { * @param[out] o Pointer to the result */ static void reduce(uint64_t *o, const uint64_t *a) { + size_t i; uint64_t r; uint64_t carry; - for (uint32_t i = 0; i < VEC_N_SIZE_64; i++) { + for (i = 0; i < VEC_N_SIZE_64; i++) { r = a[i + VEC_N_SIZE_64 - 1] >> (PARAM_N & 63); carry = (uint64_t) (a[i + VEC_N_SIZE_64] << (64 - (PARAM_N & 63))); o[i] = a[i] ^ r ^ carry; @@ -78,7 +79,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ uint16_t permutation_sparse_vect[PARAM_OMEGA_E]; uint64_t *pt; uint16_t *res_16; - uint16_t i, j; + size_t i, j; for (i = 0; i < 16; i++) { permuted_table[i] = i; @@ -113,7 +114,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ seedexpander(ctx, (uint8_t *) permutation_sparse_vect, weight * sizeof(uint16_t)); for (i = 0; i + 1 < weight; i++) { - swap(permuted_sparse_vect + i, 0, permutation_sparse_vect[i] % (weight - i)); + swap(permuted_sparse_vect + i, 0, (uint16_t) (permutation_sparse_vect[i] % (weight - i))); } for (i = 0; i < weight; i++) { diff --git a/crypto_kem/hqc-128/clean/repetition.c b/crypto_kem/hqc-128/clean/repetition.c index 2c271241..cc12d895 100644 --- a/crypto_kem/hqc-128/clean/repetition.c +++ b/crypto_kem/hqc-128/clean/repetition.c @@ -24,7 +24,7 @@ void PQCLEAN_HQC128_CLEAN_repetition_code_encode(uint64_t *em, const uint64_t *m uint32_t pos_r; uint64_t *p64 = em; const uint64_t mask[2][2] = {{0x0UL, 0x0UL}, {0x7FFFFFFFUL, 0x3FFFFFFFUL}}; - for (i = 0; i < VEC_N1_SIZE_64 - 1; i++) { + for (i = 0; i < (uint16_t) (VEC_N1_SIZE_64 - 1); i++) { for (j = 0; j < 64; j++) { bit = (m[i] >> j) & 0x1; pos_r = PARAM_N2 * ((i << 6) + j); diff --git a/crypto_kem/hqc-192/avx2/fft.c b/crypto_kem/hqc-192/avx2/fft.c index 97d2e14d..c32b0ff8 100644 --- a/crypto_kem/hqc-192/avx2/fft.c +++ b/crypto_kem/hqc-192/avx2/fft.c @@ -17,7 +17,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -47,8 +47,8 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { - size_t i, j; +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { + uint16_t i, j; subset_sums[0] = 0; for (i = 0; i < set_size; ++i) { diff --git a/crypto_kem/hqc-192/clean/fft.c b/crypto_kem/hqc-192/clean/fft.c index 0384d42b..a0d8d740 100644 --- a/crypto_kem/hqc-192/clean/fft.c +++ b/crypto_kem/hqc-192/clean/fft.c @@ -17,7 +17,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix_t(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uint32_t m_f); static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uint32_t m_f); static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -50,7 +50,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; @@ -628,7 +628,8 @@ void PQCLEAN_HQC192_CLEAN_fft_retrieve_bch_error_poly(uint64_t *error, const uin uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); diff --git a/crypto_kem/hqc-192/clean/gf2x.c b/crypto_kem/hqc-192/clean/gf2x.c index 2ed4e1dc..6cc4a9cc 100644 --- a/crypto_kem/hqc-192/clean/gf2x.c +++ b/crypto_kem/hqc-192/clean/gf2x.c @@ -42,10 +42,11 @@ static inline void swap(uint16_t *tab, uint16_t elt1, uint16_t elt2) { * @param[out] o Pointer to the result */ static void reduce(uint64_t *o, const uint64_t *a) { + size_t i; uint64_t r; uint64_t carry; - for (uint32_t i = 0; i < VEC_N_SIZE_64; i++) { + for (i = 0; i < VEC_N_SIZE_64; i++) { r = a[i + VEC_N_SIZE_64 - 1] >> (PARAM_N & 63); carry = (uint64_t) (a[i + VEC_N_SIZE_64] << (64 - (PARAM_N & 63))); o[i] = a[i] ^ r ^ carry; @@ -78,7 +79,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ uint16_t permutation_sparse_vect[PARAM_OMEGA_E]; uint64_t *pt; uint16_t *res_16; - uint16_t i, j; + size_t i, j; for (i = 0; i < 16; i++) { permuted_table[i] = i; @@ -113,7 +114,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ seedexpander(ctx, (uint8_t *) permutation_sparse_vect, weight * sizeof(uint16_t)); for (i = 0; i + 1 < weight; i++) { - swap(permuted_sparse_vect + i, 0, permutation_sparse_vect[i] % (weight - i)); + swap(permuted_sparse_vect + i, 0, (uint16_t) (permutation_sparse_vect[i] % (weight - i))); } for (i = 0; i < weight; i++) { diff --git a/crypto_kem/hqc-192/clean/repetition.c b/crypto_kem/hqc-192/clean/repetition.c index 1a0548cb..b8897a9e 100644 --- a/crypto_kem/hqc-192/clean/repetition.c +++ b/crypto_kem/hqc-192/clean/repetition.c @@ -24,7 +24,7 @@ void PQCLEAN_HQC192_CLEAN_repetition_code_encode(uint64_t *em, const uint64_t *m uint32_t pos_r; uint64_t *p64 = em; const uint64_t mask[2][2] = {{0x0UL, 0x0UL}, {0x7FFFFFFFFFFFFFFUL, 0x3FFFFFFFFFFFFFFUL}}; - for (i = 0; i < VEC_N1_SIZE_64 - 1; i++) { + for (i = 0; i < (uint16_t) (VEC_N1_SIZE_64 - 1); i++) { for (j = 0; j < 64; j++) { bit = (m[i] >> j) & 0x1; pos_r = PARAM_N2 * ((i << 6) + j); diff --git a/crypto_kem/hqc-256/avx2/fft.c b/crypto_kem/hqc-256/avx2/fft.c index 22175068..2850fd98 100644 --- a/crypto_kem/hqc-256/avx2/fft.c +++ b/crypto_kem/hqc-256/avx2/fft.c @@ -17,7 +17,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -47,8 +47,8 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { - size_t i, j; +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { + uint16_t i, j; subset_sums[0] = 0; for (i = 0; i < set_size; ++i) { diff --git a/crypto_kem/hqc-256/clean/fft.c b/crypto_kem/hqc-256/clean/fft.c index 58bee1b5..21db91f4 100644 --- a/crypto_kem/hqc-256/clean/fft.c +++ b/crypto_kem/hqc-256/clean/fft.c @@ -17,7 +17,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix_t(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uint32_t m_f); static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uint32_t m_f); static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -50,7 +50,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; @@ -628,7 +628,8 @@ void PQCLEAN_HQC256_CLEAN_fft_retrieve_bch_error_poly(uint64_t *error, const uin uint16_t gammas[PARAM_M - 1] = {0}; uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0}; uint64_t bit; - size_t i, k, index; + uint16_t k; + size_t i, index; compute_fft_betas(gammas); compute_subset_sums(gammas_sums, gammas, PARAM_M - 1); diff --git a/crypto_kem/hqc-256/clean/gf2x.c b/crypto_kem/hqc-256/clean/gf2x.c index 635cf792..2313d73c 100644 --- a/crypto_kem/hqc-256/clean/gf2x.c +++ b/crypto_kem/hqc-256/clean/gf2x.c @@ -42,10 +42,11 @@ static inline void swap(uint16_t *tab, uint16_t elt1, uint16_t elt2) { * @param[out] o Pointer to the result */ static void reduce(uint64_t *o, const uint64_t *a) { + size_t i; uint64_t r; uint64_t carry; - for (uint32_t i = 0; i < VEC_N_SIZE_64; i++) { + for (i = 0; i < VEC_N_SIZE_64; i++) { r = a[i + VEC_N_SIZE_64 - 1] >> (PARAM_N & 63); carry = (uint64_t) (a[i + VEC_N_SIZE_64] << (64 - (PARAM_N & 63))); o[i] = a[i] ^ r ^ carry; @@ -78,7 +79,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ uint16_t permutation_sparse_vect[PARAM_OMEGA_E]; uint64_t *pt; uint16_t *res_16; - uint16_t i, j; + size_t i, j; for (i = 0; i < 16; i++) { permuted_table[i] = i; @@ -113,7 +114,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ seedexpander(ctx, (uint8_t *) permutation_sparse_vect, weight * sizeof(uint16_t)); for (i = 0; i + 1 < weight; i++) { - swap(permuted_sparse_vect + i, 0, permutation_sparse_vect[i] % (weight - i)); + swap(permuted_sparse_vect + i, 0, (uint16_t) (permutation_sparse_vect[i] % (weight - i))); } for (i = 0; i < weight; i++) { diff --git a/crypto_kem/hqc-rmrs-128/avx2/fft.c b/crypto_kem/hqc-rmrs-128/avx2/fft.c index 0eb7f43e..71cac6ac 100644 --- a/crypto_kem/hqc-rmrs-128/avx2/fft.c +++ b/crypto_kem/hqc-rmrs-128/avx2/fft.c @@ -16,7 +16,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -46,7 +46,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; diff --git a/crypto_kem/hqc-rmrs-128/clean/fft.c b/crypto_kem/hqc-rmrs-128/clean/fft.c index 6f70c8b6..b7126d18 100644 --- a/crypto_kem/hqc-rmrs-128/clean/fft.c +++ b/crypto_kem/hqc-rmrs-128/clean/fft.c @@ -16,7 +16,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -46,7 +46,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; diff --git a/crypto_kem/hqc-rmrs-128/clean/gf2x.c b/crypto_kem/hqc-rmrs-128/clean/gf2x.c index 3cae37f8..16552f47 100644 --- a/crypto_kem/hqc-rmrs-128/clean/gf2x.c +++ b/crypto_kem/hqc-rmrs-128/clean/gf2x.c @@ -42,10 +42,11 @@ static inline void swap(uint16_t *tab, uint16_t elt1, uint16_t elt2) { * @param[out] o Pointer to the result */ static void reduce(uint64_t *o, const uint64_t *a) { + size_t i; uint64_t r; uint64_t carry; - for (uint32_t i = 0; i < VEC_N_SIZE_64; i++) { + for (i = 0; i < VEC_N_SIZE_64; i++) { r = a[i + VEC_N_SIZE_64 - 1] >> (PARAM_N & 63); carry = (uint64_t) (a[i + VEC_N_SIZE_64] << (64 - (PARAM_N & 63))); o[i] = a[i] ^ r ^ carry; @@ -78,7 +79,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ uint16_t permutation_sparse_vect[PARAM_OMEGA_E]; uint64_t *pt; uint16_t *res_16; - uint16_t i, j; + size_t i, j; for (i = 0; i < 16; i++) { permuted_table[i] = i; @@ -113,7 +114,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ seedexpander(ctx, (uint8_t *) permutation_sparse_vect, weight * sizeof(uint16_t)); for (i = 0; i + 1 < weight; i++) { - swap(permuted_sparse_vect + i, 0, permutation_sparse_vect[i] % (weight - i)); + swap(permuted_sparse_vect + i, 0, (uint16_t) (permutation_sparse_vect[i] % (weight - i))); } for (i = 0; i < weight; i++) { diff --git a/crypto_kem/hqc-rmrs-192/avx2/fft.c b/crypto_kem/hqc-rmrs-192/avx2/fft.c index f34ed7ea..246b6189 100644 --- a/crypto_kem/hqc-rmrs-192/avx2/fft.c +++ b/crypto_kem/hqc-rmrs-192/avx2/fft.c @@ -16,7 +16,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -46,7 +46,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; diff --git a/crypto_kem/hqc-rmrs-192/clean/fft.c b/crypto_kem/hqc-rmrs-192/clean/fft.c index 68192188..c9d367c7 100644 --- a/crypto_kem/hqc-rmrs-192/clean/fft.c +++ b/crypto_kem/hqc-rmrs-192/clean/fft.c @@ -16,7 +16,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -46,8 +46,8 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { - size_t i, j; +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { + uint16_t i, j; subset_sums[0] = 0; for (i = 0; i < set_size; ++i) { diff --git a/crypto_kem/hqc-rmrs-192/clean/gf2x.c b/crypto_kem/hqc-rmrs-192/clean/gf2x.c index 303f1487..7b94715b 100644 --- a/crypto_kem/hqc-rmrs-192/clean/gf2x.c +++ b/crypto_kem/hqc-rmrs-192/clean/gf2x.c @@ -42,10 +42,11 @@ static inline void swap(uint16_t *tab, uint16_t elt1, uint16_t elt2) { * @param[out] o Pointer to the result */ static void reduce(uint64_t *o, const uint64_t *a) { + size_t i; uint64_t r; uint64_t carry; - for (uint32_t i = 0; i < VEC_N_SIZE_64; i++) { + for (i = 0; i < VEC_N_SIZE_64; i++) { r = a[i + VEC_N_SIZE_64 - 1] >> (PARAM_N & 63); carry = (uint64_t) (a[i + VEC_N_SIZE_64] << (64 - (PARAM_N & 63))); o[i] = a[i] ^ r ^ carry; @@ -78,7 +79,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ uint16_t permutation_sparse_vect[PARAM_OMEGA_E]; uint64_t *pt; uint16_t *res_16; - uint16_t i, j; + size_t i, j; for (i = 0; i < 16; i++) { permuted_table[i] = i; @@ -113,7 +114,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ seedexpander(ctx, (uint8_t *) permutation_sparse_vect, weight * sizeof(uint16_t)); for (i = 0; i + 1 < weight; i++) { - swap(permuted_sparse_vect + i, 0, permutation_sparse_vect[i] % (weight - i)); + swap(permuted_sparse_vect + i, 0, (uint16_t) (permutation_sparse_vect[i] % (weight - i))); } for (i = 0; i < weight; i++) { diff --git a/crypto_kem/hqc-rmrs-256/avx2/fft.c b/crypto_kem/hqc-rmrs-256/avx2/fft.c index 8b4755b5..c50ca34f 100644 --- a/crypto_kem/hqc-rmrs-256/avx2/fft.c +++ b/crypto_kem/hqc-rmrs-256/avx2/fft.c @@ -16,7 +16,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -46,7 +46,7 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { uint16_t i, j; subset_sums[0] = 0; diff --git a/crypto_kem/hqc-rmrs-256/clean/fft.c b/crypto_kem/hqc-rmrs-256/clean/fft.c index 759887dc..de1f6d29 100644 --- a/crypto_kem/hqc-rmrs-256/clean/fft.c +++ b/crypto_kem/hqc-rmrs-256/clean/fft.c @@ -16,7 +16,7 @@ static void compute_fft_betas(uint16_t *betas); -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size); +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size); static void radix(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f); static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32_t m_f, const uint16_t *betas); @@ -46,8 +46,8 @@ static void compute_fft_betas(uint16_t *betas) { * @param[in] set Array of set_size elements * @param[in] set_size Size of the array set */ -static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, size_t set_size) { - size_t i, j; +static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint16_t set_size) { + uint16_t i, j; subset_sums[0] = 0; for (i = 0; i < set_size; ++i) { diff --git a/crypto_kem/hqc-rmrs-256/clean/gf2x.c b/crypto_kem/hqc-rmrs-256/clean/gf2x.c index 9c190801..badc7464 100644 --- a/crypto_kem/hqc-rmrs-256/clean/gf2x.c +++ b/crypto_kem/hqc-rmrs-256/clean/gf2x.c @@ -42,10 +42,11 @@ static inline void swap(uint16_t *tab, uint16_t elt1, uint16_t elt2) { * @param[out] o Pointer to the result */ static void reduce(uint64_t *o, const uint64_t *a) { + size_t i; uint64_t r; uint64_t carry; - for (uint32_t i = 0; i < VEC_N_SIZE_64; i++) { + for (i = 0; i < VEC_N_SIZE_64; i++) { r = a[i + VEC_N_SIZE_64 - 1] >> (PARAM_N & 63); carry = (uint64_t) (a[i + VEC_N_SIZE_64] << (64 - (PARAM_N & 63))); o[i] = a[i] ^ r ^ carry; @@ -78,7 +79,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ uint16_t permutation_sparse_vect[PARAM_OMEGA_E]; uint64_t *pt; uint16_t *res_16; - uint16_t i, j; + size_t i, j; for (i = 0; i < 16; i++) { permuted_table[i] = i; @@ -113,7 +114,7 @@ static void fast_convolution_mult(uint64_t *o, const uint32_t *a1, const uint64_ seedexpander(ctx, (uint8_t *) permutation_sparse_vect, weight * sizeof(uint16_t)); for (i = 0; i + 1 < weight; i++) { - swap(permuted_sparse_vect + i, 0, permutation_sparse_vect[i] % (weight - i)); + swap(permuted_sparse_vect + i, 0, (uint16_t) (permutation_sparse_vect[i] % (weight - i))); } for (i = 0; i < weight; i++) { diff --git a/test/duplicate_consistency/hqc-128_avx2.yml b/test/duplicate_consistency/hqc-128_avx2.yml index 130b0bbb..7a83a7c6 100644 --- a/test/duplicate_consistency/hqc-128_avx2.yml +++ b/test/duplicate_consistency/hqc-128_avx2.yml @@ -28,6 +28,7 @@ consistency_checks: - repetition.h - vector.h - bch.c + - fft.c - gf.c - hqc.c - kem.c @@ -53,6 +54,7 @@ consistency_checks: - repetition.h - vector.h - bch.c + - fft.c - gf.c - hqc.c - kem.c diff --git a/test/duplicate_consistency/hqc-128_clean.yml b/test/duplicate_consistency/hqc-128_clean.yml index e228bfed..22fb4d58 100644 --- a/test/duplicate_consistency/hqc-128_clean.yml +++ b/test/duplicate_consistency/hqc-128_clean.yml @@ -21,6 +21,7 @@ consistency_checks: - vector.h - bch.c - code.c + - fft.c - gf2x.c - gf.c - hqc.c @@ -47,6 +48,7 @@ consistency_checks: - vector.h - bch.c - code.c + - fft.c - gf2x.c - gf.c - hqc.c diff --git a/test/duplicate_consistency/hqc-rmrs-128_avx2.yml b/test/duplicate_consistency/hqc-rmrs-128_avx2.yml index 5cc27639..a16db890 100644 --- a/test/duplicate_consistency/hqc-rmrs-128_avx2.yml +++ b/test/duplicate_consistency/hqc-rmrs-128_avx2.yml @@ -23,6 +23,7 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c - source: scheme: hqc-rmrs-192 implementation: avx2 @@ -55,6 +56,7 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c - source: scheme: hqc-rmrs-256 implementation: avx2 diff --git a/test/duplicate_consistency/hqc-rmrs-128_clean.yml b/test/duplicate_consistency/hqc-rmrs-128_clean.yml index ab5e197d..4bed9a73 100644 --- a/test/duplicate_consistency/hqc-rmrs-128_clean.yml +++ b/test/duplicate_consistency/hqc-rmrs-128_clean.yml @@ -26,6 +26,7 @@ consistency_checks: - reed_solomon.h - vector.h - code.c + - fft.c - gf2x.c - gf.c - hqc.c @@ -59,6 +60,7 @@ consistency_checks: - reed_solomon.h - vector.h - code.c + - fft.c - gf2x.c - gf.c - hqc.c diff --git a/test/duplicate_consistency/hqc-rmrs-192_avx2.yml b/test/duplicate_consistency/hqc-rmrs-192_avx2.yml index 468c4448..ab92b812 100644 --- a/test/duplicate_consistency/hqc-rmrs-192_avx2.yml +++ b/test/duplicate_consistency/hqc-rmrs-192_avx2.yml @@ -11,6 +11,7 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c - source: scheme: hqc-rmrs-256 implementation: clean @@ -22,6 +23,7 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c - source: scheme: hqc-rmrs-256 implementation: avx2 diff --git a/test/duplicate_consistency/hqc-rmrs-192_clean.yml b/test/duplicate_consistency/hqc-rmrs-192_clean.yml index 58649dff..db7a8c32 100644 --- a/test/duplicate_consistency/hqc-rmrs-192_clean.yml +++ b/test/duplicate_consistency/hqc-rmrs-192_clean.yml @@ -11,6 +11,7 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c - source: scheme: hqc-rmrs-256 implementation: clean @@ -44,3 +45,4 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c diff --git a/test/duplicate_consistency/hqc-rmrs-256_avx2.yml b/test/duplicate_consistency/hqc-rmrs-256_avx2.yml index c70728ab..755728eb 100644 --- a/test/duplicate_consistency/hqc-rmrs-256_avx2.yml +++ b/test/duplicate_consistency/hqc-rmrs-256_avx2.yml @@ -11,3 +11,4 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c diff --git a/test/duplicate_consistency/hqc-rmrs-256_clean.yml b/test/duplicate_consistency/hqc-rmrs-256_clean.yml index 98ffa2ad..895ecd4b 100644 --- a/test/duplicate_consistency/hqc-rmrs-256_clean.yml +++ b/test/duplicate_consistency/hqc-rmrs-256_clean.yml @@ -11,3 +11,4 @@ consistency_checks: - reed_muller.h - reed_solomon.h - code.c + - fft.c