From: Yuzhuo Jing <yuzhuo@google.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
Ian Rogers <irogers@google.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Yuzhuo Jing <yuzhuo@google.com>
Subject: [PATCH v1 2/2] crypto: Fix sha1 signed pointer comparison compile error
Date: Fri, 13 Jun 2025 17:08:28 -0700 [thread overview]
Message-ID: <20250614000828.311722-3-yuzhuo@google.com> (raw)
In-Reply-To: <20250614000828.311722-1-yuzhuo@google.com>
In include/crypto/sha1_base.h, sha1_block_fn type is defined as
void(sha1_block_fn)(struct sha1_state *sst, u8 const *src, int blocks);
In lib/crypto/sha1.c, the second argument on sha1_transform is defined
as "const char *", which causes type mismatch when calling
sha1_transform from sha1_generic_block_fn in crypto/sha1_generic.c.
We don't break the widely used sha1_block_fn or sha1_transform function
signatures, so this patch converts the pointer sign at usage to fix the
compile error for environments that enable -Werror=pointer-sign.
Signed-off-by: Yuzhuo Jing <yuzhuo@google.com>
---
crypto/sha1_generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/sha1_generic.c b/crypto/sha1_generic.c
index 325b57fe28dc..3a3f9608b989 100644
--- a/crypto/sha1_generic.c
+++ b/crypto/sha1_generic.c
@@ -33,7 +33,7 @@ static void sha1_generic_block_fn(struct sha1_state *sst, u8 const *src,
u32 temp[SHA1_WORKSPACE_WORDS];
while (blocks--) {
- sha1_transform(sst->state, src, temp);
+ sha1_transform(sst->state, (const char *)src, temp);
src += SHA1_BLOCK_SIZE;
}
memzero_explicit(temp, sizeof(temp));
--
2.50.0.rc1.591.g9c95f17f64-goog
next prev parent reply other threads:[~2025-06-14 0:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-14 0:08 [PATCH v1 0/2] crypto: Fix sha1 compile error Yuzhuo Jing
2025-06-14 0:08 ` [PATCH v1 1/2] crypto: Fix sha1 signed integer comparison " Yuzhuo Jing
2025-06-14 0:08 ` Yuzhuo Jing [this message]
2025-06-14 4:53 ` [PATCH v1 0/2] crypto: Fix sha1 " Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250614000828.311722-3-yuzhuo@google.com \
--to=yuzhuo@google.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=irogers@google.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox