1
1
Mirror von https://github.com/henrydcase/pqc.git synchronisiert 2024-11-22 07:35:38 +00:00

Silence a bunch of Windows warnings

Dieser Commit ist enthalten in:
Thom Wiggers 2020-09-17 10:23:24 +02:00 committet von Kris Kwiatkowski
Ursprung c0f56ccdc2
Commit 22cb59d083
30 geänderte Dateien mit 84 neuen und 78 gelöschten Zeilen

Datei anzeigen

@ -169,7 +169,8 @@ static unsigned int rej_uniform(int16_t *r,
+ XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void PQCLEAN_KYBER102490S_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed) {
unsigned int ctr = 0, i = 0, j = 0;
unsigned int ctr = 0;
uint8_t i = 0, j = 0;
uint8_t buf[GEN_MATRIX_NBLOCKS * XOF_BLOCKBYTES];
xof_state state;

Datei anzeigen

@ -117,7 +117,7 @@ int PQCLEAN_KYBER102490S_CLEAN_crypto_kem_dec(unsigned char *ss,
hash_h(kr + KYBER_SYMBYTES, ct, KYBER_CIPHERTEXTBYTES);
/* Overwrite pre-k with z on re-encryption failure */
PQCLEAN_KYBER102490S_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, fail);
PQCLEAN_KYBER102490S_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, (uint8_t)fail);
/* hash concatenation of pre-k and H(c) to k */
kdf(ss, kr, 2 * KYBER_SYMBYTES);

Datei anzeigen

@ -85,9 +85,9 @@ void PQCLEAN_KYBER102490S_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], poly *a
for (i = 0; i < KYBER_N / 2; i++) {
t0 = a->coeffs[2 * i];
t1 = a->coeffs[2 * i + 1];
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);
}
}

Datei anzeigen

@ -27,17 +27,17 @@ void PQCLEAN_KYBER102490S_CLEAN_polyvec_compress(uint8_t r[KYBER_POLYVECCOMPRESS
}
}
r[ 0] = (t[0] >> 0);
r[ 1] = (t[0] >> 8) | (t[1] << 3);
r[ 2] = (t[1] >> 5) | (t[2] << 6);
r[ 3] = (t[2] >> 2);
r[ 4] = (t[2] >> 10) | (t[3] << 1);
r[ 5] = (t[3] >> 7) | (t[4] << 4);
r[ 6] = (t[4] >> 4) | (t[5] << 7);
r[ 7] = (t[5] >> 1);
r[ 8] = (t[5] >> 9) | (t[6] << 2);
r[ 9] = (t[6] >> 6) | (t[7] << 5);
r[10] = (t[7] >> 3);
r[ 0] = (uint8_t)(t[0] >> 0);
r[ 1] = (uint8_t)((t[0] >> 8) | (t[1] << 3));
r[ 2] = (uint8_t)((t[1] >> 5) | (t[2] << 6));
r[ 3] = (uint8_t)(t[2] >> 2);
r[ 4] = (uint8_t)((t[2] >> 10) | (t[3] << 1));
r[ 5] = (uint8_t)((t[3] >> 7) | (t[4] << 4));
r[ 6] = (uint8_t)((t[4] >> 4) | (t[5] << 7));
r[ 7] = (uint8_t)(t[5] >> 1);
r[ 8] = (uint8_t)((t[5] >> 9) | (t[6] << 2));
r[ 9] = (uint8_t)((t[6] >> 6) | (t[7] << 5));
r[10] = (uint8_t)(t[7] >> 3);
r += 11;
}
}

Datei anzeigen

@ -22,7 +22,7 @@ int16_t PQCLEAN_KYBER102490S_CLEAN_montgomery_reduce(int32_t a) {
t = (int32_t)u * KYBER_Q;
t = a - t;
t >>= 16;
return t;
return (int16_t)t;
}
/*************************************************

Datei anzeigen

@ -169,7 +169,8 @@ static unsigned int rej_uniform(int16_t *r,
+ XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void PQCLEAN_KYBER1024_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed) {
unsigned int ctr = 0, i = 0, j = 0;
unsigned int ctr = 0;
uint8_t i = 0, j = 0;
uint8_t buf[GEN_MATRIX_NBLOCKS * XOF_BLOCKBYTES];
xof_state state;

Datei anzeigen

@ -117,7 +117,7 @@ int PQCLEAN_KYBER1024_CLEAN_crypto_kem_dec(unsigned char *ss,
hash_h(kr + KYBER_SYMBYTES, ct, KYBER_CIPHERTEXTBYTES);
/* Overwrite pre-k with z on re-encryption failure */
PQCLEAN_KYBER1024_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, fail);
PQCLEAN_KYBER1024_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, (uint8_t)fail);
/* hash concatenation of pre-k and H(c) to k */
kdf(ss, kr, 2 * KYBER_SYMBYTES);

