public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] crypto/fsl: Clear the memory when blob decapsulation fails
@ 2022-04-15 11:22 Gaurav Jain
  2022-04-16 13:35 ` Fabio Estevam
  2022-04-22  8:46 ` sbabic
  0 siblings, 2 replies; 3+ messages in thread
From: Gaurav Jain @ 2022-04-15 11:22 UTC (permalink / raw)
  To: Stefano Babic, u-boot
  Cc: Priyanka Jain, Ye Li, Horia Geanta, Silvano Di Ninno, Varun Sethi,
	NXP i . MX U-Boot Team, Gaurav Jain, Kshitiz Varshney

issue: blob decapsulation operation store the decrypted data
       in memory even if ICV check failed.

fix: clear the blob data output memory.

Fixes: c5de15cbc8 (crypto/fsl: Add command for encapsulating/decapsulating blobs)
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Tested-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
---
 drivers/crypto/fsl/fsl_blob.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/crypto/fsl/fsl_blob.c b/drivers/crypto/fsl/fsl_blob.c
index e8202cc569..9b6e4bca06 100644
--- a/drivers/crypto/fsl/fsl_blob.c
+++ b/drivers/crypto/fsl/fsl_blob.c
@@ -71,6 +71,10 @@ int blob_decap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
 	ret = run_descriptor_jr(desc);
 
 	if (ret) {
+		/* clear the blob data output buffer */
+		memset(dst, 0x00, len);
+		size = ALIGN(len, ARCH_DMA_MINALIGN);
+		flush_dcache_range((unsigned long)dst, (unsigned long)dst + size);
 		printf("Error in blob decapsulation: %d\n", ret);
 	} else {
 		size = ALIGN(len, ARCH_DMA_MINALIGN);
-- 
2.25.1


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

* Re: [PATCH] crypto/fsl: Clear the memory when blob decapsulation fails
  2022-04-15 11:22 [PATCH] crypto/fsl: Clear the memory when blob decapsulation fails Gaurav Jain
@ 2022-04-16 13:35 ` Fabio Estevam
  2022-04-22  8:46 ` sbabic
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2022-04-16 13:35 UTC (permalink / raw)
  To: Gaurav Jain
  Cc: Stefano Babic, U-Boot-Denx, Priyanka Jain, Ye Li, Horia Geanta,
	Silvano Di Ninno, Varun Sethi, NXP i . MX U-Boot Team,
	Kshitiz Varshney

On Fri, Apr 15, 2022 at 8:23 AM Gaurav Jain <gaurav.jain@nxp.com> wrote:
>
> issue: blob decapsulation operation store the decrypted data
>        in memory even if ICV check failed.
>
> fix: clear the blob data output memory.
>
> Fixes: c5de15cbc8 (crypto/fsl: Add command for encapsulating/decapsulating blobs)
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> Reviewed-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
> Tested-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>

Reviewed-by: Fabio Estevam <festevam@denx.de>

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

* [PATCH] crypto/fsl: Clear the memory when blob decapsulation fails
  2022-04-15 11:22 [PATCH] crypto/fsl: Clear the memory when blob decapsulation fails Gaurav Jain
  2022-04-16 13:35 ` Fabio Estevam
@ 2022-04-22  8:46 ` sbabic
  1 sibling, 0 replies; 3+ messages in thread
From: sbabic @ 2022-04-22  8:46 UTC (permalink / raw)
  To: Gaurav Jain, u-boot

> issue: blob decapsulation operation store the decrypted data
>        in memory even if ICV check failed.
> fix: clear the blob data output memory.
> Fixes: c5de15cbc8 (crypto/fsl: Add command for encapsulating/decapsulating blobs)
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> Reviewed-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
> Tested-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
> Reviewed-by: Fabio Estevam <festevam@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

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

end of thread, other threads:[~2022-04-22  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-15 11:22 [PATCH] crypto/fsl: Clear the memory when blob decapsulation fails Gaurav Jain
2022-04-16 13:35 ` Fabio Estevam
2022-04-22  8:46 ` sbabic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox