ms compiler changes for fft.c
This commit is contained in:
父節點
262e64168f
當前提交
2f05de259d
@ -31,7 +31,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -202,7 +202,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC128_AVX2_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC128_AVX2_gf_mul(beta_m_pow, f[i]);
|
||||
@ -224,7 +224,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -300,7 +300,7 @@ void PQCLEAN_HQC128_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -329,15 +329,14 @@ void PQCLEAN_HQC128_AVX2_fft_retrieve_bch_error_poly(uint64_t *error, const uint
|
||||
uint16_t gammas[PARAM_M - 1] = {0};
|
||||
uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0};
|
||||
uint64_t bit;
|
||||
uint16_t k;
|
||||
size_t i, index;
|
||||
size_t i, k, index;
|
||||
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
index = PARAM_GF_MUL_ORDER;
|
||||
bit = 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
error[index / 8] ^= bit << (index % 64);
|
||||
|
@ -34,7 +34,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,10 +134,9 @@ static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uin
|
||||
uint16_t Q[1 << 2 * (PARAM_FFT_T - 2)] = {0};
|
||||
uint16_t R[1 << 2 * (PARAM_FFT_T - 2)] = {0};
|
||||
|
||||
uint16_t n;
|
||||
size_t i;
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q0, f0 + n, 2 * n);
|
||||
memcpy(Q1, f1 + n, 2 * n);
|
||||
memcpy(R0, f0, 2 * n);
|
||||
@ -187,7 +186,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
// Step 1
|
||||
if (m_f == 1) {
|
||||
f[0] = 0;
|
||||
x = 1 << m;
|
||||
x = (size_t) (1 << m);
|
||||
for (i = 0; i < x; ++i) {
|
||||
f[0] ^= w[i];
|
||||
}
|
||||
@ -221,7 +220,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
* Transpose:
|
||||
* u[i] = w[i] + w[k+i]
|
||||
* v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case
|
||||
// Step 5: Compute f0 from u and f1 from v
|
||||
f1[1] = 0;
|
||||
@ -252,7 +251,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
// Step 2: compute f from g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -297,7 +296,7 @@ void PQCLEAN_HQC128_CLEAN_fft_t(uint16_t *f, const uint16_t *w, size_t f_coeffs)
|
||||
* Transpose:
|
||||
* u[i] = w[i] + w[k+i]
|
||||
* v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
u[0] = w[0] ^ w[k];
|
||||
v[0] = w[k];
|
||||
for (i = 1; i < k; ++i) {
|
||||
@ -396,7 +395,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -464,7 +463,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC128_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -486,7 +485,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -562,7 +561,7 @@ void PQCLEAN_HQC128_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -637,15 +636,14 @@ void PQCLEAN_HQC128_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;
|
||||
uint16_t k;
|
||||
size_t i, index;
|
||||
size_t i, k, index;
|
||||
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
index = PARAM_GF_MUL_ORDER;
|
||||
bit = 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
error[index / 8] ^= bit << (index % 64);
|
||||
|
@ -31,7 +31,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -202,7 +202,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC192_AVX2_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC192_AVX2_gf_mul(beta_m_pow, f[i]);
|
||||
@ -224,7 +224,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -300,7 +300,7 @@ void PQCLEAN_HQC192_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -329,15 +329,14 @@ void PQCLEAN_HQC192_AVX2_fft_retrieve_bch_error_poly(uint64_t *error, const uint
|
||||
uint16_t gammas[PARAM_M - 1] = {0};
|
||||
uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0};
|
||||
uint64_t bit;
|
||||
uint16_t k;
|
||||
size_t i, index;
|
||||
size_t i, k, index;
|
||||
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
index = PARAM_GF_MUL_ORDER;
|
||||
bit = 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
error[index / 8] ^= bit << (index % 64);
|
||||
|
@ -34,7 +34,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,10 +134,9 @@ static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uin
|
||||
uint16_t Q[1 << 2 * (PARAM_FFT_T - 2)] = {0};
|
||||
uint16_t R[1 << 2 * (PARAM_FFT_T - 2)] = {0};
|
||||
|
||||
uint16_t n;
|
||||
size_t i;
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q0, f0 + n, 2 * n);
|
||||
memcpy(Q1, f1 + n, 2 * n);
|
||||
memcpy(R0, f0, 2 * n);
|
||||
@ -187,7 +186,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
// Step 1
|
||||
if (m_f == 1) {
|
||||
f[0] = 0;
|
||||
x = 1 << m;
|
||||
x = (size_t) (1 << m);
|
||||
for (i = 0; i < x; ++i) {
|
||||
f[0] ^= w[i];
|
||||
}
|
||||
@ -221,7 +220,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
* Transpose:
|
||||
* u[i] = w[i] + w[k+i]
|
||||
* v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case
|
||||
// Step 5: Compute f0 from u and f1 from v
|
||||
f1[1] = 0;
|
||||
@ -252,7 +251,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
// Step 2: compute f from g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -297,7 +296,7 @@ void PQCLEAN_HQC192_CLEAN_fft_t(uint16_t *f, const uint16_t *w, size_t f_coeffs)
|
||||
* Transpose:
|
||||
* u[i] = w[i] + w[k+i]
|
||||
* v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
u[0] = w[0] ^ w[k];
|
||||
v[0] = w[k];
|
||||
for (i = 1; i < k; ++i) {
|
||||
@ -396,7 +395,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -464,7 +463,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC192_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -486,7 +485,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -562,7 +561,7 @@ void PQCLEAN_HQC192_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -637,15 +636,14 @@ 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;
|
||||
uint16_t k;
|
||||
size_t i, index;
|
||||
size_t i, k, index;
|
||||
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
index = PARAM_GF_MUL_ORDER;
|
||||
bit = 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
error[index / 8] ^= bit << (index % 64);
|
||||
|
@ -31,7 +31,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -202,7 +202,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC256_AVX2_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC256_AVX2_gf_mul(beta_m_pow, f[i]);
|
||||
@ -224,7 +224,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -300,7 +300,7 @@ void PQCLEAN_HQC256_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -329,15 +329,14 @@ void PQCLEAN_HQC256_AVX2_fft_retrieve_bch_error_poly(uint64_t *error, const uint
|
||||
uint16_t gammas[PARAM_M - 1] = {0};
|
||||
uint16_t gammas_sums[1 << (PARAM_M - 1)] = {0};
|
||||
uint64_t bit;
|
||||
uint16_t k;
|
||||
size_t i, index;
|
||||
size_t i, k, index;
|
||||
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
index = PARAM_GF_MUL_ORDER;
|
||||
bit = 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
error[index / 8] ^= bit << (index % 64);
|
||||
|
@ -34,7 +34,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,10 +134,9 @@ static void radix_t_big(uint16_t *f, const uint16_t *f0, const uint16_t *f1, uin
|
||||
uint16_t Q[1 << 2 * (PARAM_FFT_T - 2)] = {0};
|
||||
uint16_t R[1 << 2 * (PARAM_FFT_T - 2)] = {0};
|
||||
|
||||
uint16_t n;
|
||||
size_t i;
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q0, f0 + n, 2 * n);
|
||||
memcpy(Q1, f1 + n, 2 * n);
|
||||
memcpy(R0, f0, 2 * n);
|
||||
@ -187,7 +186,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
// Step 1
|
||||
if (m_f == 1) {
|
||||
f[0] = 0;
|
||||
x = 1 << m;
|
||||
x = (size_t) (1 << m);
|
||||
for (i = 0; i < x; ++i) {
|
||||
f[0] ^= w[i];
|
||||
}
|
||||
@ -221,7 +220,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
* Transpose:
|
||||
* u[i] = w[i] + w[k+i]
|
||||
* v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case
|
||||
// Step 5: Compute f0 from u and f1 from v
|
||||
f1[1] = 0;
|
||||
@ -252,7 +251,7 @@ static void fft_t_rec(uint16_t *f, const uint16_t *w, size_t f_coeffs, uint8_t m
|
||||
// Step 2: compute f from g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -297,7 +296,7 @@ void PQCLEAN_HQC256_CLEAN_fft_t(uint16_t *f, const uint16_t *w, size_t f_coeffs)
|
||||
* Transpose:
|
||||
* u[i] = w[i] + w[k+i]
|
||||
* v[i] = G[i].w[i] + (G[i]+1).w[k+i] = G[i].u[i] + w[k+i] */
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
u[0] = w[0] ^ w[k];
|
||||
v[0] = w[k];
|
||||
for (i = 1; i < k; ++i) {
|
||||
@ -396,7 +395,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -464,7 +463,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQC256_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -486,7 +485,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -562,7 +561,7 @@ void PQCLEAN_HQC256_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -637,15 +636,14 @@ 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;
|
||||
uint16_t k;
|
||||
size_t i, index;
|
||||
size_t i, k, index;
|
||||
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
index = PARAM_GF_MUL_ORDER;
|
||||
bit = 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
error[index / 8] ^= bit << (index % 64);
|
||||
|
@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQCRMRS128_AVX2_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQCRMRS128_AVX2_gf_mul(beta_m_pow, f[i]);
|
||||
@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS128_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS128_AVX2_fft_retrieve_error_poly(uint8_t *error, const uint1
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
|
||||
|
@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQCRMRS128_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQCRMRS128_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS128_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeff
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS128_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
|
||||
|
@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQCRMRS192_AVX2_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQCRMRS192_AVX2_gf_mul(beta_m_pow, f[i]);
|
||||
@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS192_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS192_AVX2_fft_retrieve_error_poly(uint8_t *error, const uint1
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
|
||||
|
@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQCRMRS192_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQCRMRS192_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS192_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeff
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS192_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
|
||||
|
@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQCRMRS256_AVX2_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQCRMRS256_AVX2_gf_mul(beta_m_pow, f[i]);
|
||||
@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS256_AVX2_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS256_AVX2_fft_retrieve_error_poly(uint8_t *error, const uint1
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
|
||||
|
@ -30,7 +30,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
static void compute_fft_betas(uint16_t *betas) {
|
||||
size_t i;
|
||||
for (i = 0; i < PARAM_M - 1; ++i) {
|
||||
betas[i] = 1 << (PARAM_M - 1 - i);
|
||||
betas[i] = (uint16_t) (1 << (PARAM_M - 1 - i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
|
||||
|
||||
size_t i, n;
|
||||
|
||||
n = 1 << (m_f - 2);
|
||||
n = (size_t) (1 << (m_f - 2));
|
||||
memcpy(Q, f + 3 * n, 2 * n);
|
||||
memcpy(Q + n, f + 3 * n, 2 * n);
|
||||
memcpy(R, f, 4 * n);
|
||||
@ -201,7 +201,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 2: compute g
|
||||
if (betas[m - 1] != 1) {
|
||||
beta_m_pow = 1;
|
||||
x = 1 << m_f;
|
||||
x = (size_t) (1 << m_f);
|
||||
for (i = 1; i < x; ++i) {
|
||||
beta_m_pow = PQCLEAN_HQCRMRS256_CLEAN_gf_mul(beta_m_pow, betas[m - 1]);
|
||||
f[i] = PQCLEAN_HQCRMRS256_CLEAN_gf_mul(beta_m_pow, f[i]);
|
||||
@ -223,7 +223,7 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
|
||||
// Step 5
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, m - 1, m_f - 1, deltas);
|
||||
|
||||
k = 1 << ((m - 1) & 0xf); // &0xf is to let the compiler know that m-1 is small.
|
||||
k = (size_t) (1 << ((m - 1) & 0xf)); // &0xf is to let the compiler know that m-1 is small.
|
||||
if (f_coeffs <= 3) { // 3-coefficient polynomial f case: f1 is constant
|
||||
w[0] = u[0];
|
||||
w[k] = u[0] ^ f1[0];
|
||||
@ -299,7 +299,7 @@ void PQCLEAN_HQCRMRS256_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeff
|
||||
fft_rec(u, f0, (f_coeffs + 1) / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
fft_rec(v, f1, f_coeffs / 2, PARAM_M - 1, PARAM_FFT - 1, deltas);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
// Step 6, 7 and error polynomial computation
|
||||
memcpy(w + k, v, 2 * k);
|
||||
|
||||
@ -334,7 +334,7 @@ void PQCLEAN_HQCRMRS256_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint
|
||||
compute_fft_betas(gammas);
|
||||
compute_subset_sums(gammas_sums, gammas, PARAM_M - 1);
|
||||
|
||||
k = 1 << (PARAM_M - 1);
|
||||
k = (size_t) (1 << (PARAM_M - 1));
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[0] >> 15);
|
||||
error[0] ^= 1 ^ ((uint16_t) - w[k] >> 15);
|
||||
|
||||
|
載入中…
新增問題並參考
Block a user