Re: [PATCH v8 2/4] crypto: spacc - Add SPAcc ahash support
From: Herbert Xu
Date: Thu Nov 06 2025 - 01:22:54 EST
On Fri, Oct 31, 2025 at 10:18:01AM +0530, Pavitrakumar Managutte wrote:
>
> +static int spacc_hash_init_tfm(struct crypto_ahash *tfm)
> +{
> + const struct spacc_alg *salg = container_of(crypto_ahash_alg(tfm),
> + struct spacc_alg,
> + alg.hash.base);
> + struct spacc_crypto_ctx *tctx = crypto_ahash_ctx(tfm);
> +
> + tctx->handle = -1;
> + tctx->ctx_valid = false;
> + tctx->dev = get_device(salg->dev);
> +
> + tctx->fb.hash = crypto_alloc_ahash(crypto_ahash_alg_name(tfm), 0,
> + CRYPTO_ALG_NEED_FALLBACK);
> + if (IS_ERR(tctx->fb.hash)) {
> + dev_err(tctx->dev, "SPAcc ahash fallback tfm is NULL!\n");
> + put_device(tctx->dev);
> + return PTR_ERR(tctx->fb.hash);
> + }
> +
> + crypto_ahash_set_statesize(tfm,
> + crypto_ahash_statesize(tctx->fb.hash));
> +
> + crypto_ahash_set_reqsize(tfm,
> + sizeof(struct spacc_crypto_reqctx) +
> + crypto_ahash_reqsize(tctx->fb.hash));
Please stop using dynamic statesize/reqsize values as they are
being phased out.
The API now provides a fallback directly that can be used with
a stack request. Grep for aspeed_ahash_fallback to see an example
of that being used.
Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt