All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: ccree - dec auth tag size from cryptlen map
@ 2020-02-02 16:19 Gilad Ben-Yossef
  2020-02-06 14:45 ` Geert Uytterhoeven
  2020-02-13  9:22 ` Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Gilad Ben-Yossef @ 2020-02-02 16:19 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Ofir Drang, Geert Uytterhoeven, stable, linux-crypto, linux-kernel

Remove the auth tag size from cryptlen before mapping the destination
in out-of-place AEAD decryption thus resolving a crash with
extended testmgr tests.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: stable@vger.kernel.org # v4.19+
---
 drivers/crypto/ccree/cc_buffer_mgr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc_buffer_mgr.c
index 885347b5b372..954f14bddf1d 100644
--- a/drivers/crypto/ccree/cc_buffer_mgr.c
+++ b/drivers/crypto/ccree/cc_buffer_mgr.c
@@ -894,8 +894,12 @@ static int cc_aead_chain_data(struct cc_drvdata *drvdata,
 
 	if (req->src != req->dst) {
 		size_for_map = areq_ctx->assoclen + req->cryptlen;
-		size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ?
-				authsize : 0;
+
+		if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT)
+			size_for_map += authsize;
+		else
+			size_for_map -= authsize;
+
 		if (is_gcm4543)
 			size_for_map += crypto_aead_ivsize(tfm);
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: ccree - dec auth tag size from cryptlen map
  2020-02-02 16:19 [PATCH] crypto: ccree - dec auth tag size from cryptlen map Gilad Ben-Yossef
@ 2020-02-06 14:45 ` Geert Uytterhoeven
  2020-02-09  9:11   ` Gilad Ben-Yossef
  2020-02-13  9:22 ` Herbert Xu
  1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2020-02-06 14:45 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: Herbert Xu, David S. Miller, Ofir Drang, stable,
	Linux Crypto Mailing List, Linux Kernel Mailing List,
	Linux-Renesas

Hi Gilad,

On Sun, Feb 2, 2020 at 5:19 PM Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> Remove the auth tag size from cryptlen before mapping the destination
> in out-of-place AEAD decryption thus resolving a crash with
> extended testmgr tests.
>
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: stable@vger.kernel.org # v4.19+

Thanks, this fixes the crash seen on R-Car H3 ES2.0 with renesas_defconfig,
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n, and CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Remaining issues reported during boot:
  1. alg: skcipher: blocksize for xts-aes-ccree (1) doesn't match
generic impl (16)
  2. alg: aead: rfc4543-gcm-aes-ccree decryption unexpectedly
succeeded on test vector "random: alen=16 plen=39 authsize=16 klen=20
novrfy=1"; expected_error=-EBADMSG or -22, cfg="random: may_sleep
use_digest src_divs=[4.47%@+3553, 30.80%@+4065, 12.0%@+11,
6.22%@+2999, 46.51%@alignmask+3468]"

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: ccree - dec auth tag size from cryptlen map
  2020-02-06 14:45 ` Geert Uytterhoeven
@ 2020-02-09  9:11   ` Gilad Ben-Yossef
  0 siblings, 0 replies; 4+ messages in thread
From: Gilad Ben-Yossef @ 2020-02-09  9:11 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Herbert Xu, David S. Miller, Ofir Drang, stable,
	Linux Crypto Mailing List, Linux Kernel Mailing List,
	Linux-Renesas

On Thu, Feb 6, 2020 at 4:45 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Gilad,
>
> On Sun, Feb 2, 2020 at 5:19 PM Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> > Remove the auth tag size from cryptlen before mapping the destination
> > in out-of-place AEAD decryption thus resolving a crash with
> > extended testmgr tests.
> >
> > Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> > Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Cc: stable@vger.kernel.org # v4.19+
>
> Thanks, this fixes the crash seen on R-Car H3 ES2.0 with renesas_defconfig,
> CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n, and CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks again for your help.

>
> Remaining issues reported during boot:
>   1. alg: skcipher: blocksize for xts-aes-ccree (1) doesn't match
> generic impl (16)

Yes, this is actually a known issue with the generic XTS implementation.
See: https://lore.kernel.org/linux-crypto/VI1PR0402MB34858E4EF0ACA7CDB446FF5798CE0@VI1PR0402MB3485.eurprd04.prod.outlook.com/


>   2. alg: aead: rfc4543-gcm-aes-ccree decryption unexpectedly
> succeeded on test vector "random: alen=16 plen=39 authsize=16 klen=20
> novrfy=1"; expected_error=-EBADMSG or -22, cfg="random: may_sleep
> use_digest src_divs=[4.47%@+3553, 30.80%@+4065, 12.0%@+11,
> 6.22%@+2999, 46.51%@alignmask+3468]"

Yes, I am working on this one right now.

Many thanks,
Gilad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: ccree - dec auth tag size from cryptlen map
  2020-02-02 16:19 [PATCH] crypto: ccree - dec auth tag size from cryptlen map Gilad Ben-Yossef
  2020-02-06 14:45 ` Geert Uytterhoeven
@ 2020-02-13  9:22 ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2020-02-13  9:22 UTC (permalink / raw)
  To: Gilad Ben-Yossef
  Cc: David S. Miller, Ofir Drang, Geert Uytterhoeven, stable,
	linux-crypto, linux-kernel

On Sun, Feb 02, 2020 at 06:19:14PM +0200, Gilad Ben-Yossef wrote:
> Remove the auth tag size from cryptlen before mapping the destination
> in out-of-place AEAD decryption thus resolving a crash with
> extended testmgr tests.
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: stable@vger.kernel.org # v4.19+
> ---
>  drivers/crypto/ccree/cc_buffer_mgr.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-13  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-02 16:19 [PATCH] crypto: ccree - dec auth tag size from cryptlen map Gilad Ben-Yossef
2020-02-06 14:45 ` Geert Uytterhoeven
2020-02-09  9:11   ` Gilad Ben-Yossef
2020-02-13  9:22 ` Herbert Xu

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.