Browse Source

explicit casts

master
John M. Schanck 4 years ago
parent
commit
c00cb2dd20
12 changed files with 30 additions and 30 deletions
  1. +2
    -2
      crypto_kem/kyber1024-90s/clean/indcpa.c
  2. +3
    -3
      crypto_kem/kyber1024-90s/clean/poly.c
  3. +2
    -2
      crypto_kem/kyber1024/clean/indcpa.c
  4. +3
    -3
      crypto_kem/kyber1024/clean/poly.c
  5. +2
    -2
      crypto_kem/kyber512-90s/clean/indcpa.c
  6. +3
    -3
      crypto_kem/kyber512-90s/clean/poly.c
  7. +2
    -2
      crypto_kem/kyber512/clean/indcpa.c
  8. +3
    -3
      crypto_kem/kyber512/clean/poly.c
  9. +2
    -2
      crypto_kem/kyber768-90s/clean/indcpa.c
  10. +3
    -3
      crypto_kem/kyber768-90s/clean/poly.c
  11. +2
    -2
      crypto_kem/kyber768/clean/indcpa.c
  12. +3
    -3
      crypto_kem/kyber768/clean/poly.c

+ 2
- 2
crypto_kem/kyber1024-90s/clean/indcpa.c View File

@@ -167,9 +167,9 @@ void PQCLEAN_KYBER102490S_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_
for (i = 0; i < KYBER_K; i++) { for (i = 0; i < KYBER_K; i++) {
for (j = 0; j < KYBER_K; j++) { for (j = 0; j < KYBER_K; j++) {
if (transposed) { if (transposed) {
xof_absorb(&state, seed, i, j);
xof_absorb(&state, seed, (uint8_t)i, (uint8_t)j);
} else { } else {
xof_absorb(&state, seed, j, i);
xof_absorb(&state, seed, (uint8_t)j, (uint8_t)i);
} }


xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state); xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state);


+ 3
- 3
crypto_kem/kyber1024-90s/clean/poly.c View File

@@ -88,9 +88,9 @@ void PQCLEAN_KYBER102490S_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], const p
t0 += ((int16_t)t0 >> 15) & KYBER_Q; t0 += ((int16_t)t0 >> 15) & KYBER_Q;
t1 = a->coeffs[2 * i + 1]; t1 = a->coeffs[2 * i + 1];
t1 += ((int16_t)t1 >> 15) & KYBER_Q; t1 += ((int16_t)t1 >> 15) & KYBER_Q;
r[3 * i + 0] = (t0 >> 0);
r[3 * i + 1] = (t0 >> 8) | (t1 << 4);
r[3 * i + 2] = (t1 >> 4);
r[3 * i + 0] = (uint8_t)(t0 >> 0);
r[3 * i + 1] = (uint8_t)((t0 >> 8) | (t1 << 4));
r[3 * i + 2] = (uint8_t)(t1 >> 4);
} }
} }




+ 2
- 2
crypto_kem/kyber1024/clean/indcpa.c View File

@@ -167,9 +167,9 @@ void PQCLEAN_KYBER1024_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYM
for (i = 0; i < KYBER_K; i++) { for (i = 0; i < KYBER_K; i++) {
for (j = 0; j < KYBER_K; j++) { for (j = 0; j < KYBER_K; j++) {
if (transposed) { if (transposed) {
xof_absorb(&state, seed, i, j);
xof_absorb(&state, seed, (uint8_t)i, (uint8_t)j);
} else { } else {
xof_absorb(&state, seed, j, i);
xof_absorb(&state, seed, (uint8_t)j, (uint8_t)i);
} }


xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state); xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state);


+ 3
- 3
crypto_kem/kyber1024/clean/poly.c View File

@@ -88,9 +88,9 @@ void PQCLEAN_KYBER1024_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], const poly
t0 += ((int16_t)t0 >> 15) & KYBER_Q; t0 += ((int16_t)t0 >> 15) & KYBER_Q;
t1 = a->coeffs[2 * i + 1]; t1 = a->coeffs[2 * i + 1];
t1 += ((int16_t)t1 >> 15) & KYBER_Q; t1 += ((int16_t)t1 >> 15) & KYBER_Q;
r[3 * i + 0] = (t0 >> 0);
r[3 * i + 1] = (t0 >> 8) | (t1 << 4);
r[3 * i + 2] = (t1 >> 4);
r[3 * i + 0] = (uint8_t)(t0 >> 0);
r[3 * i + 1] = (uint8_t)((t0 >> 8) | (t1 << 4));
r[3 * i + 2] = (uint8_t)(t1 >> 4);
} }
} }




+ 2
- 2
crypto_kem/kyber512-90s/clean/indcpa.c View File

@@ -167,9 +167,9 @@ void PQCLEAN_KYBER51290S_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_S
for (i = 0; i < KYBER_K; i++) { for (i = 0; i < KYBER_K; i++) {
for (j = 0; j < KYBER_K; j++) { for (j = 0; j < KYBER_K; j++) {
if (transposed) { if (transposed) {
xof_absorb(&state, seed, i, j);
xof_absorb(&state, seed, (uint8_t)i, (uint8_t)j);
} else { } else {
xof_absorb(&state, seed, j, i);
xof_absorb(&state, seed, (uint8_t)j, (uint8_t)i);
} }


xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state); xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state);


+ 3
- 3
crypto_kem/kyber512-90s/clean/poly.c View File

@@ -75,9 +75,9 @@ void PQCLEAN_KYBER51290S_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], const po
t0 += ((int16_t)t0 >> 15) & KYBER_Q; t0 += ((int16_t)t0 >> 15) & KYBER_Q;
t1 = a->coeffs[2 * i + 1]; t1 = a->coeffs[2 * i + 1];
t1 += ((int16_t)t1 >> 15) & KYBER_Q; t1 += ((int16_t)t1 >> 15) & KYBER_Q;
r[3 * i + 0] = (t0 >> 0);
r[3 * i + 1] = (t0 >> 8) | (t1 << 4);
r[3 * i + 2] = (t1 >> 4);
r[3 * i + 0] = (uint8_t)(t0 >> 0);
r[3 * i + 1] = (uint8_t)((t0 >> 8) | (t1 << 4));
r[3 * i + 2] = (uint8_t)(t1 >> 4);
} }
} }




+ 2
- 2
crypto_kem/kyber512/clean/indcpa.c View File

@@ -167,9 +167,9 @@ void PQCLEAN_KYBER512_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMB
for (i = 0; i < KYBER_K; i++) { for (i = 0; i < KYBER_K; i++) {
for (j = 0; j < KYBER_K; j++) { for (j = 0; j < KYBER_K; j++) {
if (transposed) { if (transposed) {
xof_absorb(&state, seed, i, j);
xof_absorb(&state, seed, (uint8_t)i, (uint8_t)j);
} else { } else {
xof_absorb(&state, seed, j, i);
xof_absorb(&state, seed, (uint8_t)j, (uint8_t)i);
} }


xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state); xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state);


+ 3
- 3
crypto_kem/kyber512/clean/poly.c View File

@@ -75,9 +75,9 @@ void PQCLEAN_KYBER512_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], const poly
t0 += ((int16_t)t0 >> 15) & KYBER_Q; t0 += ((int16_t)t0 >> 15) & KYBER_Q;
t1 = a->coeffs[2 * i + 1]; t1 = a->coeffs[2 * i + 1];
t1 += ((int16_t)t1 >> 15) & KYBER_Q; t1 += ((int16_t)t1 >> 15) & KYBER_Q;
r[3 * i + 0] = (t0 >> 0);
r[3 * i + 1] = (t0 >> 8) | (t1 << 4);
r[3 * i + 2] = (t1 >> 4);
r[3 * i + 0] = (uint8_t)(t0 >> 0);
r[3 * i + 1] = (uint8_t)((t0 >> 8) | (t1 << 4));
r[3 * i + 2] = (uint8_t)(t1 >> 4);
} }
} }




+ 2
- 2
crypto_kem/kyber768-90s/clean/indcpa.c View File

@@ -167,9 +167,9 @@ void PQCLEAN_KYBER76890S_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_S
for (i = 0; i < KYBER_K; i++) { for (i = 0; i < KYBER_K; i++) {
for (j = 0; j < KYBER_K; j++) { for (j = 0; j < KYBER_K; j++) {
if (transposed) { if (transposed) {
xof_absorb(&state, seed, i, j);
xof_absorb(&state, seed, (uint8_t)i, (uint8_t)j);
} else { } else {
xof_absorb(&state, seed, j, i);
xof_absorb(&state, seed, (uint8_t)j, (uint8_t)i);
} }


xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state); xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state);


+ 3
- 3
crypto_kem/kyber768-90s/clean/poly.c View File

@@ -75,9 +75,9 @@ void PQCLEAN_KYBER76890S_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], const po
t0 += ((int16_t)t0 >> 15) & KYBER_Q; t0 += ((int16_t)t0 >> 15) & KYBER_Q;
t1 = a->coeffs[2 * i + 1]; t1 = a->coeffs[2 * i + 1];
t1 += ((int16_t)t1 >> 15) & KYBER_Q; t1 += ((int16_t)t1 >> 15) & KYBER_Q;
r[3 * i + 0] = (t0 >> 0);
r[3 * i + 1] = (t0 >> 8) | (t1 << 4);
r[3 * i + 2] = (t1 >> 4);
r[3 * i + 0] = (uint8_t)(t0 >> 0);
r[3 * i + 1] = (uint8_t)((t0 >> 8) | (t1 << 4));
r[3 * i + 2] = (uint8_t)(t1 >> 4);
} }
} }




+ 2
- 2
crypto_kem/kyber768/clean/indcpa.c View File

@@ -167,9 +167,9 @@ void PQCLEAN_KYBER768_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMB
for (i = 0; i < KYBER_K; i++) { for (i = 0; i < KYBER_K; i++) {
for (j = 0; j < KYBER_K; j++) { for (j = 0; j < KYBER_K; j++) {
if (transposed) { if (transposed) {
xof_absorb(&state, seed, i, j);
xof_absorb(&state, seed, (uint8_t)i, (uint8_t)j);
} else { } else {
xof_absorb(&state, seed, j, i);
xof_absorb(&state, seed, (uint8_t)j, (uint8_t)i);
} }


xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state); xof_squeezeblocks(buf, GEN_MATRIX_NBLOCKS, &state);


+ 3
- 3
crypto_kem/kyber768/clean/poly.c View File

@@ -75,9 +75,9 @@ void PQCLEAN_KYBER768_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], const poly
t0 += ((int16_t)t0 >> 15) & KYBER_Q; t0 += ((int16_t)t0 >> 15) & KYBER_Q;
t1 = a->coeffs[2 * i + 1]; t1 = a->coeffs[2 * i + 1];
t1 += ((int16_t)t1 >> 15) & KYBER_Q; t1 += ((int16_t)t1 >> 15) & KYBER_Q;
r[3 * i + 0] = (t0 >> 0);
r[3 * i + 1] = (t0 >> 8) | (t1 << 4);
r[3 * i + 2] = (t1 >> 4);
r[3 * i + 0] = (uint8_t)(t0 >> 0);
r[3 * i + 1] = (uint8_t)((t0 >> 8) | (t1 << 4));
r[3 * i + 2] = (uint8_t)(t1 >> 4);
} }
} }




Loading…
Cancel
Save