linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions
@ 2025-04-27 11:05 Corentin Labbe
  2025-04-27 11:10 ` Corentin Labbe
  0 siblings, 1 reply; 2+ messages in thread
From: Corentin Labbe @ 2025-04-27 11:05 UTC (permalink / raw)
  To: gregkh, johan; +Cc: linux-kernel, linux-usb, Corentin Labbe

When testing sun8i-ss with multi_v7_defconfig, all CBC algorithm fail crypto
selftests.
This is strange since on sunxi_defconfig, everything was ok.
The problem was in the IV setup loop which never run because sg_dma_len
was 0.

Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---

If someone know why sunxi_defconfig have sg_dma_len() which always works
even with any DMA call not done.

 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
index 4caf17310e90..ddec1b08d4f6 100644
--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
@@ -141,7 +141,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *areq)
 
 	/* we need to copy all IVs from source in case DMA is bi-directionnal */
 	while (sg && len) {
-		if (sg_dma_len(sg) == 0) {
+		if (sg->length == 0) {
 			sg = sg_next(sg);
 			continue;
 		}
-- 
2.49.0


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

* Re: [PATCH] crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions
  2025-04-27 11:05 [PATCH] crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions Corentin Labbe
@ 2025-04-27 11:10 ` Corentin Labbe
  0 siblings, 0 replies; 2+ messages in thread
From: Corentin Labbe @ 2025-04-27 11:10 UTC (permalink / raw)
  To: gregkh, johan; +Cc: linux-kernel, linux-usb

Le Sun, Apr 27, 2025 at 01:05:03PM +0200, Corentin Labbe a écrit :
> When testing sun8i-ss with multi_v7_defconfig, all CBC algorithm fail crypto
> selftests.
> This is strange since on sunxi_defconfig, everything was ok.
> The problem was in the IV setup loop which never run because sg_dma_len
> was 0.
> 
> Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
> 

Sorry my system didnt generate correct CC/TO, please ignore.
I resend on correct people.

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

end of thread, other threads:[~2025-04-27 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-27 11:05 [PATCH] crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions Corentin Labbe
2025-04-27 11:10 ` Corentin Labbe

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).