Datei anzeigen

@ -85,9 +85,9 @@ void PQCLEAN_KYBER1024_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], poly *a) {
for (i = 0; i < KYBER_N / 2; i++) {
t0 = a->coeffs[2 * i];
t1 = a->coeffs[2 * i + 1];
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);
}
}

Datei anzeigen

@ -27,17 +27,17 @@ void PQCLEAN_KYBER1024_CLEAN_polyvec_compress(uint8_t r[KYBER_POLYVECCOMPRESSEDB
}
}
r[ 0] = (t[0] >> 0);
r[ 1] = (t[0] >> 8) | (t[1] << 3);
r[ 2] = (t[1] >> 5) | (t[2] << 6);
r[ 3] = (t[2] >> 2);
r[ 4] = (t[2] >> 10) | (t[3] << 1);
r[ 5] = (t[3] >> 7) | (t[4] << 4);
r[ 6] = (t[4] >> 4) | (t[5] << 7);
r[ 7] = (t[5] >> 1);
r[ 8] = (t[5] >> 9) | (t[6] << 2);
r[ 9] = (t[6] >> 6) | (t[7] << 5);
r[10] = (t[7] >> 3);
r[ 0] = (uint8_t)(t[0] >> 0);
r[ 1] = (uint8_t)((t[0] >> 8) | (t[1] << 3));
r[ 2] = (uint8_t)((t[1] >> 5) | (t[2] << 6));
r[ 3] = (uint8_t)(t[2] >> 2);
r[ 4] = (uint8_t)((t[2] >> 10) | (t[3] << 1));
r[ 5] = (uint8_t)((t[3] >> 7) | (t[4] << 4));
r[ 6] = (uint8_t)((t[4] >> 4) | (t[5] << 7));
r[ 7] = (uint8_t)(t[5] >> 1);
r[ 8] = (uint8_t)((t[5] >> 9) | (t[6] << 2));
r[ 9] = (uint8_t)((t[6] >> 6) | (t[7] << 5));
r[10] = (uint8_t)(t[7] >> 3);
r += 11;
}
}

Datei anzeigen

@ -22,7 +22,7 @@ int16_t PQCLEAN_KYBER1024_CLEAN_montgomery_reduce(int32_t a) {
t = (int32_t)u * KYBER_Q;
t = a - t;
t >>= 16;
return t;
return (int16_t)t;
}
/*************************************************

Datei anzeigen

@ -169,7 +169,8 @@ static unsigned int rej_uniform(int16_t *r,
+ XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void PQCLEAN_KYBER51290S_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed) {
unsigned int ctr = 0, i = 0, j = 0;
unsigned int ctr = 0;
uint8_t i = 0, j = 0;
uint8_t buf[GEN_MATRIX_NBLOCKS * XOF_BLOCKBYTES];
xof_state state;

Datei anzeigen

@ -117,7 +117,7 @@ int PQCLEAN_KYBER51290S_CLEAN_crypto_kem_dec(unsigned char *ss,
hash_h(kr + KYBER_SYMBYTES, ct, KYBER_CIPHERTEXTBYTES);
/* Overwrite pre-k with z on re-encryption failure */
PQCLEAN_KYBER51290S_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, fail);
PQCLEAN_KYBER51290S_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, (uint8_t)fail);
/* hash concatenation of pre-k and H(c) to k */
kdf(ss, kr, 2 * KYBER_SYMBYTES);

Datei anzeigen

@ -83,9 +83,9 @@ void PQCLEAN_KYBER51290S_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], poly *a)
for (i = 0; i < KYBER_N / 2; i++) {
t0 = a->coeffs[2 * i];
t1 = a->coeffs[2 * i + 1];
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);
}
}

Datei anzeigen

