diff --git a/src/blowfish.c b/src/blowfish.c index aed312592..a8958765e 100644 --- a/src/blowfish.c +++ b/src/blowfish.c @@ -66,10 +66,10 @@ static inline uint32_t F(const struct block_state *ctx, uint32_t x) uint8_t a, b, c, d; uint32_t res; - a = (x >> 24) & 0xFF; - b = (x >> 16) & 0xFF; - c = (x >> 8) & 0xFF; - d = (x >> 0) & 0xFF; + a = (uint8_t)(x >> 24); + b = (uint8_t)(x >> 16); + c = (uint8_t)(x >> 8); + d = (uint8_t)(x >> 0); res = ctx->S[0][a] + ctx->S[1][b]; res ^= ctx->S[2][c]; diff --git a/src/pkcs1_decode.c b/src/pkcs1_decode.c index 207b1985a..d065cea0a 100644 --- a/src/pkcs1_decode.c +++ b/src/pkcs1_decode.c @@ -38,7 +38,7 @@ FAKE_INIT(pkcs1_decode) STATIC uint8_t rol8(uint8_t x) { - return (x << 1) | (x >> 7); + return (uint8_t)((x << 1) | (x >> 7)); } /* @@ -76,7 +76,7 @@ STATIC void set_if_match(uint8_t *flag, size_t term1, size_t term2) for (i=0; i> (i*8)); } - *flag |= ~propagate_ones(x); + *flag |= (uint8_t)~propagate_ones(x); } /* @@ -92,7 +92,7 @@ STATIC void set_if_no_match(uint8_t *flag, size_t term1, size_t term2) for (i=0; i> (i*8)); } - *flag |= propagate_ones(x); + *flag |= (uint8_t)propagate_ones(x); } /* @@ -103,8 +103,8 @@ STATIC void safe_select(const uint8_t *in1, const uint8_t *in2, uint8_t *out, ui size_t i; uint8_t mask1, mask2; - mask1 = propagate_ones(choice); - mask2 = ~mask1; + mask1 = (uint8_t)propagate_ones(choice); + mask2 = (uint8_t)~mask1; for (i=0; i