Re: [PATCH v3 4/4] crypto: starfive - Add hash and HMAC support

From: Herbert Xu
Date: Fri Mar 24 2023 - 05:53:13 EST


On Mon, Mar 13, 2023 at 09:56:46PM +0800, Jia Jie Ho wrote:
>
> +static int starfive_hash_update(struct ahash_request *req)
> +{
> + struct starfive_cryp_request_ctx *rctx = ahash_request_ctx(req);
> + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
> + struct starfive_cryp_ctx *ctx = crypto_ahash_ctx(tfm);
> +
> + ahash_request_set_tfm(&rctx->ahash_fbk_req, ctx->ahash_fbk);
> + rctx->ahash_fbk_req.base.flags = req->base.flags
> + & CRYPTO_TFM_REQ_MAY_SLEEP;
> + rctx->ahash_fbk_req.nbytes = req->nbytes;
> + rctx->ahash_fbk_req.src = req->src;

Please don't modify the fields directly, use the ahash_request_set_*
helpers. Since you allocated an async fallback, you should set the
callbacks too.

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