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)
This commit is contained in:
Wenkai Lin 2021-12-10 10:04:38 +08:00 committed by openeuler-sync-bot
parent 7a7bd9df96
commit 7284652795
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,55 @@
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

View File

@ -3,7 +3,7 @@
Name: uadk_engine Name: uadk_engine
Summary: UADK Accelerator Engine Summary: UADK Accelerator Engine
Version: 1.0.0 Version: 1.0.0
Release: 1 Release: 2
License: Apache-2.0 License: Apache-2.0
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
ExclusiveOS: linux ExclusiveOS: linux
@ -16,6 +16,8 @@ BuildRequires: openssl-devel sed autoconf automake libtool
Requires: openssl Requires: openssl
ExclusiveArch: aarch64 ExclusiveArch: aarch64
Patch0001: 0001-digest-delete-some-duplicate-code.patch
%description %description
This package contains the UADK Accelerator Engine This package contains the UADK Accelerator Engine
@ -64,5 +66,8 @@ fi
/sbin/ldconfig /sbin/ldconfig
%changelog %changelog
* Fri Dec 10 2021 linwenkai <linwenkai6@hisilicon.com> 1.0.0-2
- Delete digest duplicate code
* Fri Dec 10 2021 linwenkai <linwenkai6@hisilicon.com> 1.0.0-1 * Fri Dec 10 2021 linwenkai <linwenkai6@hisilicon.com> 1.0.0-1
- First Spec Version Include uadk_engine Code - First Spec Version Include uadk_engine Code