Re: [PATCH v2 08/10] crypto: caam - add crypto_engine support for AEAD algorithms

From: Horia Geanta
Date: Fri Jan 10 2020 - 03:31:43 EST


On 1/3/2020 3:04 AM, Iuliana Prodan wrote:
> +struct caam_aead_req_ctx {
> + struct aead_edesc *edesc;
> + void (*aead_op_done)(struct device *jrdev, u32 *desc, u32 err,
> + void *context);
Similar with skcipher, aead_op_done is not needed since aead_crypt_done
is the only callback used.

> +static int aead_enqueue_req(struct device *jrdev, u32 *desc,
> + void (*cbk)(struct device *jrdev, u32 *desc,
> + u32 err, void *context),
> + struct aead_request *req, struct aead_edesc *edesc)
cbk parameter is not used.

> +{
> + struct caam_drv_private_jr *jrpriv = dev_get_drvdata(jrdev);
> + int ret;
> +
> + if (req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)
> + return crypto_transfer_aead_request_to_engine(jrpriv->engine,
> + req);
Resources leak in case of failure.

> + else
> + ret = caam_jr_enqueue(jrdev, desc, aead_crypt_done,
> + &edesc->jrentry);
Need to justify why only some requests are transferred to crypto engine.

Horia