crypto: hmac - Make descsize an algorithm attribute

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>
This commit is contained in:
Herbert Xu 2025-04-12 18:47:45 +08:00
parent c1dd353d18
commit aeffd90938
1 changed files with 1 additions and 3 deletions

View File

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