From ca798ee18a29470ea61eaabc25bd34cd9846da65 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Thu, 21 Mar 2019 23:51:34 -0400 Subject: [PATCH] Fix Windows warnings --- crypto_kem/frodokem640shake/clean/util.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto_kem/frodokem640shake/clean/util.c b/crypto_kem/frodokem640shake/clean/util.c index 9ecb43e1..864909cb 100644 --- a/crypto_kem/frodokem640shake/clean/util.c +++ b/crypto_kem/frodokem640shake/clean/util.c @@ -140,10 +140,10 @@ void PQCLEAN_FRODOKEM640SHAKE_CLEAN_pack(unsigned char *out, const size_t outlen while (b < 8) { int nbits = min(8 - b, bits); 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)); - b += nbits; - bits -= nbits; + b += (unsigned char) nbits; + bits -= (unsigned char) nbits; w &= ~(mask << bits); // not strictly necessary; mostly for debugging 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; unsigned char t = (w >> (bits - nbits)) & mask; // the bits to copy from w to out out[i] = out[i] + (t << (lsb - b - nbits)); - b += nbits; - bits -= nbits; + b += (unsigned char) nbits; + bits -= (unsigned char) nbits; w &= ~(mask << bits); // not strictly necessary; mostly for debugging if (bits == 0) {