linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Valentin Ciocoi Radulescu <valentin.ciocoi@nxp.com>
To: Horia Geanta <horia.geanta@nxp.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Aymen Sghaier <aymen.sghaier@nxp.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH v2] crypto: caam/qi2 - fix chacha20 data size error
Date: Fri, 28 Feb 2020 11:04:04 +0000	[thread overview]
Message-ID: <VI1PR04MB6031FD0D117FF3DD7C4B6289FEE80@VI1PR04MB6031.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200228065123.13216-1-horia.geanta@nxp.com>

> -----Original Message-----
> From: Horia Geantă <horia.geanta@nxp.com>
> Sent: Friday, February 28, 2020 08:51
> To: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: David S. Miller <davem@davemloft.net>; Aymen Sghaier
> <aymen.sghaier@nxp.com>; Valentin Ciocoi Radulescu
> <valentin.ciocoi@nxp.com>; linux-crypto@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [PATCH v2] crypto: caam/qi2 - fix chacha20 data size error
> 
> HW generates a Data Size error for chacha20 requests that are not
> a multiple of 64B, since algorithm state (AS) does not have
> the FINAL bit set.
> 
> Since updating req->iv (for chaining) is not required,
> modify skcipher descriptors to set the FINAL bit for chacha20.
> 
> [Note that for skcipher decryption we know that ctx1_iv_off is 0,
> which allows for an optimization by not checking algorithm type,
> since append_dec_op1() sets FINAL bit for all algorithms except AES.]
> 
> Also drop the descriptor operations that save the IV.
> However, in order to keep code logic simple, things like
> S/G tables generation etc. are not touched.
> 
> Cc: <stable@vger.kernel.org> # v5.3+
> Fixes: 334d37c9e263 ("crypto: caam - update IV using HW support")
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>

Tested-by: Valentin Ciocoi Radulescu <valentin.ciocoi@nxp.com>

Tested on LX2160ARDB board with cryptodev-2.6 tree:
root@TinyLinux:~# cat /proc/crypto | grep chacha20-caam -A 5
driver       : chacha20-caam-qi2
module       : kernel
priority     : 2000
refcnt       : 1
selftest     : passed
internal     : no


  reply	other threads:[~2020-02-28 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28  6:51 [PATCH v2] crypto: caam/qi2 - fix chacha20 data size error Horia Geantă
2020-02-28 11:04 ` Valentin Ciocoi Radulescu [this message]
2020-03-06  1:51 ` 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=VI1PR04MB6031FD0D117FF3DD7C4B6289FEE80@VI1PR04MB6031.eurprd04.prod.outlook.com \
    --to=valentin.ciocoi@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-imx@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;
as well as URLs for NNTP newsgroup(s).