diff mbox series

[3/4] crypto: hmac - Make descsize an algorithm attribute

Message ID 5503c7d841a5403915646a669cdc59f25fd8bd7a.1744454589.git.herbert@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: shash - Remove dynamic descsize | expand

Commit Message

Herbert Xu April 12, 2025, 10:47 a.m. UTC
Rather than setting descsize in init_tfm, make it an algorithm
attribute and set it during instance construction.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 crypto/hmac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/crypto/hmac.c b/crypto/hmac.c
index 7cec25ff9889..dfb153511865 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -146,9 +146,6 @@  static int hmac_init_tfm(struct crypto_shash *parent)
 	if (IS_ERR(hash))
 		return PTR_ERR(hash);
 
-	parent->descsize = sizeof(struct shash_desc) +
-			   crypto_shash_descsize(hash);
-
 	tctx->hash = hash;
 	return 0;
 }
@@ -222,6 +219,7 @@  static int hmac_create(struct crypto_template *tmpl, struct rtattr **tb)
 
 	inst->alg.digestsize = ds;
 	inst->alg.statesize = ss;
+	inst->alg.descsize = sizeof(struct shash_desc) + salg->descsize;
 	inst->alg.init = hmac_init;
 	inst->alg.update = hmac_update;
 	inst->alg.final = hmac_final;