All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Leonard Crestez <cdleonard@gmail.com>,
	Radu Solea <radu.solea@nxp.com>,
	Franck LENORMAND <franck.lenormand@nxp.com>,
	linux-crypto@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] crypto: mxs-dcp: handle zero-length skcipher requests
Date: Wed, 9 Sep 2026 16:03:02 -0500	[thread overview]
Message-ID: <aqHJhrSE2_pcCp8L@SMW015318> (raw)
In-Reply-To: <20260908094437.1548278-1-lilinmao@kylinos.cn>

On Tue, Sep 08, 2026 at 05:44:37PM +0800, Linmao Li wrote:
> The generic ECB and CBC implementations return success for zero-length
> requests, but MXS-DCP queues them anyway. When such a request reaches
> the worker, last_out_len remains zero. The CBC completion path then
> subtracts AES_BLOCK_SIZE from this unsigned value when updating the IV,
> causing the offset to underflow. On decryption, the resulting source
> address precedes aes_in_buf.
>
> Return success before enqueueing zero-length requests, matching the
> generic implementations. This avoids the invalid source access and
> leaves the IV unchanged.
>
> Fixes: fadd7a6e616b ("crypto: mxs-dcp - Fix AES issues")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> v2: Clarify commit message: describe zero-length return-0 as existing
>     generic ECB/CBC behavior rather than a general API rule (Frank Li).
>  drivers/crypto/mxs-dcp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
> index 133ebc998236..60794b4d49fa 100644
> --- a/drivers/crypto/mxs-dcp.c
> +++ b/drivers/crypto/mxs-dcp.c
> @@ -473,6 +473,9 @@ static int mxs_dcp_aes_enqueue(struct skcipher_request *req, int enc, int ecb)
>  	struct dcp_aes_req_ctx *rctx = skcipher_request_ctx(req);
>  	int ret;
>
> +	if (!req->cryptlen)
> +		return 0;
> +
>  	if (unlikely(actx->key_len != AES_KEYSIZE_128 && !actx->key_referenced))
>  		return mxs_dcp_block_fallback(req, enc);
>
>
> base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f
> --
> 2.25.1
>

      parent reply	other threads:[~2026-09-09 21:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  9:44 [PATCH v2] crypto: mxs-dcp: handle zero-length skcipher requests Linmao Li
2026-09-08  9:57 ` sashiko-bot
2026-09-09 21:03 ` Frank Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqHJhrSE2_pcCp8L@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=cdleonard@gmail.com \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=franck.lenormand@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=lilinmao@kylinos.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=radu.solea@nxp.com \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.