linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Horia Geanta <horia.geanta@nxp.com>
To: "Andrei Botila (OSS)" <andrei.botila@oss.nxp.com>,
	Aymen Sghaier <aymen.sghaier@nxp.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrei Botila <andrei.botila@nxp.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [PATCH] crypto: caam - update xts sector size for large input length
Date: Mon, 2 Mar 2020 09:36:32 +0000	[thread overview]
Message-ID: <VI1PR0402MB34851CC70E092F598E9BF32298E70@VI1PR0402MB3485.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 20200228104648.18898-1-andrei.botila@oss.nxp.com

+ dm-devel

On 2/28/2020 12:47 PM, Andrei Botila (OSS) wrote:
> From: Andrei Botila <andrei.botila@nxp.com>
> 
> Since in the software implementation of XTS-AES there is
> no notion of sector every input length is processed the same way.
> CAAM implementation has the notion of sector which causes different
> results between the software implementation and the one in CAAM
> for input lengths bigger than 512 bytes.
> Increase sector size to maximum value on 16 bits.
> 
> Fixes: c6415a6016bf ("crypto: caam - add support for acipher xts(aes)")
> Cc: <stable@vger.kernel.org> # v4.12+
> Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

Thanks,
Horia

> ---
> This patch needs to be applied from v4.12+ because dm-crypt has added support
> for 4K sector size at that version. The commit was
> 8f0009a225171 ("dm-crypt: optionally support larger encryption sector size").
> 
>  drivers/crypto/caam/caamalg_desc.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/caam/caamalg_desc.c b/drivers/crypto/caam/caamalg_desc.c
> index aa9ccca67045..8ebbbd28b1f7 100644
> --- a/drivers/crypto/caam/caamalg_desc.c
> +++ b/drivers/crypto/caam/caamalg_desc.c
> @@ -1518,7 +1518,13 @@ EXPORT_SYMBOL(cnstr_shdsc_skcipher_decap);
>   */
>  void cnstr_shdsc_xts_skcipher_encap(u32 * const desc, struct alginfo *cdata)
>  {
> -	__be64 sector_size = cpu_to_be64(512);
> +	/*
> +	 * Set sector size to a big value, practically disabling
> +	 * sector size segmentation in xts implementation. We cannot
> +	 * take full advantage of this HW feature with existing
> +	 * crypto API / dm-crypt SW architecture.
> +	 */
> +	__be64 sector_size = cpu_to_be64(BIT(15));
>  	u32 *key_jump_cmd;
>  
>  	init_sh_desc(desc, HDR_SHARE_SERIAL | HDR_SAVECTX);
> @@ -1571,7 +1577,13 @@ EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_encap);
>   */
>  void cnstr_shdsc_xts_skcipher_decap(u32 * const desc, struct alginfo *cdata)
>  {
> -	__be64 sector_size = cpu_to_be64(512);
> +	/*
> +	 * Set sector size to a big value, practically disabling
> +	 * sector size segmentation in xts implementation. We cannot
> +	 * take full advantage of this HW feature with existing
> +	 * crypto API / dm-crypt SW architecture.
> +	 */
> +	__be64 sector_size = cpu_to_be64(BIT(15));
>  	u32 *key_jump_cmd;
>  
>  	init_sh_desc(desc, HDR_SHARE_SERIAL | HDR_SAVECTX);
> 


  reply	other threads:[~2020-03-02  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 10:46 [PATCH] crypto: caam - update xts sector size for large input length Andrei Botila
2020-03-02  9:36 ` Horia Geanta [this message]
2020-03-06  1:52 ` 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=VI1PR0402MB34851CC70E092F598E9BF32298E70@VI1PR0402MB3485.eurprd04.prod.outlook.com \
    --to=horia.geanta@nxp.com \
    --cc=andrei.botila@nxp.com \
    --cc=andrei.botila@oss.nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=davem@davemloft.net \
    --cc=dm-devel@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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).