@ -27,11 +27,11 @@ void PQCLEAN_KYBER51290S_CLEAN_polyvec_compress(uint8_t r[KYBER_POLYVECCOMPRESSE
}
}
r[0] = (t[0] >> 0);
r[1] = (t[0] >> 8) | (t[1] << 2);
r[2] = (t[1] >> 6) | (t[2] << 4);
r[3] = (t[2] >> 4) | (t[3] << 6);
r[4] = (t[3] >> 2);
r[0] = (uint8_t)(t[0] >> 0);
r[1] = (uint8_t)((t[0] >> 8) | (t[1] << 2));
r[2] = (uint8_t)((t[1] >> 6) | (t[2] << 4));
r[3] = (uint8_t)((t[2] >> 4) | (t[3] << 6));
r[4] = (uint8_t)(t[3] >> 2);
r += 5;
}
}

Datei anzeigen

@ -22,7 +22,7 @@ int16_t PQCLEAN_KYBER51290S_CLEAN_montgomery_reduce(int32_t a) {
t = (int32_t)u * KYBER_Q;
t = a - t;
t >>= 16;
return t;
return (int16_t)t;
}
/*************************************************

Datei anzeigen

@ -169,7 +169,8 @@ static unsigned int rej_uniform(int16_t *r,
+ XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void PQCLEAN_KYBER512_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed) {
unsigned int ctr = 0, i = 0, j = 0;
unsigned int ctr = 0;
uint8_t i = 0, j = 0;
uint8_t buf[GEN_MATRIX_NBLOCKS * XOF_BLOCKBYTES];
xof_state state;

Datei anzeigen

@ -117,7 +117,7 @@ int PQCLEAN_KYBER512_CLEAN_crypto_kem_dec(unsigned char *ss,
hash_h(kr + KYBER_SYMBYTES, ct, KYBER_CIPHERTEXTBYTES);
/* Overwrite pre-k with z on re-encryption failure */
PQCLEAN_KYBER512_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, fail);
PQCLEAN_KYBER512_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, (uint8_t)fail);
/* hash concatenation of pre-k and H(c) to k */
kdf(ss, kr, 2 * KYBER_SYMBYTES);

Datei anzeigen

@ -83,9 +83,9 @@ void PQCLEAN_KYBER512_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], poly *a) {
for (i = 0; i < KYBER_N / 2; i++) {
t0 = a->coeffs[2 * i];
t1 = a->coeffs[2 * i + 1];
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);
}
}

Datei anzeigen

@ -27,11 +27,11 @@ void PQCLEAN_KYBER512_CLEAN_polyvec_compress(uint8_t r[KYBER_POLYVECCOMPRESSEDBY
}
}
r[0] = (t[0] >> 0);
r[1] = (t[0] >> 8) | (t[1] << 2);
r[2] = (t[1] >> 6) | (t[2] << 4);
r[3] = (t[2] >> 4) | (t[3] << 6);
r[4] = (t[3] >> 2);
r[0] = (uint8_t)(t[0] >> 0);
r[1] = (uint8_t)((t[0] >> 8) | (t[1] << 2));
r[2] = (uint8_t)((t[1] >> 6) | (t[2] << 4));
r[3] = (uint8_t)((t[2] >> 4) | (t[3] << 6));
r[4] = (uint8_t)(t[3] >> 2);
r += 5;
}
}

Datei anzeigen

@ -22,7 +22,7 @@ int16_t PQCLEAN_KYBER512_CLEAN_montgomery_reduce(int32_t a) {
t = (int32_t)u * KYBER_Q;
t = a - t;
t >>= 16;
return t;
return (int16_t)t;
}
/*************************************************

Datei anzeigen

@ -169,7 +169,8 @@ static unsigned int rej_uniform(int16_t *r,
+ XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void PQCLEAN_KYBER76890S_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed) {
unsigned int ctr = 0, i = 0, j = 0;
unsigned int ctr = 0;
uint8_t i = 0, j = 0;
uint8_t buf[GEN_MATRIX_NBLOCKS * XOF_BLOCKBYTES];
xof_state state;

Datei anzeigen

@ -117,7 +117,7 @@ int PQCLEAN_KYBER76890S_CLEAN_crypto_kem_dec(unsigned char *ss,
hash_h(kr + KYBER_SYMBYTES, ct, KYBER_CIPHERTEXTBYTES);
/* Overwrite pre-k with z on re-encryption failure */
PQCLEAN_KYBER76890S_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, fail);
PQCLEAN_KYBER76890S_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, (uint8_t)fail);
/* hash concatenation of pre-k and H(c) to k */
kdf(ss, kr, 2 * KYBER_SYMBYTES);

