[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250614000828.311722-2-yuzhuo@google.com>
Date: Fri, 13 Jun 2025 17:08:27 -0700
From: Yuzhuo Jing <yuzhuo@...gle.com>
To: Herbert Xu <herbert@...dor.apana.org.au>, "David S . Miller" <davem@...emloft.net>,
Ian Rogers <irogers@...gle.com>, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Yuzhuo Jing <yuzhuo@...gle.com>
Subject: [PATCH v1 1/2] crypto: Fix sha1 signed integer comparison compile error
On platforms where -Werror=sign-compare compiler flag is enabled, sha1
code gives errors when for signed to unsigned integer comparisons.
This patch fixes the issue.
Signed-off-by: Yuzhuo Jing <yuzhuo@...gle.com>
---
include/crypto/sha1_base.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/crypto/sha1_base.h b/include/crypto/sha1_base.h
index 0c342ed0d038..3460759d31db 100644
--- a/include/crypto/sha1_base.h
+++ b/include/crypto/sha1_base.h
@@ -73,7 +73,7 @@ static inline int sha1_base_do_update(struct shash_desc *desc,
static inline int sha1_base_do_finalize(struct shash_desc *desc,
sha1_block_fn *block_fn)
{
- const int bit_offset = SHA1_BLOCK_SIZE - sizeof(__be64);
+ const unsigned int bit_offset = SHA1_BLOCK_SIZE - sizeof(__be64);
struct sha1_state *sctx = shash_desc_ctx(desc);
__be64 *bits = (__be64 *)(sctx->buffer + bit_offset);
unsigned int partial = sctx->count % SHA1_BLOCK_SIZE;
@@ -99,7 +99,7 @@ static inline int sha1_base_finish(struct shash_desc *desc, u8 *out)
__be32 *digest = (__be32 *)out;
int i;
- for (i = 0; i < SHA1_DIGEST_SIZE / sizeof(__be32); i++)
+ for (i = 0; i < SHA1_DIGEST_SIZE / (int)sizeof(__be32); i++)
put_unaligned_be32(sctx->state[i], digest++);
memzero_explicit(sctx, sizeof(*sctx));
--
2.50.0.rc1.591.g9c95f17f64-goog
Powered by blists - more mailing lists