From 3779d4fcbfe4b37302e187b503d6ed82cd41e343 Mon Sep 17 00:00:00 2001 From: Thom Wiggers Date: Tue, 10 Sep 2019 12:36:52 +0200 Subject: [PATCH] Fix clang-tidy complaint about result of subtraction being compared with possibly small size_t (#231) --- common/fips202.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/fips202.c b/common/fips202.c index 4c4e5b11..76b0cb71 100644 --- a/common/fips202.c +++ b/common/fips202.c @@ -441,7 +441,7 @@ static void keccak_inc_absorb(uint64_t *s_inc, uint32_t r, const uint8_t *m, /* Recall that s_inc[25] is the non-absorbed bytes xored into the state */ while (mlen + s_inc[25] >= r) { - for (i = 0; i < r - s_inc[25]; i++) { + for (i = 0; i < r - (uint32_t)s_inc[25]; i++) { /* Take the i'th byte from message xor with the s_inc[25] + i'th byte of the state; little-endian */ s_inc[(s_inc[25] + i) >> 3] ^= (uint64_t)m[i] << (8 * ((s_inc[25] + i) & 0x07));