* FAILED: patch "[PATCH] crypto: caam - update xts sector size for large input length" failed to apply to 4.9-stable tree
@ 2020-04-15 11:06 gregkh
2020-04-16 1:13 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2020-04-15 11:06 UTC (permalink / raw)
To: andrei.botila, herbert, horia.geanta, stable; +Cc: stable
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3f142b6a7b573bde6cff926f246da05652c61eb4 Mon Sep 17 00:00:00 2001
From: Andrei Botila <andrei.botila@nxp.com>
Date: Fri, 28 Feb 2020 12:46:48 +0200
Subject: [PATCH] crypto: caam - update xts sector size for large input length
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/drivers/crypto/caam/caamalg_desc.c b/drivers/crypto/caam/caamalg_desc.c
index 6171a8118b5a..d6c58184bb57 100644
--- a/drivers/crypto/caam/caamalg_desc.c
+++ b/drivers/crypto/caam/caamalg_desc.c
@@ -1524,7 +1524,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);
@@ -1577,7 +1583,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);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: FAILED: patch "[PATCH] crypto: caam - update xts sector size for large input length" failed to apply to 4.9-stable tree
2020-04-15 11:06 FAILED: patch "[PATCH] crypto: caam - update xts sector size for large input length" failed to apply to 4.9-stable tree gregkh
@ 2020-04-16 1:13 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2020-04-16 1:13 UTC (permalink / raw)
To: gregkh; +Cc: andrei.botila, herbert, horia.geanta, stable
On Wed, Apr 15, 2020 at 01:06:15PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.9-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From 3f142b6a7b573bde6cff926f246da05652c61eb4 Mon Sep 17 00:00:00 2001
>From: Andrei Botila <andrei.botila@nxp.com>
>Date: Fri, 28 Feb 2020 12:46:48 +0200
>Subject: [PATCH] crypto: caam - update xts sector size for large input length
>MIME-Version: 1.0
>Content-Type: text/plain; charset=UTF-8
>Content-Transfer-Encoding: 8bit
>
>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>
>Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Function names were different due to 9dbe3072c6b1 ("crypto: caam/qi -
ablkcipher -> skcipher conversion") - queued up for 4.19 and 4.14.
I don't think that it's needed on anything older.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-16 1:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-15 11:06 FAILED: patch "[PATCH] crypto: caam - update xts sector size for large input length" failed to apply to 4.9-stable tree gregkh
2020-04-16 1:13 ` Sasha Levin
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).