uadk_engine/0006-digest-add-ctx-allocation-check.patch
JangShui Yang 9dd90cee97 Backport uadk engine patch
(cherry picked from commit 793613e405197982521d4079047f8ea5468483bc)
2024-04-07 18:59:10 +08:00

30 lines
837 B
Diff

From 07324a0cdcad935e7d3449b8ff8907ca1c2a6b58 Mon Sep 17 00:00:00 2001
From: Zhiqi Song <songzhiqi1@huawei.com>
Date: Fri, 29 Mar 2024 10:13:24 +0800
Subject: [PATCH 6/7] digest: add ctx allocation check
Add result check of EVP_MD_CTX_new().
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
---
src/uadk_digest.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/uadk_digest.c b/src/uadk_digest.c
index 8ab1b83..43bbf60 100644
--- a/src/uadk_digest.c
+++ b/src/uadk_digest.c
@@ -204,6 +204,8 @@ static int digest_soft_init(struct digest_priv_ctx *md_ctx)
/* Allocate a soft ctx for hardware engine */
if (md_ctx->soft_ctx == NULL)
md_ctx->soft_ctx = EVP_MD_CTX_new();
+ if (md_ctx->soft_ctx == NULL)
+ return 0;
ctx = md_ctx->soft_ctx;
--
2.25.1