mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: hmac - Improve local variable types
Date: Tue, 24 Sep 2024 13:27:27 +0200	[thread overview]
Message-ID: <20240924112727.240950-2-thorsten.blum@linux.dev> (raw)

Since crypto_shash_blocksize(), crypto_shash_digestsize(), and
crypto_shash_statesize() return an unsigned int, also use unsigned int
for the local variables.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 crypto/hmac.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/crypto/hmac.c b/crypto/hmac.c
index 7cec25ff9889..6ab7ce4cb930 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -31,9 +31,9 @@ struct hmac_ctx {
 static int hmac_setkey(struct crypto_shash *parent,
 		       const u8 *inkey, unsigned int keylen)
 {
-	int bs = crypto_shash_blocksize(parent);
-	int ds = crypto_shash_digestsize(parent);
-	int ss = crypto_shash_statesize(parent);
+	unsigned int bs = crypto_shash_blocksize(parent);
+	unsigned int ds = crypto_shash_digestsize(parent);
+	unsigned int ss = crypto_shash_statesize(parent);
 	struct hmac_ctx *tctx = crypto_shash_ctx(parent);
 	struct crypto_shash *hash = tctx->hash;
 	u8 *ipad = &tctx->pads[0];
@@ -108,8 +108,8 @@ static int hmac_update(struct shash_desc *pdesc,
 static int hmac_final(struct shash_desc *pdesc, u8 *out)
 {
 	struct crypto_shash *parent = pdesc->tfm;
-	int ds = crypto_shash_digestsize(parent);
-	int ss = crypto_shash_statesize(parent);
+	unsigned int ds = crypto_shash_digestsize(parent);
+	unsigned int ss = crypto_shash_statesize(parent);
 	const struct hmac_ctx *tctx = crypto_shash_ctx(parent);
 	const u8 *opad = &tctx->pads[ss];
 	struct shash_desc *desc = shash_desc_ctx(pdesc);
@@ -124,8 +124,8 @@ static int hmac_finup(struct shash_desc *pdesc, const u8 *data,
 {
 
 	struct crypto_shash *parent = pdesc->tfm;
-	int ds = crypto_shash_digestsize(parent);
-	int ss = crypto_shash_statesize(parent);
+	unsigned int ds = crypto_shash_digestsize(parent);
+	unsigned int ss = crypto_shash_statesize(parent);
 	const struct hmac_ctx *tctx = crypto_shash_ctx(parent);
 	const u8 *opad = &tctx->pads[ss];
 	struct shash_desc *desc = shash_desc_ctx(pdesc);
-- 
2.46.1


             reply	other threads:[~2024-09-24 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 11:27 Thorsten Blum [this message]
2024-10-05  4:57 ` Herbert Xu

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=20240924112727.240950-2-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --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

all inboxes | Powered by JetHome®