crypto: ahash - Use cra_reqsize
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 7 Apr 2025 10:21:11 +0000 (18:21 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 16 Apr 2025 07:16:21 +0000 (15:16 +0800)
Use the common reqsize field and remove reqsize from ahash_alg.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ahash.c
include/crypto/hash.h

index fc59897c234c6b8643b9c3b8b58839c4a29a454a..ba0a639144af75d834fe35b58bff9e0bb3c0628e 100644 (file)
@@ -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);
index 113a5835e586e227ecc9e0c7e76bf6e7d0c71808..eceb2ed04f26759a199e8ffb655e693ab2b8a152 100644 (file)
@@ -136,7 +136,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 {
@@ -153,8 +152,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;
 };