From: Eric Biggers <ebiggers@kernel.org>
To: Gaurav Jain <gaurav.jain@nxp.com>
Cc: Horia Geanta <horia.geanta@nxp.com>,
Pankaj Gupta <pankaj.gupta@nxp.com>,
Varun Sethi <V.Sethi@nxp.com>,
Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
Aisheng Dong <aisheng.dong@nxp.com>,
Silvano Di Ninno <silvano.dininno@nxp.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-imx@nxp.com
Subject: Re: [PATCH] crypto: caam/jr - fix Chacha20 + Poly1305 self test failure
Date: Thu, 21 Sep 2023 19:41:00 -0700 [thread overview]
Message-ID: <20230922024100.GA935@sol.localdomain> (raw)
In-Reply-To: <20230921124237.2364827-1-gaurav.jain@nxp.com>
On Thu, Sep 21, 2023 at 06:12:37PM +0530, Gaurav Jain wrote:
> key buffer is not copied in chachapoly_setkey function,
> results in wrong output for encryption/decryption operation.
>
> fix this by memcpy the key in caam_ctx key arrary
>
> Fixes: d6bbd4eea243 ("crypto: caam/jr - add support for Chacha20 + Poly1305")
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> ---
> drivers/crypto/caam/caamalg.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
> index eba2d750c3b0..066f08a3a040 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -575,7 +575,8 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
> if (keylen != CHACHA_KEY_SIZE + saltlen)
> return -EINVAL;
>
> - ctx->cdata.key_virt = key;
> + memcpy(ctx->key, key, keylen);
> + ctx->cdata.key_virt = ctx->key;
> ctx->cdata.keylen = keylen - saltlen;
>
Huh, so this driver just ignored the key? Is anyone using the ChaCha20Poly1305
support in this driver? Based on this bug existing, that seems unlikely. If
that's the case, wouldn't it be better just to remove the ChaCha20Poly1305
support from this driver so that the code doesn't need to be maintained?
- Eric
next prev parent reply other threads:[~2023-09-22 2:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 12:42 [PATCH] crypto: caam/jr - fix Chacha20 + Poly1305 self test failure Gaurav Jain
2023-09-22 2:41 ` Eric Biggers [this message]
2023-09-22 6:34 ` [EXT] " Gaurav Jain
2023-09-22 7:17 ` [EXTERNAL] " Kamlesh Gurudasani
2023-09-25 9:03 ` Gaurav Jain
2023-10-01 8:34 ` Herbert Xu
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=20230922024100.GA935@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=V.Sethi@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=meenakshi.aggarwal@nxp.com \
--cc=pankaj.gupta@nxp.com \
--cc=silvano.dininno@nxp.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox