uadk_engine/0001-digest-delete-some-duplicate-code.patch
Wenkai Lin 7284652795 uadk_engine: delete digest duplicate code
digest task not need to alloc session twice.

Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
(cherry picked from commit b8671c2b8e0cb45265d72feaec8e67572c5a11c0)
2021-12-10 11:46:12 +08:00

56 lines
1.3 KiB
Diff

From eba09f6a2eb20bf431822718fa752a68b6d682c5 Mon Sep 17 00:00:00 2001
From: Kai Ye <yekai13@huawei.com>
Date: Thu, 9 Dec 2021 11:17:40 +0800
Subject: [PATCH] digest: delete some duplicate code
digest task not need to allocate session twice for one stream.
init->update->final as one stream.
Signed-off-by: Kai Ye <yekai13@huawei.com>
---
src/uadk_digest.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/uadk_digest.c b/src/uadk_digest.c
index 9fdec91..db33d16 100644
--- a/src/uadk_digest.c
+++ b/src/uadk_digest.c
@@ -607,10 +607,6 @@ static int uadk_e_digest_final(EVP_MD_CTX *ctx, unsigned char *digest)
int ret = 1;
struct async_op op;
- priv->sess = wd_digest_alloc_sess(&priv->setup);
- if (unlikely(!priv->sess))
- return 0;
-
priv->req.in = priv->data;
priv->req.out = digest;
priv->req.in_bytes = priv->tail;
@@ -639,11 +635,6 @@ static int uadk_e_digest_final(EVP_MD_CTX *ctx, unsigned char *digest)
goto clear;
}
- if (priv->sess) {
- wd_digest_free_sess(priv->sess);
- priv->sess = 0;
- }
-
return 1;
sync_err:
@@ -665,6 +656,11 @@ static int uadk_e_digest_cleanup(EVP_MD_CTX *ctx)
if (!priv || priv->copy)
return 1;
+ if (priv->sess) {
+ wd_digest_free_sess(priv->sess);
+ priv->sess = 0;
+ }
+
if (priv && priv->data)
OPENSSL_free(priv->data);
--
2.24.4