Re: [PATCH 4/4] crypto: ccree - fix AEAD blocksize registration

From: Geert Uytterhoeven
Date: Thu Jan 30 2020 - 08:19:51 EST


Hi Gilad,

On Thu, Jan 30, 2020 at 12:33 PM Gilad Ben-Yossef <gilad@xxxxxxxxxxxxx> wrote:
> On Wed, Jan 29, 2020 at 5:17 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> > On Wed, Jan 29, 2020 at 3:39 PM Gilad Ben-Yossef <gilad@xxxxxxxxxxxxx> wrote:
> > > Fix an error causing no block sizes to be reported during
> > > all AEAD registrations.
> > >
> > > Signed-off-by: Gilad Ben-Yossef <gilad@xxxxxxxxxxxxx>
> >
> > Thanks, this fixes:
> >
> > alg: aead: blocksize for authenc-hmac-sha1-cbc-aes-ccree (0)
> > doesn't match generic impl (16)
> > alg: aead: blocksize for authenc-hmac-sha256-cbc-aes-ccree (0)
> > doesn't match generic impl (16)
> >
> > which you may want to mention in the commit description, so
> > people who search for the error message will find the fix.
> >
> > Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> >
> > Note that even after applying this series, the kernel still crashes with
> >
> > kernel BUG at kernel/dma/swiotlb.c:497!
> > ....
> > Call trace:
> > swiotlb_tbl_map_single+0x30c/0x380
> > swiotlb_map+0xb0/0x300
> > dma_direct_map_page+0xb8/0x140
> > dma_direct_map_sg+0x78/0xe0
> > cc_map_sg+0xa0/0xd0
> > cc_aead_chain_data.constprop.25+0x17c/0x6a0
> > cc_map_aead_request+0x61c/0x990
> > cc_proc_aead+0x140/0xeb0
> > cc_aead_decrypt+0x48/0x68
> > crypto_aead_decrypt+0x30/0x48
> > test_aead_vec_cfg+0x5a0/0x8d0
> >
> > but you may be aware of that.
> >
> > CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n
> > CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
>
> OK, this is a new one yet - we are now crashing in out-of-place decryption.
> And again, I am not seeing this in the different test board, even with
> DMA debug turned on.

I'm using a tree based on renesas-drivers[*], with renesas_defconfig
(also from [*]), and the two config changes above.

> Can you help me out and print the cryptlen and assoclen (I'm guessing
> both are zero), authlen and which AEAD/mode this is?

The crashing test is "ccm(aes)" from alg_test_descs[].

With DEBUG=y, and a few extra debug prints, the last few lines
leading to the crash were:

ccree e6601000.crypto: Copy-to-sram: mlli_dma=00000260, mlli_size=40
ccree e6601000.crypto: ASSOC buffer type MLLI
ccree e6601000.crypto: CIPHER: SRC/DST buffer type MLLI
ccree e6601000.crypto: Setting key in context @00000000ceb78614 for
ccm(aes). key=00000000ae78472c keylen=32
ccree e6601000.crypto: enc_keylen=32 authkeylen=0
ccree e6601000.crypto: authlen=16
cc_aead_decrypt:2086: assoclen = 32 cryptlen = 48
cc_aead_decrypt:2087: iv = ffff80000a5d3980 src = ffff0006f8a28040 dst
= ffff0006f8a28040
ccree e6601000.crypto: Dec context=00000000ceb78614
req=0000000057b9c395 iv=00000000784a9e35 src=00000000b9e80940
src_ofs=24 dst=00000000b9e80940 dst_ofs=24 cryptolen=48
ccree e6601000.crypto: Copy-to-sram: mlli_dma=00000260, mlli_size=16
ccree e6601000.crypto: ASSOC buffer type MLLI
ccree e6601000.crypto: CIPHER: SRC/DST buffer type DLLI
ccree e6601000.crypto: Setting key in context @00000000ceb78614 for
ccm(aes). key=00000000ae78472c keylen=32
ccree e6601000.crypto: enc_keylen=32 authkeylen=0
ccree e6601000.crypto: authlen=16
cc_aead_decrypt:2086: assoclen = 32 cryptlen = 48
cc_aead_decrypt:2087: iv = ffff80000a5d39b1 src = ffff0006f8a28040 dst
= ffff0006f8a28290
ccree e6601000.crypto: Dec context=00000000ceb78614
req=0000000057b9c395 iv=00000000e16df7d7 src=00000000b07b5b54
src_ofs=23 dst=00000000b3abbd9e dst_ofs=23 cryptolen=48
ccree e6601000.crypto: Copy-to-sram: mlli_dma=00000260, mlli_size=16
ccree e6601000.crypto: ASSOC buffer type MLLI
ccree e6601000.crypto: CIPHER: SRC/DST buffer type DLLI
ccree e6601000.crypto: Setting key in context @00000000ceb78614 for
ccm(aes). key=0000000061847879 keylen=32
ccree e6601000.crypto: enc_keylen=32 authkeylen=0
ccree e6601000.crypto: authlen=16
cc_aead_decrypt:2086: assoclen = 32 cryptlen = 48
cc_aead_decrypt:2087: iv = ffff80000a5d3980 src = ffff0006f8a28040 dst
= ffff0006f8a28040
ccree e6601000.crypto: Dec context=00000000ceb78614
req=0000000057b9c395 iv=00000000784a9e35 src=0000000026c45683
src_ofs=8 dst=0000000026c45683 dst_ofs=8 cryptolen=48
ccree e6601000.crypto: Copy-to-sram: mlli_dma=00000260, mlli_size=16
ccree e6601000.crypto: ASSOC buffer type MLLI
ccree e6601000.crypto: CIPHER: SRC/DST buffer type DLLI
ccree e6601000.crypto: Setting key in context @00000000ceb78614 for
ccm(aes). key=000000002490788f keylen=16
ccree e6601000.crypto: enc_keylen=16 authkeylen=0
ccree e6601000.crypto: authlen=8
cc_aead_decrypt:2086: assoclen = 0 cryptlen = 8
cc_aead_decrypt:2087: iv = ffff80000a5d3980 src = ffff0006f8a28040 dst
= ffff0006f8a28040
ccree e6601000.crypto: Dec context=00000000ceb78614
req=0000000057b9c395 iv=00000000784a9e35 src=000000006ab00be2
src_ofs=0 dst=000000006ab00be2 dst_ofs=0 cryptolen=8
ccree e6601000.crypto: Payload authentication failure, (auth-size=8, cipher=8)
ccree e6601000.crypto: Setting key in context @00000000ceb78614 for
ccm(aes). key=000000002490788f keylen=16
ccree e6601000.crypto: enc_keylen=16 authkeylen=0
ccree e6601000.crypto: authlen=8
cc_aead_decrypt:2086: assoclen = 0 cryptlen = 8
cc_aead_decrypt:2087: iv = ffff80000a5d3980 src = ffff0006f8a28040 dst
= ffff0006f8a28290
ccree e6601000.crypto: Dec context=00000000ceb78614
req=0000000057b9c395 iv=00000000784a9e35 src=000000006ab00be2
src_ofs=0 dst=00000000c4bfb383 dst_ofs=0 cryptolen=8

[*] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/tag/?h=renesas-drivers-2020-01-28-v5.5

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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