Datei anzeigen

@ -72,9 +72,9 @@ void PQCLEAN_KYBER76890S_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], poly *a)
for (i = 0; i < KYBER_N / 2; i++) {
t0 = a->coeffs[2 * i];
t1 = a->coeffs[2 * i + 1];
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);
}
}

Datei anzeigen

@ -27,11 +27,11 @@ void PQCLEAN_KYBER76890S_CLEAN_polyvec_compress(uint8_t r[KYBER_POLYVECCOMPRESSE
}
}
r[0] = (t[0] >> 0);
r[1] = (t[0] >> 8) | (t[1] << 2);
r[2] = (t[1] >> 6) | (t[2] << 4);
r[3] = (t[2] >> 4) | (t[3] << 6);
r[4] = (t[3] >> 2);
r[0] = (uint8_t)(t[0] >> 0);
r[1] = (uint8_t)((t[0] >> 8) | (t[1] << 2));
r[2] = (uint8_t)((t[1] >> 6) | (t[2] << 4));
r[3] = (uint8_t)((t[2] >> 4) | (t[3] << 6));
r[4] = (uint8_t)(t[3] >> 2);
r += 5;
}
}

Datei anzeigen

@ -22,7 +22,7 @@ int16_t PQCLEAN_KYBER76890S_CLEAN_montgomery_reduce(int32_t a) {
t = (int32_t)u * KYBER_Q;
t = a - t;
t >>= 16;
return t;
return (int16_t)t;
}
/*************************************************

Datei anzeigen

@ -169,7 +169,8 @@ static unsigned int rej_uniform(int16_t *r,
+ XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void PQCLEAN_KYBER768_CLEAN_gen_matrix(polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed) {
unsigned int ctr = 0, i = 0, j = 0;
unsigned int ctr = 0;
uint8_t i = 0, j = 0;
uint8_t buf[GEN_MATRIX_NBLOCKS * XOF_BLOCKBYTES];
xof_state state;

Datei anzeigen

@ -117,7 +117,7 @@ int PQCLEAN_KYBER768_CLEAN_crypto_kem_dec(unsigned char *ss,
hash_h(kr + KYBER_SYMBYTES, ct, KYBER_CIPHERTEXTBYTES);
/* Overwrite pre-k with z on re-encryption failure */
PQCLEAN_KYBER768_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, fail);
PQCLEAN_KYBER768_CLEAN_cmov(kr, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, KYBER_SYMBYTES, (uint8_t)fail);
/* hash concatenation of pre-k and H(c) to k */
kdf(ss, kr, 2 * KYBER_SYMBYTES);

Datei anzeigen

@ -72,9 +72,9 @@ void PQCLEAN_KYBER768_CLEAN_poly_tobytes(uint8_t r[KYBER_POLYBYTES], poly *a) {
for (i = 0; i < KYBER_N / 2; i++) {
t0 = a->coeffs[2 * i];
t1 = a->coeffs[2 * i + 1];
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);
}
}

Datei anzeigen

@ -27,11 +27,11 @@ void PQCLEAN_KYBER768_CLEAN_polyvec_compress(uint8_t r[KYBER_POLYVECCOMPRESSEDBY
}
}
r[0] = (t[0] >> 0);
r[1] = (t[0] >> 8) | (t[1] << 2);
r[2] = (t[1] >> 6) | (t[2] << 4);
r[3] = (t[2] >> 4) | (t[3] << 6);
r[4] = (t[3] >> 2);
r[0] = (uint8_t)(t[0] >> 0);
r[1] = (uint8_t)((t[0] >> 8) | (t[1] << 2));
r[2] = (uint8_t)((t[1] >> 6) | (t[2] << 4));
r[3] = (uint8_t)((t[2] >> 4) | (t[3] << 6));
r[4] = (uint8_t)(t[3] >> 2);
r += 5;
}
}

Datei anzeigen

@ -22,7 +22,7 @@ int16_t PQCLEAN_KYBER768_CLEAN_montgomery_reduce(int32_t a) {
t = (int32_t)u * KYBER_Q;
t = a - t;
t >>= 16;
return t;
return (int16_t)t;
}
/*************************************************