Skip to contentSkip to conversation

crypto/fsl: fsl_rsa: Fix dcache issue in the driver

PATCH Superseded Gaurav Jain 3 participants 12 messages Jun 15, 2022 – Jul 29, 2022 Crypto API

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 crypto/fsl: fsl_rsa: Fix dcache issue in the driver

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
---
 drivers/crypto/fsl/fsl_rsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/crypto/fsl/fsl_rsa.c +10 -0
index 897ee855ea..335b7fe25a 100644
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <cpu_func.h>
 #include <dm.h>
 #include <log.h>
 #include <asm/types.h>
@@ -36,12 +37,21 @@ int fsl_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
 
 	inline_cnstr_jobdesc_pkha_rsaexp(desc, &pkin, out, sig_len);
 
+	flush_dcache_range((ulong)sig, (ulong)sig + sig_len);
+	flush_dcache_range((ulong)prop->modulus, (ulong)(prop->modulus) + keylen);
+	flush_dcache_range((ulong)prop->public_exponent,
+			   (ulong)(prop->public_exponent) + prop->exp_len);
+	flush_dcache_range((ulong)desc, (ulong)desc + (sizeof(uint32_t) * MAX_CAAM_DESCSIZE));
+	flush_dcache_range((ulong)out, (ulong)out + sig_len);
+
 	ret = run_descriptor_jr(desc);
 	if (ret) {
 		debug("%s: RSA failed to verify: %d\n", __func__, ret);
 		return -EFAULT;
 	}
 
+	invalidate_dcache_range((ulong)out, (ulong)out + sig_len);
+
 	return 0;
 }
 
Signature · 1 line
2.25.1
#1 lore raw

Hi Gaurav,

Quoted 11 lines · Gaurav Jain

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Quoted 5 lines
Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

#2 lore raw

Hi Fabio

Quoted 32 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 11 lines · Gaurav Jain

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Quoted 5 lines
Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c
I will send a different patch for the error reported by you.

Regards
Gaurav Jain

#3 lore raw
Quoted 34 lines · Gaurav Jain

Hi Fabio

Quoted 32 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 16 lines · Gaurav Jain

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 6 lines
Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c
I will send a different patch for the error reported by you.

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 3 lines

Regards
Gaurav Jain

#4 lore raw

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Regards
Gaurav Jain

Quoted 63 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 35 lines · Gaurav Jain

Hi Fabio

Quoted 33 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 16 lines · Gaurav Jain

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 6 lines
Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 3 lines

Regards
Gaurav Jain

#5 lore raw

Hi Gaurav,

Quoted 6 lines · Gaurav Jain

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Something went wrong - I have applied this patch to push to 2022.07, but in CI I get the same errors I found before, that is PowerPC build was broken:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/457090

I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2. Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano

Quoted 66 lines

Regards
Gaurav Jain

Quoted 63 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 35 lines · Gaurav Jain

Hi Fabio

Quoted 33 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 16 lines · Gaurav Jain

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 6 lines
Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 3 lines

Regards
Gaurav Jain

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#6 lore raw

Hi Stefano

this patch is fixing dcache issue in fsl_rsa.c

Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);

reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Regards
Gaurav Jain

Quoted 125 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 29, 2022 12:51 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 6 lines · Gaurav Jain

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Something went wrong - I have applied this patch to push to 2022.07, but in CI I get the same errors I found before, that is PowerPC build was broken:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98808 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%3D &amp;reserved=0

I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2. Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano

Quoted 36 lines

Regards
Gaurav Jain

Quoted 33 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 18 lines · Gaurav Jain

Hi Fabio

Quoted 16 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <[email protected]>

Quoted 24 lines · wrote:
Quoted 24 lines
Quoted 23 lines
Quoted 17 lines
Quoted 11 lines

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Quoted 5 lines
Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Quoted 8 lines
Quoted 8 lines

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 3 lines

Regards
Gaurav Jain

--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====

#7 lore raw
Quoted 9 lines · Gaurav Jain

Hi Stefano

this patch is fixing dcache issue in fsl_rsa.c

Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);

reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Yes, and I have supposed to have merged this, too.

I will pick up again both and let CI runs.

Stefano

Quoted 129 lines

Regards
Gaurav Jain

Quoted 125 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 29, 2022 12:51 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 6 lines · Gaurav Jain

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Something went wrong - I have applied this patch to push to 2022.07, but in CI I get the same errors I found before, that is PowerPC build was broken:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98808 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%3D &amp;reserved=0

I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2. Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano

Quoted 36 lines

Regards
Gaurav Jain

Quoted 33 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 18 lines · Gaurav Jain

