engine: update uadk engine source
Backport uadk engine from linaro. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> (cherry picked from commit 766348e9bbea924a5e4535d88612f43c9f59c2ec)
This commit is contained in:
parent
193302eafe
commit
1a997c5797
27
0019-cipher-fixup-a-code-check-warning.patch
Normal file
27
0019-cipher-fixup-a-code-check-warning.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From e82ec8d48be21d107635e5f1a4874fb8999a27c4 Mon Sep 17 00:00:00 2001
|
||||
From: Kai Ye <yekai13@huawei.com>
|
||||
Date: Wed, 19 Jan 2022 09:41:25 +0800
|
||||
Subject: [PATCH 19/22] cipher: fixup a code check warning
|
||||
|
||||
Do not put two or more continuous blank lines inside function.
|
||||
|
||||
Signed-off-by: Kai Ye <yekai13@huawei.com>
|
||||
---
|
||||
src/uadk_cipher.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c
|
||||
index 2b8bb9c..3d376bf 100644
|
||||
--- a/src/uadk_cipher.c
|
||||
+++ b/src/uadk_cipher.c
|
||||
@@ -890,7 +890,6 @@ static int uadk_e_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
struct async_op op;
|
||||
int ret;
|
||||
|
||||
-
|
||||
priv->req.src = (unsigned char *)in;
|
||||
priv->req.in_bytes = inlen;
|
||||
priv->req.dst = out;
|
||||
--
|
||||
2.24.4
|
||||
|
||||
27
0020-rsa-fixup-a-code-check-warning.patch
Normal file
27
0020-rsa-fixup-a-code-check-warning.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From d45c783eb7a7e1e38d5520239c218e7c927b1c00 Mon Sep 17 00:00:00 2001
|
||||
From: Kai Ye <yekai13@huawei.com>
|
||||
Date: Fri, 21 Jan 2022 17:01:15 +0800
|
||||
Subject: [PATCH 20/22] rsa: fixup a code check warning
|
||||
|
||||
Do not add blank lines on the start of a code block defined by braces.
|
||||
|
||||
Signed-off-by: Kai Ye <yekai13@huawei.com>
|
||||
---
|
||||
src/uadk_rsa.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c
|
||||
index 2526af9..8cad2f7 100644
|
||||
--- a/src/uadk_rsa.c
|
||||
+++ b/src/uadk_rsa.c
|
||||
@@ -1781,7 +1781,6 @@ exe_soft:
|
||||
|
||||
static RSA_METHOD *uadk_e_get_rsa_sw_methods(void)
|
||||
{
|
||||
-
|
||||
/* meth: default rsa software method */
|
||||
const RSA_METHOD *meth = RSA_PKCS1_OpenSSL();
|
||||
|
||||
--
|
||||
2.24.4
|
||||
|
||||
32
0021-cipher-delete-a-redundant-branch.patch
Normal file
32
0021-cipher-delete-a-redundant-branch.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 7a757c76d11b80282abc22e614f7126909027ecc Mon Sep 17 00:00:00 2001
|
||||
From: Kai Ye <yekai13@huawei.com>
|
||||
Date: Tue, 25 Jan 2022 14:21:48 +0800
|
||||
Subject: [PATCH 21/22] cipher: delete a redundant branch
|
||||
|
||||
Find a redundant branch by DT-FUZZ, these codes have the same
|
||||
logic as the following default code.
|
||||
|
||||
Signed-off-by: Kai Ye <yekai13@huawei.com>
|
||||
---
|
||||
src/uadk_cipher.c | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c
|
||||
index 3d376bf..6e09a8c 100644
|
||||
--- a/src/uadk_cipher.c
|
||||
+++ b/src/uadk_cipher.c
|
||||
@@ -373,11 +373,6 @@ static int uadk_e_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
|
||||
break;
|
||||
}
|
||||
|
||||
- if (i == size) {
|
||||
- *cipher = NULL;
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
switch (nid) {
|
||||
case NID_aes_128_cbc:
|
||||
*cipher = uadk_aes_128_cbc;
|
||||
--
|
||||
2.24.4
|
||||
|
||||
65
0022-engine-fix-engine-can-t-work-under-hybrid-mode.patch
Normal file
65
0022-engine-fix-engine-can-t-work-under-hybrid-mode.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From 02dbe7743190f334609a86b61bc46ea6e91e82b4 Mon Sep 17 00:00:00 2001
|
||||
From: Wenkai Lin <linwenkai6@hisilicon.com>
|
||||
Date: Wed, 16 Feb 2022 16:11:06 +0800
|
||||
Subject: [PATCH 22/22] engine: fix engine can't work under hybrid mode
|
||||
|
||||
If hpre works in no-sva mode, and sec works in sva mode,
|
||||
it will init hpre device first and return straightly, this
|
||||
casuse sec not initialized correctly. So uadk engine should
|
||||
init for both sva and no-sva device.
|
||||
|
||||
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
|
||||
---
|
||||
src/e_uadk.c | 25 ++++++++++++++-----------
|
||||
1 file changed, 14 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/e_uadk.c b/src/e_uadk.c
|
||||
index 4e87c86..2714d5b 100644
|
||||
--- a/src/e_uadk.c
|
||||
+++ b/src/e_uadk.c
|
||||
@@ -319,10 +319,15 @@ static void bind_fn_uadk_alg(ENGINE *e)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
- if (!uadk_e_bind_ecc(e))
|
||||
- fprintf(stderr, "uadk bind ecc failed\n");
|
||||
- else
|
||||
- uadk_ecc = 1;
|
||||
+ /* find an ecc device, no difference for sm2/ecdsa/ecdh/x25519/x448 */
|
||||
+ dev = wd_get_accel_dev("ecdsa");
|
||||
+ if (dev) {
|
||||
+ if (!uadk_e_bind_ecc(e))
|
||||
+ fprintf(stderr, "uadk bind ecc failed\n");
|
||||
+ else
|
||||
+ uadk_ecc = 1;
|
||||
+ free(dev);
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -349,17 +354,15 @@ static int bind_fn(ENGINE *e, const char *id)
|
||||
uadk_dh_nosva) {
|
||||
async_module_init_v1();
|
||||
pthread_atfork(NULL, NULL, engine_init_child_at_fork_handler_v1);
|
||||
- goto set_ctrl_cmd;
|
||||
}
|
||||
#endif
|
||||
- async_module_init();
|
||||
- pthread_atfork(NULL, NULL, engine_init_child_at_fork_handler);
|
||||
-
|
||||
bind_fn_uadk_alg(e);
|
||||
|
||||
-#ifdef KAE
|
||||
-set_ctrl_cmd:
|
||||
-#endif
|
||||
+ if (uadk_cipher || uadk_digest || uadk_rsa || uadk_dh || uadk_ecc) {
|
||||
+ async_module_init();
|
||||
+ pthread_atfork(NULL, NULL, engine_init_child_at_fork_handler);
|
||||
+ }
|
||||
+
|
||||
ret = ENGINE_set_ctrl_function(e, uadk_engine_ctrl);
|
||||
if (ret != 1) {
|
||||
fprintf(stderr, "failed to set ctrl function\n");
|
||||
--
|
||||
2.24.4
|
||||
|
||||
62
0023-engine-add-the-kae-log-feature.patch
Normal file
62
0023-engine-add-the-kae-log-feature.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 351422390bf42e19a802d0e282f7f85342a1f792 Mon Sep 17 00:00:00 2001
|
||||
From: Kai Ye <yekai13@huawei.com>
|
||||
Date: Tue, 22 Feb 2022 11:18:46 +0800
|
||||
Subject: [PATCH 23/23] engine: add the kae log feature
|
||||
|
||||
The original version of the kae engine supports the log system. So
|
||||
need to be enabled the kae log feature at uadk_engine.
|
||||
|
||||
example:
|
||||
insmod hisi_sec2.ko uacce_mode=2
|
||||
|
||||
export KAE_CONF_ENV=/var/log/
|
||||
cd /var/log/
|
||||
touch kae.cnf
|
||||
write:
|
||||
[LogSection]
|
||||
debug_level=error
|
||||
|
||||
the debug_level can be set to none/error/iofo/warning/debug,
|
||||
the result is stored in /var/log/kae.log
|
||||
|
||||
Signed-off-by: Kai Ye <yekai13@huawei.com>
|
||||
---
|
||||
src/e_uadk.c | 2 ++
|
||||
src/v1/uadk_v1.h | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/e_uadk.c b/src/e_uadk.c
|
||||
index 2714d5b..79ecef8 100644
|
||||
--- a/src/e_uadk.c
|
||||
+++ b/src/e_uadk.c
|
||||
@@ -205,6 +205,7 @@ static int uadk_destroy(ENGINE *e)
|
||||
hpre_destroy();
|
||||
if (uadk_dh_nosva)
|
||||
hpre_dh_destroy();
|
||||
+ kae_debug_close_log();
|
||||
#endif
|
||||
|
||||
if (uadk_cipher)
|
||||
@@ -348,6 +349,7 @@ static int bind_fn(ENGINE *e, const char *id)
|
||||
}
|
||||
|
||||
#ifdef KAE
|
||||
+ kae_debug_init_log();
|
||||
bind_fn_kae_alg(e);
|
||||
|
||||
if (uadk_cipher_nosva || uadk_digest_nosva || uadk_rsa_nosva ||
|
||||
diff --git a/src/v1/uadk_v1.h b/src/v1/uadk_v1.h
|
||||
index d921706..9ca0a94 100644
|
||||
--- a/src/v1/uadk_v1.h
|
||||
+++ b/src/v1/uadk_v1.h
|
||||
@@ -16,6 +16,7 @@
|
||||
#define UADK_V1_H
|
||||
#include "async/async_poll.h"
|
||||
#include "utils/engine_fork.h"
|
||||
+#include "utils/engine_log.h"
|
||||
|
||||
extern void sec_ciphers_free_ciphers(void);
|
||||
extern int cipher_module_init(void);
|
||||
--
|
||||
2.24.4
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Name: uadk_engine
|
||||
Summary: UADK Accelerator Engine
|
||||
Version: 1.0.0
|
||||
Release: 3
|
||||
Release: 4
|
||||
License: Apache-2.0
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
ExclusiveOS: linux
|
||||
@ -34,6 +34,11 @@ Patch0015: 0015-ecc-bugfix-about-sm2-decryption.patch
|
||||
Patch0016: 0016-dh-bugfix-about-dh-compute-key.patch
|
||||
Patch0017: 0017-ecc-bugfix-about-ecc-general-init.patch
|
||||
Patch0018: 0018-digest-fix-codecheck-warning.patch
|
||||
Patch0019: 0019-cipher-fixup-a-code-check-warning.patch
|
||||
Patch0020: 0020-rsa-fixup-a-code-check-warning.patch
|
||||
Patch0021: 0021-cipher-delete-a-redundant-branch.patch
|
||||
Patch0022: 0022-engine-fix-engine-can-t-work-under-hybrid-mode.patch
|
||||
Patch0023: 0023-engine-add-the-kae-log-feature.patch
|
||||
|
||||
%description
|
||||
This package contains the UADK Accelerator Engine
|
||||
@ -83,6 +88,9 @@ fi
|
||||
/sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
* Mon Feb 21 2022 linwenkai <linwenkai6@hisilicon.com> 1.0.0-4
|
||||
- Backport uadk engine patch for v1.0.0
|
||||
|
||||
* Wed Jan 12 2022 linwenkai <linwenkai6@hisilicon.com> 1.0.0-3
|
||||
- Backport uadk engine patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user