30 lines
858 B
Diff
30 lines
858 B
Diff
From 516c9a1c8f77e8d1d91c78478425b4df585ec485 Mon Sep 17 00:00:00 2001
|
|
From: taoqi <taoqi10@huawei.com>
|
|
Date: Tue, 20 Jun 2023 22:38:01 +0800
|
|
Subject: [PATCH 08/10] cipher: fix double free error
|
|
|
|
When wd_cipher_set_key() failed, after the handle
|
|
is released, the handle should be set to 0 to avoid
|
|
reusing.
|
|
|
|
Signed-off-by: taoqi <taoqi10@huawei.com>
|
|
---
|
|
src/uadk_cipher.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c
|
|
index c7be21a..1905e47 100644
|
|
--- a/src/uadk_cipher.c
|
|
+++ b/src/uadk_cipher.c
|
|
@@ -878,6 +878,7 @@ static void uadk_e_ctx_init(EVP_CIPHER_CTX *ctx, struct cipher_priv_ctx *priv)
|
|
ret = wd_cipher_set_key(priv->sess, priv->key, EVP_CIPHER_CTX_key_length(ctx));
|
|
if (ret) {
|
|
wd_cipher_free_sess(priv->sess);
|
|
+ priv->sess = 0;
|
|
fprintf(stderr, "uadk failed to set key!\n");
|
|
}
|
|
}
|
|
--
|
|
2.25.1
|
|
|