Re: [PATCH v10 2/4] crypto: spacc - Add SPAcc ahash support

From: Herbert Xu

Date: Fri Mar 06 2026 - 20:19:19 EST


On Thu, Feb 19, 2026 at 05:11:28PM +0530, Pavitrakumar Managutte wrote:
>
> +static int spacc_hash_init_tfm(struct crypto_ahash *tfm)
> +{
> + int rc = 0;
> + 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->keylen = 0;
> + tctx->fb.hash = NULL;
> + tctx->tmp_sgl = NULL;
> + tctx->tmp_sgl_buff = NULL;
> + tctx->dev = get_device(salg->dev);
> +
> + tctx->fb.hash = crypto_alloc_ahash(crypto_ahash_alg_name(tfm), 0,
> + CRYPTO_ALG_NEED_FALLBACK);

Every async ahash algorithm automatically gets a fallback from
the API so there is no need to allocate one yourself.

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt