Backport uadk engine patch from linaro. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> (cherry picked from commit 4f6b3e8022834a09849728415c9ea73d7fdb794a)
43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
From 1ff08b383a59150a193870b3150d5265a03864ed Mon Sep 17 00:00:00 2001
|
|
From: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
Date: Thu, 10 Mar 2022 20:03:20 +0800
|
|
Subject: [PATCH 35/36] cipher: fix segmentation fault for uadk_e_ctx_init
|
|
|
|
if uadk_e_init_cipher failed, there is no need to
|
|
alloc cipher session, and alloc session will meet
|
|
a segmentation fault because sched_init is not
|
|
set by wd_cipher_init.
|
|
|
|
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
---
|
|
src/uadk_cipher.c | 7 ++++---
|
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c
|
|
index e4595be..d6dd8e8 100644
|
|
--- a/src/uadk_cipher.c
|
|
+++ b/src/uadk_cipher.c
|
|
@@ -846,15 +846,16 @@ static void uadk_e_ctx_init(EVP_CIPHER_CTX *ctx, struct cipher_priv_ctx *priv)
|
|
struct sched_params params = {0};
|
|
int ret;
|
|
|
|
+ priv->req.iv_bytes = EVP_CIPHER_CTX_iv_length(ctx);
|
|
+ priv->req.iv = priv->iv;
|
|
+
|
|
ret = uadk_e_init_cipher();
|
|
if (unlikely(!ret)) {
|
|
priv->switch_flag = UADK_DO_SOFT;
|
|
fprintf(stderr, "uadk failed to init cipher HW!\n");
|
|
+ return;
|
|
}
|
|
|
|
- priv->req.iv_bytes = EVP_CIPHER_CTX_iv_length(ctx);
|
|
- priv->req.iv = priv->iv;
|
|
-
|
|
/*
|
|
* The internal RR scheduler used by environment variables,
|
|
* the cipher algorithm does not distinguish between
|
|
--
|
|
2.24.4
|
|
|