1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-26 17:31:38 +00:00

Fix Windows warnings

This commit is contained in:
Douglas Stebila 2019-03-21 23:51:34 -04:00
parent f0ba4f2051
commit ca798ee18a

View File

@ -140,10 +140,10 @@ void PQCLEAN_FRODOKEM640SHAKE_CLEAN_pack(unsigned char *out, const size_t outlen
while (b < 8) { while (b < 8) {
int nbits = min(8 - b, bits); int nbits = min(8 - b, bits);
uint16_t mask = (1 << nbits) - 1; uint16_t mask = (1 << nbits) - 1;
unsigned char t = (w >> (bits - nbits)) & mask; // the bits to copy from w to out unsigned char t = (unsigned char) ((w >> (bits - nbits)) & mask); // the bits to copy from w to out
out[i] = out[i] + (t << (8 - b - nbits)); out[i] = out[i] + (t << (8 - b - nbits));
b += nbits; b += (unsigned char) nbits;
bits -= nbits; bits -= (unsigned char) nbits;
w &= ~(mask << bits); // not strictly necessary; mostly for debugging w &= ~(mask << bits); // not strictly necessary; mostly for debugging
if (bits == 0) { if (bits == 0) {
@ -191,8 +191,8 @@ void PQCLEAN_FRODOKEM640SHAKE_CLEAN_unpack(uint16_t *out, const size_t outlen, c
uint16_t mask = (1 << nbits) - 1; uint16_t mask = (1 << nbits) - 1;
unsigned char t = (w >> (bits - nbits)) & mask; // the bits to copy from w to out unsigned char t = (w >> (bits - nbits)) & mask; // the bits to copy from w to out
out[i] = out[i] + (t << (lsb - b - nbits)); out[i] = out[i] + (t << (lsb - b - nbits));
b += nbits; b += (unsigned char) nbits;
bits -= nbits; bits -= (unsigned char) nbits;
w &= ~(mask << bits); // not strictly necessary; mostly for debugging w &= ~(mask << bits); // not strictly necessary; mostly for debugging
if (bits == 0) { if (bits == 0) {