aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGaurav Jain2022-04-15 16:52:34 +0530
committerStefano Babic2022-04-21 15:18:25 +0200
commitcc84edddd17ed6eedbd17ad1ab9672854ec5fa27 (patch)
tree4882ba3ad83673cea353e25cab6f400c400a5f72 /drivers
parente3b330e489e777d4cf0d8d83e4d89cfe674ed597 (diff)
crypto/fsl: Clear the memory when blob decapsulation fails
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/fsl/fsl_blob.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/crypto/fsl/fsl_blob.c b/drivers/crypto/fsl/fsl_blob.c
index e8202cc5697..9b6e4bca062 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);