Hi Fabio

Quoted 16 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <[email protected]>

Quoted 24 lines · wrote:
Quoted 24 lines
Quoted 23 lines
Quoted 17 lines
Quoted 11 lines

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Quoted 5 lines
Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Quoted 8 lines
Quoted 8 lines

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 3 lines

Regards
Gaurav Jain

--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#8 lore raw
In reply to Gaurav Jain

Hi Gaurav,

Quoted 4 lines · Gaurav Jain

Hi Stefano

this patch is fixing dcache issue in fsl_rsa.c

The thread changed name, I mean "crypto/fsl: fsl_hash: Fix crash in flush dcache"

Quoted 6 lines

Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);

reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Give an another attempt, it fails and it is quite clear why:

+#ifdef CONFIG_CAAM_64BIT
+ addr = sec_in32(&ctx->sg_tbl[i].addr_hi);
+ addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
+#else

Fine with ARM and ARM64. In Kconfig:

config CAAM_64BIT
bool
default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8 help
Select Crypto driver for 64 bits CAAM version

That is ok until powerpc are built that sets PHYS_64BIT. Then build fails with:

powerpc: + T4240RDB_SDCARD
+drivers/crypto/fsl/fsl_hash.c: In function 'caam_hash_finish':
+drivers/crypto/fsl/fsl_hash.c:151:30: error: left shift count >= width of type [-Werror=shift-count-overflow]
+ 151 | addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
+ | ^~
+cc1: all warnings being treated as errors

And well, compiler is right...

Best regards,
Stefano Babic

Quoted 128 lines

Regards
Gaurav Jain

Quoted 125 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 29, 2022 12:51 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 6 lines · Gaurav Jain

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Something went wrong - I have applied this patch to push to 2022.07, but in CI I get the same errors I found before, that is PowerPC build was broken:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.d
enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98808 23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 %7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C %7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%3D &amp;reserved=0

I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has not fixed CI as in V2. Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano

Quoted 36 lines

Regards
Gaurav Jain

Quoted 33 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 18 lines · Gaurav Jain

Hi Fabio

Quoted 16 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <[email protected]>

Quoted 24 lines · wrote:
Quoted 24 lines
Quoted 23 lines
Quoted 17 lines
Quoted 11 lines

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Quoted 5 lines
Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Quoted 8 lines
Quoted 8 lines

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 3 lines

Regards
Gaurav Jain

--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#9 lore raw

Hello Stefano

Quoted 75 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Tuesday, July 26, 2022 2:55 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 4 lines · Gaurav Jain

Hi Stefano

this patch is fixing dcache issue in fsl_rsa.c

The thread changed name, I mean "crypto/fsl: fsl_hash: Fix crash in flush dcache"

Quoted 7 lines

Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);

reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
work.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220616101009.809953-

1-ga

Quoted 1 line

urav.jain%40nxp.com%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C b605

Quoted 1 line

e737d37a4237e8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7 C0%7C

Quoted 1 line

0%7C637944243170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA wMDAiLCJ

Quoted 1 line

QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;s data=

Quoted 1 line

KUAaTlucw6GRG7W2QvlE0JMO%2FAJt0tmi7%2FM3ZcpZ6C0%3D&amp;reserved =0

Quoted 1 line

Give an another attempt, it fails and it is quite clear why:

(quoted diff) +4 -0
+#ifdef CONFIG_CAAM_64BIT
+               addr = sec_in32(&ctx->sg_tbl[i].addr_hi);
+               addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
+#else

Fine with ARM and ARM64. In Kconfig:

config CAAM_64BIT
bool
default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8 help
Select Crypto driver for 64 bits CAAM version

That is ok until powerpc are built that sets PHYS_64BIT. Then build fails with:

powerpc: + T4240RDB_SDCARD

(quoted diff) +2 -0
+drivers/crypto/fsl/fsl_hash.c: In function 'caam_hash_finish':
+drivers/crypto/fsl/fsl_hash.c:151:30: error: left shift count >= width

of type [-Werror=shift-count-overflow]
+ 151 | addr = (addr << 32) |
sec_in32(&ctx->sg_tbl[i].addr_lo);

(quoted diff) +2 -0
+      |                              ^~
+cc1: all warnings being treated as errors
Quoted 1 line

And well, compiler is right...

I have sent a V4 which fixes the error for powerpc platforms.

Thanks
Gaurav Jain

Quoted 167 lines

Best regards,
Stefano Babic

Quoted 35 lines

Regards
Gaurav Jain

Quoted 32 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 29, 2022 12:51 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 6 lines · Gaurav Jain

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Something went wrong - I have applied this patch to push to 2022.07, but in CI I get the same errors I found before, that is PowerPC build was
broken:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou

rce.d%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7Cb605e737d37a4 237e

Quoted 1 line
Quoted 1 line

8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637 94424

Quoted 1 line
Quoted 1 line

3170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi V2luMz

Quoted 1 line
Quoted 1 line

IiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=uDXXo PFq2y

Quoted 3 lines
Quoted 3 lines

L0RyoaEyrMCUFYCQ5M5CfwN6XQG6eM4DE%3D&amp;reserved=0 enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98

808

Quoted 1 line
Quoted 1 line

23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0

Quoted 1 line
Quoted 1 line

%7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM

C4

Quoted 1 line
Quoted 1 line

wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C

Quoted 1 line
Quoted 1 line

%7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%

3D

Quoted 4 lines
Quoted 4 lines

&amp;reserved=0

I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has

not fixed CI as in V2.

Quoted 75 lines
Quoted 75 lines

Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano

Quoted 37 lines

Regards
Gaurav Jain

Quoted 34 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>;
dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 18 lines · Gaurav Jain

Hi Fabio

Quoted 16 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <[email protected]>

Quoted 30 lines · wrote:
Quoted 30 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 6 lines
Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Regards
Gaurav Jain

--

=================================================================

Quoted 5 lines
Quoted 5 lines

====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]

=================================================================

Quoted 1 line
Quoted 1 line

====

--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====

#10 lore raw
Quoted 77 lines · Gaurav Jain

Hello Stefano

Quoted 75 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Tuesday, July 26, 2022 2:55 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 4 lines · Gaurav Jain

Hi Stefano

this patch is fixing dcache issue in fsl_rsa.c

The thread changed name, I mean "crypto/fsl: fsl_hash: Fix crash in flush dcache"

Quoted 7 lines

Error reported is in drivers/crypto/fsl/fsl_hash.c addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);

reported error is fixed in [v3] crypto/fsl: fsl_hash: Fix crash in flush dcache
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
work.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220616101009.809953-

1-ga

Quoted 1 line

urav.jain%40nxp.com%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C b605

Quoted 1 line

e737d37a4237e8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7 C0%7C

Quoted 1 line

0%7C637944243170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA wMDAiLCJ

Quoted 1 line

QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;s data=

Quoted 1 line

KUAaTlucw6GRG7W2QvlE0JMO%2FAJt0tmi7%2FM3ZcpZ6C0%3D&amp;reserved =0

Quoted 1 line

Give an another attempt, it fails and it is quite clear why:

(quoted diff) +4 -0
+#ifdef CONFIG_CAAM_64BIT
+               addr = sec_in32(&ctx->sg_tbl[i].addr_hi);
+               addr = (addr << 32) | sec_in32(&ctx->sg_tbl[i].addr_lo);
+#else

Fine with ARM and ARM64. In Kconfig:

config CAAM_64BIT
bool
default y if PHYS_64BIT && !ARCH_IMX8M && !ARCH_IMX8 help
Select Crypto driver for 64 bits CAAM version

That is ok until powerpc are built that sets PHYS_64BIT. Then build fails with:

powerpc: + T4240RDB_SDCARD

(quoted diff) +2 -0
+drivers/crypto/fsl/fsl_hash.c: In function 'caam_hash_finish':
+drivers/crypto/fsl/fsl_hash.c:151:30: error: left shift count >= width

of type [-Werror=shift-count-overflow]
+ 151 | addr = (addr << 32) |
sec_in32(&ctx->sg_tbl[i].addr_lo);

(quoted diff) +2 -0
+      |                              ^~
+cc1: all warnings being treated as errors
Quoted 3 lines
Quoted 1 line

And well, compiler is right...

I have sent a V4 which fixes the error for powerpc platforms.

Thanks - I merge and I start a new CI.

Stefano

Quoted 169 lines

Thanks
Gaurav Jain

Quoted 167 lines

Best regards,
Stefano Babic

Quoted 35 lines

Regards
Gaurav Jain

Quoted 32 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 29, 2022 12:51 PM
To: Gaurav Jain <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>; dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

Quoted 6 lines · Gaurav Jain

Hi Stefano

This patch is put into state "changes requested".
But it is a different patch in fsl_rsa.
There is no change requested with this patch.

Something went wrong - I have applied this patch to push to 2022.07, but in CI I get the same errors I found before, that is PowerPC build was
broken:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou

rce.d%2F&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7Cb605e737d37a4 237e

Quoted 1 line
Quoted 1 line

8ba08da6ee8bf00%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637 94424

Quoted 1 line
Quoted 1 line

3170612332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi V2luMz

Quoted 1 line
Quoted 1 line

IiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=uDXXo PFq2y

Quoted 3 lines
Quoted 3 lines

L0RyoaEyrMCUFYCQ5M5CfwN6XQG6eM4DE%3D&amp;reserved=0 enx.de%2Fu-boot%2Fcustodians%2Fu-boot-imx%2F- %2Fjobs%2F457090&amp;data=05%7C01%7Cgaurav.jain%40nxp.com%7C98

808

Quoted 1 line
Quoted 1 line

23b97ef4669f51108da599feffc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0

Quoted 1 line
Quoted 1 line

%7C0%7C637920840703403368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM

C4

Quoted 1 line
Quoted 1 line

wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C

Quoted 1 line
Quoted 1 line

%7C%7C&amp;sdata=FGDL9eBnjyUDc423myN4jVoK7QD9VZiitvZao6mz04s%

3D

Quoted 4 lines
Quoted 4 lines

&amp;reserved=0

I hadn't time to check this, and I suppose that issue is not yet fixed and I drop the patch from MR (Layerscape is broken, too), that is V3 has

not fixed CI as in V2.

Quoted 75 lines
Quoted 75 lines

Or is there anothe rpatch I had to pick up ?

Best regards,
Stefano

Quoted 37 lines

Regards
Gaurav Jain

Quoted 34 lines

-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Wednesday, June 15, 2022 6:20 PM
To: Gaurav Jain <[email protected]>; Fabio Estevam <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Peng Fan <[email protected]>;
dl- uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Quoted 18 lines · Gaurav Jain

Hi Fabio

Quoted 16 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, June 15, 2022 6:11 PM
To: Gaurav Jain <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>; Horia Geanta <[email protected]>; Varun Sethi <[email protected]>; Ye Li <[email protected]>
Subject: [EXT] Re: [PATCH v3] crypto/fsl: fsl_rsa: Fix dcache issue in the driver

Caution: EXT Email

Hi Gaurav,

On Wed, Jun 15, 2022 at 9:35 AM Gaurav Jain <[email protected]>

Quoted 30 lines · wrote:
Quoted 30 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)

---

Quoted 6 lines
Quoted 3 lines

Please always explain what changed in the current version of the patch.

I assume you fixed the build error found in CI, correct?

This is a different patch in fsl_rsa.c I will send a different patch for the error reported by you.

Ouch...I have misunderstood. Well, then I willwait for your patch..

Regards,
Stefano

Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Regards
Gaurav Jain

--

=================================================================

Quoted 5 lines
Quoted 5 lines

====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]

=================================================================

Quoted 1 line
Quoted 1 line

====

--
=================================================================
====
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=================================================================
====

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#11 lore raw
In reply to Gaurav Jain

Hi Gaurav,

thanks for fix, I will put into u-boot-imx and trigger a new CI.

Stefano

Quoted 52 lines · Gaurav Jain

From: Ye Li <[email protected]>

issue:
CAAM fails with key error when perform Modular Exponentiation using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature and output decrypted data processed by CAAM.

Fixes 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
---
  drivers/crypto/fsl/fsl_rsa.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/crypto/fsl/fsl_rsa.c +10 -0
index 897ee855ea..335b7fe25a 100644
@@ -6,6 +6,7 @@
 
  #include <config.h>
  #include <common.h>
+#include <cpu_func.h>
  #include <dm.h>
  #include <log.h>
  #include <asm/types.h>
@@ -36,12 +37,21 @@ int fsl_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
 
  	inline_cnstr_jobdesc_pkha_rsaexp(desc, &pkin, out, sig_len);
 
+	flush_dcache_range((ulong)sig, (ulong)sig + sig_len);
+	flush_dcache_range((ulong)prop->modulus, (ulong)(prop->modulus) + keylen);
+	flush_dcache_range((ulong)prop->public_exponent,
+			   (ulong)(prop->public_exponent) + prop->exp_len);
+	flush_dcache_range((ulong)desc, (ulong)desc + (sizeof(uint32_t) * MAX_CAAM_DESCSIZE));
+	flush_dcache_range((ulong)out, (ulong)out + sig_len);
+
  	ret = run_descriptor_jr(desc);
  	if (ret) {
  		debug("%s: RSA failed to verify: %d\n", __func__, ret);
  		return -EFAULT;
  	}
 
+	invalidate_dcache_range((ulong)out, (ulong)out + sig_len);
+
  	return 0;
  }