lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240924112727.240950-2-thorsten.blum@linux.dev>
Date: Tue, 24 Sep 2024 13:27:27 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Herbert Xu <herbert@...dor.apana.org.au>,
	"David S. Miller" <davem@...emloft.net>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
	linux-crypto@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] crypto: hmac - Improve local variable types

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@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