diff mbox series

[7/7] crypto: ahash - Use cra_reqsize

Message ID 3ed884e168b4e8de7ef647e96cecbae6c47698a2.1744021074.git.herbert@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: Add reqsize to crypto_alg | expand

Commit Message

Herbert Xu April 7, 2025, 10:21 a.m. UTC
Use the common reqsize field and remove reqsize from ahash_alg.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 crypto/ahash.c        | 4 ++--
 include/crypto/hash.h | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/crypto/ahash.c b/crypto/ahash.c
index 079216180ad1..ad3f1e011a69 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -723,7 +723,7 @@  static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 	struct ahash_alg *alg = crypto_ahash_alg(hash);
 
 	crypto_ahash_set_statesize(hash, alg->halg.statesize);
-	crypto_ahash_set_reqsize(hash, alg->reqsize);
+	crypto_ahash_set_reqsize(hash, crypto_tfm_alg_reqsize(tfm));
 
 	if (tfm->__crt_alg->cra_type == &crypto_shash_type)
 		return crypto_init_ahash_using_shash(tfm);
@@ -889,7 +889,7 @@  static int ahash_prepare_alg(struct ahash_alg *alg)
 	if (alg->halg.statesize == 0)
 		return -EINVAL;
 
-	if (alg->reqsize && alg->reqsize < alg->halg.statesize)
+	if (base->cra_reqsize && base->cra_reqsize < alg->halg.statesize)
 		return -EINVAL;
 
 	err = hash_prepare_alg(&alg->halg);
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index c14a3a90613f..a80dfa57656f 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -135,7 +135,6 @@  struct ahash_request {
  *	      This is a counterpart to @init_tfm, used to remove
  *	      various changes set in @init_tfm.
  * @clone_tfm: Copy transform into new object, may allocate memory.
- * @reqsize: Size of the request context.
  * @halg: see struct hash_alg_common
  */
 struct ahash_alg {
@@ -152,8 +151,6 @@  struct ahash_alg {
 	void (*exit_tfm)(struct crypto_ahash *tfm);
 	int (*clone_tfm)(struct crypto_ahash *dst, struct crypto_ahash *src);
 
-	unsigned int reqsize;
-
 	struct hash_alg_common halg;
 };