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

Herbert Xu herbert at gondor.apana.org.au
Fri Mar 24 02:52:30 PDT 2023


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 at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-riscv mailing list