Fix more compiler warnings

This commit is contained in:
Douglas Stebila 2019-03-31 21:55:55 -04:00
parent 1e5e9d96f8
commit 41bc57689c

View File

@ -17,14 +17,14 @@ int PQCLEAN_FRODOKEM640SHAKE_CLEAN_mul_add_as_plus_e(uint16_t *out, const uint16
// Generate-and-multiply: generate matrix A (N x N) row-wise, multiply by s on the right. // Generate-and-multiply: generate matrix A (N x N) row-wise, multiply by s on the right.
// Inputs: s, e (N x N_BAR) // Inputs: s, e (N x N_BAR)
// Output: out = A*s + e (N x N_BAR) // Output: out = A*s + e (N x N_BAR)
uint16_t i, j, k; int i, j, k;
int16_t A[PARAMS_N * PARAMS_N] = {0}; int16_t A[PARAMS_N * PARAMS_N] = {0};
uint8_t seed_A_separated[2 + BYTES_SEED_A]; uint8_t seed_A_separated[2 + BYTES_SEED_A];
uint16_t *seed_A_origin = (uint16_t *)&seed_A_separated; uint16_t *seed_A_origin = (uint16_t *)&seed_A_separated;
memcpy(&seed_A_separated[2], seed_A, BYTES_SEED_A); memcpy(&seed_A_separated[2], seed_A, BYTES_SEED_A);
for (i = 0; i < PARAMS_N; i++) { for (i = 0; i < PARAMS_N; i++) {
seed_A_origin[0] = PQCLEAN_FRODOKEM640SHAKE_CLEAN_UINT16_TO_LE(i); seed_A_origin[0] = PQCLEAN_FRODOKEM640SHAKE_CLEAN_UINT16_TO_LE((uint16_t) i);
shake128((unsigned char *)(A + i * PARAMS_N), (unsigned long long)(2 * PARAMS_N), seed_A_separated, 2 + BYTES_SEED_A); shake128((unsigned char *)(A + i * PARAMS_N), (unsigned long long)(2 * PARAMS_N), seed_A_separated, 2 + BYTES_SEED_A);
} }
for (i = 0; i < PARAMS_N * PARAMS_N; i++) { for (i = 0; i < PARAMS_N * PARAMS_N; i++) {
@ -50,14 +50,14 @@ int PQCLEAN_FRODOKEM640SHAKE_CLEAN_mul_add_sa_plus_e(uint16_t *out, const uint16
// Generate-and-multiply: generate matrix A (N x N) column-wise, multiply by s' on the left. // Generate-and-multiply: generate matrix A (N x N) column-wise, multiply by s' on the left.
// Inputs: s', e' (N_BAR x N) // Inputs: s', e' (N_BAR x N)
// Output: out = s'*A + e' (N_BAR x N) // Output: out = s'*A + e' (N_BAR x N)
uint16_t i, j, k; int i, j, k;
int16_t A[PARAMS_N * PARAMS_N] = {0}; int16_t A[PARAMS_N * PARAMS_N] = {0};
uint8_t seed_A_separated[2 + BYTES_SEED_A]; uint8_t seed_A_separated[2 + BYTES_SEED_A];
uint16_t *seed_A_origin = (uint16_t *)&seed_A_separated; uint16_t *seed_A_origin = (uint16_t *)&seed_A_separated;
memcpy(&seed_A_separated[2], seed_A, BYTES_SEED_A); memcpy(&seed_A_separated[2], seed_A, BYTES_SEED_A);
for (i = 0; i < PARAMS_N; i++) { for (i = 0; i < PARAMS_N; i++) {
seed_A_origin[0] = PQCLEAN_FRODOKEM640SHAKE_CLEAN_UINT16_TO_LE(i); seed_A_origin[0] = PQCLEAN_FRODOKEM640SHAKE_CLEAN_UINT16_TO_LE((uint16_t) i);
shake128((unsigned char *)(A + i * PARAMS_N), (unsigned long long)(2 * PARAMS_N), seed_A_separated, 2 + BYTES_SEED_A); shake128((unsigned char *)(A + i * PARAMS_N), (unsigned long long)(2 * PARAMS_N), seed_A_separated, 2 + BYTES_SEED_A);
} }
for (i = 0; i < PARAMS_N * PARAMS_N; i++) { for (i = 0; i < PARAMS_N * PARAMS_N; i++) {