!50 Backport upstream uadk engine patches
From: @mmzzmm Reviewed-by: @hao-fang Signed-off-by: @hao-fang
This commit is contained in:
commit
05f88722bc
70
0008-uadk_prov_cipher-enable-padding-for-block-mode.patch
Normal file
70
0008-uadk_prov_cipher-enable-padding-for-block-mode.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From f7b123a4b93a70390c97b7118d25b1ae32fbba2a Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Fri, 22 Mar 2024 11:41:34 +0000
|
||||
Subject: [PATCH] uadk_prov_cipher: enable padding for block mode
|
||||
|
||||
Enable padding by default for block mode
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_prov_cipher.c | 29 ++++++++++++++++-------------
|
||||
1 file changed, 16 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c
|
||||
index 5cb91f6..fc41104 100644
|
||||
--- a/src/uadk_prov_cipher.c
|
||||
+++ b/src/uadk_prov_cipher.c
|
||||
@@ -679,27 +679,28 @@ static int uadk_prov_do_cipher(struct cipher_priv_ctx *priv, unsigned char *out,
|
||||
out += blksz;
|
||||
}
|
||||
|
||||
- if (nextblocks == 0)
|
||||
- goto out;
|
||||
+ if (nextblocks > 0) {
|
||||
+ if (!priv->enc && priv->pad && nextblocks == inlen)
|
||||
+ nextblocks -= blksz;
|
||||
+ outlint += nextblocks;
|
||||
+ }
|
||||
|
||||
- if (!priv->enc && priv->pad && nextblocks == inlen)
|
||||
- nextblocks -= blksz;
|
||||
+ if (nextblocks > 0) {
|
||||
+ ret = uadk_prov_hw_cipher(priv, out, outl, outsize, in, nextblocks);
|
||||
+ if (ret != 1) {
|
||||
+ fprintf(stderr, "do hw ciphers failed.\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
|
||||
- ret = uadk_prov_hw_cipher(priv, out, outl, outsize, in, nextblocks);
|
||||
- if (ret != 1) {
|
||||
- fprintf(stderr, "do hw ciphers failed.\n");
|
||||
- return ret;
|
||||
+ in += nextblocks;
|
||||
+ inlen -= nextblocks;
|
||||
}
|
||||
|
||||
- outlint += nextblocks;
|
||||
- in += nextblocks;
|
||||
- inlen -= nextblocks;
|
||||
-
|
||||
if (inlen != 0
|
||||
&& !ossl_cipher_trailingdata(priv->buf, &priv->bufsz,
|
||||
blksz, &in, &inlen))
|
||||
return 0;
|
||||
-out:
|
||||
+
|
||||
*outl = outlint;
|
||||
return inlen == 0;
|
||||
}
|
||||
@@ -1125,6 +1126,8 @@ static void *uadk_##nm##_newctx(void *provctx) \
|
||||
if (ctx->sw_ctx == NULL) \
|
||||
fprintf(stderr, "EVP_CIPHER_CTX_new failed.\n"); \
|
||||
strncpy(ctx->alg_name, #algnm, ALG_NAME_SIZE - 1); \
|
||||
+ if (strcmp(#typ, "block") == 0) \
|
||||
+ ctx->pad = 1;\
|
||||
return ctx; \
|
||||
} \
|
||||
static OSSL_FUNC_cipher_get_params_fn uadk_##nm##_get_params; \
|
||||
--
|
||||
2.43.0
|
||||
|
||||
59
0009-uadk_prov_cipher-dec-and-enc-use-same-op.patch
Normal file
59
0009-uadk_prov_cipher-dec-and-enc-use-same-op.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 4d8e10590405e7ed30a241202624146b18635030 Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Fri, 29 Mar 2024 08:54:32 +0000
|
||||
Subject: [PATCH 09/15] uadk_prov_cipher: dec and enc use same op
|
||||
|
||||
Cipher can use same op for dec and enc, so alloc 1 op.
|
||||
|
||||
Otherwise, there maybe issue in env case, where
|
||||
driver->op_type_num is used,
|
||||
drv/hisi_sec.c:621: .op_type_num = 1,
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_prov_cipher.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c
|
||||
index fc41104..91e60d8 100644
|
||||
--- a/src/uadk_prov_cipher.c
|
||||
+++ b/src/uadk_prov_cipher.c
|
||||
@@ -420,14 +420,13 @@ static void uadk_prov_cipher_ctx_init(struct cipher_priv_ctx *priv)
|
||||
struct wd_ctx_nums *ctx_set_num;
|
||||
struct wd_ctx_params cparams = {0};
|
||||
|
||||
- /* 0: enc, 1: dec */
|
||||
- ctx_set_num = calloc(2, sizeof(*ctx_set_num));
|
||||
+ ctx_set_num = calloc(1, sizeof(*ctx_set_num));
|
||||
if (!ctx_set_num) {
|
||||
fprintf(stderr, "failed to alloc ctx_set_size!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
- cparams.op_type_num = 2;
|
||||
+ cparams.op_type_num = 1;
|
||||
cparams.ctx_set_num = ctx_set_num;
|
||||
cparams.bmp = numa_allocate_nodemask();
|
||||
if (!cparams.bmp) {
|
||||
@@ -440,8 +439,6 @@ static void uadk_prov_cipher_ctx_init(struct cipher_priv_ctx *priv)
|
||||
|
||||
ctx_set_num[0].sync_ctx_num = 2;
|
||||
ctx_set_num[0].async_ctx_num = 2;
|
||||
- ctx_set_num[1].sync_ctx_num = 2;
|
||||
- ctx_set_num[1].async_ctx_num = 2;
|
||||
|
||||
ret = wd_cipher_init2_(priv->alg_name, 0, 0, &cparams);
|
||||
numa_free_nodemask(cparams.bmp);
|
||||
@@ -458,7 +455,8 @@ static void uadk_prov_cipher_ctx_init(struct cipher_priv_ctx *priv)
|
||||
}
|
||||
pthread_mutex_unlock(&cipher_mutex);
|
||||
|
||||
- params.type = priv->req.op_type;
|
||||
+ /* dec and enc use the same op */
|
||||
+ params.type = 0;
|
||||
/* Use the default numa parameters */
|
||||
params.numa_id = -1;
|
||||
priv->setup.sched_param = ¶ms;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
51
0010-kmgmt-KEYMGMT-struct-is-different-in-3.2.patch
Normal file
51
0010-kmgmt-KEYMGMT-struct-is-different-in-3.2.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 43304e09b57473e3925457612d37a321e61fc39c Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Mon, 6 May 2024 14:54:21 +0000
|
||||
Subject: [PATCH 10/15] kmgmt: KEYMGMT struct is different in 3.2
|
||||
|
||||
KEYMGMT struct is different in 3.2 causes Segmentation fault.
|
||||
Fix it by adding version check.
|
||||
|
||||
$ openssl speed -provider uadk provider rsa1024
|
||||
Segmentation fault(core dumped)
|
||||
|
||||
$ openssl version
|
||||
OpenssL 3.2.0-dev (Library: OpenssL 3.2.0-dev)
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_prov_dh.c | 2 ++
|
||||
src/uadk_prov_rsa.c | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/uadk_prov_dh.c b/src/uadk_prov_dh.c
|
||||
index 5437c46..c0adc2b 100644
|
||||
--- a/src/uadk_prov_dh.c
|
||||
+++ b/src/uadk_prov_dh.c
|
||||
@@ -248,7 +248,9 @@ typedef struct {
|
||||
OSSL_PROVIDER *prov;
|
||||
|
||||
int refcnt;
|
||||
+# if OPENSSL_VERSION_NUMBER < 0x30200000
|
||||
void *lock;
|
||||
+# endif
|
||||
|
||||
/* Constructor(s), destructor, information */
|
||||
OSSL_FUNC_keymgmt_new_fn *new;
|
||||
diff --git a/src/uadk_prov_rsa.c b/src/uadk_prov_rsa.c
|
||||
index b60de0c..7918b51 100644
|
||||
--- a/src/uadk_prov_rsa.c
|
||||
+++ b/src/uadk_prov_rsa.c
|
||||
@@ -299,7 +299,9 @@ typedef struct{
|
||||
OSSL_PROVIDER *prov;
|
||||
|
||||
int refcnt;
|
||||
+# if OPENSSL_VERSION_NUMBER < 0x30200000
|
||||
void *lock;
|
||||
+# endif
|
||||
|
||||
/* Constructor(s), destructor, information */
|
||||
OSSL_FUNC_keymgmt_new_fn *new;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
196
0011-uadk_prov_cipher-do_soft-when-hw-failed.patch
Normal file
196
0011-uadk_prov_cipher-do_soft-when-hw-failed.patch
Normal file
@ -0,0 +1,196 @@
|
||||
From 04e53b7daedf16c7d50237a54f7f9d5c5b1b044e Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Mon, 29 Apr 2024 15:14:26 +0000
|
||||
Subject: [PATCH 11/15] uadk_prov_cipher: do_soft when hw failed
|
||||
|
||||
By default, do_soft is disabled.
|
||||
To enable sw handling, need set enable_sw_offload = 1 via OPENSSL_CONF
|
||||
|
||||
For example: uadk_provider.cnf
|
||||
|
||||
openssl_conf = openssl_init
|
||||
|
||||
[openssl_init]
|
||||
providers = provider_sect
|
||||
|
||||
[provider_sect]
|
||||
uadk_provider = uadk_sect
|
||||
|
||||
[uadk_sect]
|
||||
activate = 1
|
||||
enable_sw_offload = 1
|
||||
|
||||
export OPENSSL_CONF=uadk_provider.cnf
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_prov_cipher.c | 83 +++++++++++++++++++++++++++---------------
|
||||
1 file changed, 53 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c
|
||||
index 91e60d8..fa79764 100644
|
||||
--- a/src/uadk_prov_cipher.c
|
||||
+++ b/src/uadk_prov_cipher.c
|
||||
@@ -286,6 +286,7 @@ static int uadk_prov_cipher_init(struct cipher_priv_ctx *priv,
|
||||
|
||||
if (enable_sw_offload)
|
||||
uadk_prov_cipher_sw_init(priv, key, iv);
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -639,19 +640,7 @@ static int uadk_prov_do_cipher(struct cipher_priv_ctx *priv, unsigned char *out,
|
||||
(priv->switch_flag == UADK_DO_SOFT ||
|
||||
(priv->switch_flag != UADK_DO_HW &&
|
||||
inlen <= priv->switch_threshold))) {
|
||||
- /*
|
||||
- * Using soft only if enable_sw_offload, which is set in conf file,
|
||||
- * then sw_cipher is initialzied
|
||||
- * 1. small packets
|
||||
- * 2. already choose DO_SOFT, can be hw fail case or following sw case
|
||||
- */
|
||||
- ret = uadk_prov_cipher_soft_work(priv, out, &outlint, in, inlen);
|
||||
- if (ret) {
|
||||
- *outl = outlint;
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- fprintf(stderr, "do soft ciphers failed.\n");
|
||||
+ goto do_soft;
|
||||
}
|
||||
|
||||
if (priv->bufsz != 0)
|
||||
@@ -669,6 +658,8 @@ static int uadk_prov_do_cipher(struct cipher_priv_ctx *priv, unsigned char *out,
|
||||
ret = uadk_prov_hw_cipher(priv, out, outl, outsize, priv->buf, blksz);
|
||||
if (ret != 1) {
|
||||
fprintf(stderr, "do hw ciphers failed.\n");
|
||||
+ if (priv->sw_cipher)
|
||||
+ goto do_soft;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -687,6 +678,8 @@ static int uadk_prov_do_cipher(struct cipher_priv_ctx *priv, unsigned char *out,
|
||||
ret = uadk_prov_hw_cipher(priv, out, outl, outsize, in, nextblocks);
|
||||
if (ret != 1) {
|
||||
fprintf(stderr, "do hw ciphers failed.\n");
|
||||
+ if (priv->sw_cipher)
|
||||
+ goto do_soft;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -701,6 +694,22 @@ static int uadk_prov_do_cipher(struct cipher_priv_ctx *priv, unsigned char *out,
|
||||
|
||||
*outl = outlint;
|
||||
return inlen == 0;
|
||||
+
|
||||
+do_soft:
|
||||
+ /*
|
||||
+ * Using soft only if enable_sw_offload, which is set in conf file,
|
||||
+ * then sw_cipher is initialzied
|
||||
+ * 1. small packets
|
||||
+ * 2. already choose DO_SOFT, can be hw fail case or following sw case
|
||||
+ */
|
||||
+ ret = uadk_prov_cipher_soft_work(priv, out, &outlint, in, inlen);
|
||||
+ if (ret) {
|
||||
+ *outl = outlint;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ fprintf(stderr, "do soft ciphers failed.\n");
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
void uadk_prov_destroy_cipher(void)
|
||||
@@ -756,12 +765,7 @@ static int uadk_prov_cipher_block_final(void *vctx, unsigned char *out,
|
||||
|
||||
if (priv->sw_cipher &&
|
||||
priv->switch_flag == UADK_DO_SOFT) {
|
||||
- if (!EVP_CipherFinal_ex(priv->sw_ctx, out, &sw_final_len)) {
|
||||
- fprintf(stderr, "EVP_CipherFinal_ex sw_ctx failed.\n");
|
||||
- return 0;
|
||||
- }
|
||||
- *outl = sw_final_len;
|
||||
- return 1;
|
||||
+ goto do_soft;
|
||||
}
|
||||
|
||||
if (priv->enc) {
|
||||
@@ -783,6 +787,8 @@ static int uadk_prov_cipher_block_final(void *vctx, unsigned char *out,
|
||||
ret = uadk_prov_hw_cipher(priv, out, outl, outsize, priv->buf, blksz);
|
||||
if (ret != 1) {
|
||||
fprintf(stderr, "do hw ciphers failed.\n");
|
||||
+ if (priv->sw_cipher)
|
||||
+ goto do_soft;
|
||||
return ret;
|
||||
}
|
||||
*outl = blksz;
|
||||
@@ -802,6 +808,8 @@ static int uadk_prov_cipher_block_final(void *vctx, unsigned char *out,
|
||||
ret = uadk_prov_hw_cipher(priv, priv->buf, outl, outsize, priv->buf, blksz);
|
||||
if (ret != 1) {
|
||||
fprintf(stderr, "do hw ciphers failed.\n");
|
||||
+ if (priv->sw_cipher)
|
||||
+ goto do_soft;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -820,6 +828,14 @@ static int uadk_prov_cipher_block_final(void *vctx, unsigned char *out,
|
||||
priv->bufsz = 0;
|
||||
|
||||
return 1;
|
||||
+
|
||||
+do_soft:
|
||||
+ if (!EVP_CipherFinal_ex(priv->sw_ctx, out, &sw_final_len)) {
|
||||
+ fprintf(stderr, "EVP_CipherFinal_ex sw_ctx failed.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ *outl = sw_final_len;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
static int uadk_prov_cipher_block_update(void *vctx, unsigned char *out,
|
||||
@@ -867,24 +883,31 @@ static int uadk_prov_cipher_stream_update(void *vctx, unsigned char *out,
|
||||
(priv->switch_flag == UADK_DO_SOFT ||
|
||||
(priv->switch_flag != UADK_DO_HW &&
|
||||
inl <= priv->switch_threshold))) {
|
||||
- int len = 0;
|
||||
-
|
||||
- /* have isseu if both using hw and soft partly */
|
||||
- ret = uadk_prov_cipher_soft_work(priv, out, &len, in, inl);
|
||||
- if (ret) {
|
||||
- *outl = len;
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- fprintf(stderr, "do soft ciphers failed.\n");
|
||||
+ goto do_soft;
|
||||
}
|
||||
|
||||
ret = uadk_prov_hw_cipher(priv, out, outl, outsize, in, inl);
|
||||
- if (ret != 1)
|
||||
+ if (ret != 1) {
|
||||
+ if (priv->sw_cipher)
|
||||
+ goto do_soft;
|
||||
return ret;
|
||||
+ }
|
||||
|
||||
*outl = inl;
|
||||
return 1;
|
||||
+
|
||||
+do_soft:
|
||||
+ int len = 0;
|
||||
+
|
||||
+ /* have isseu if both using hw and soft partly */
|
||||
+ ret = uadk_prov_cipher_soft_work(priv, out, &len, in, inl);
|
||||
+ if (ret) {
|
||||
+ *outl = len;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ fprintf(stderr, "do soft ciphers failed.\n");
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int uadk_prov_cipher_stream_final(void *vctx, unsigned char *out,
|
||||
--
|
||||
2.43.0
|
||||
|
||||
32
0012-uadk_digest-solve-build-warning.patch
Normal file
32
0012-uadk_digest-solve-build-warning.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From da203ad894a33f1b06c01794947532d1cb36af7d Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Tue, 30 Apr 2024 04:14:18 +0000
|
||||
Subject: [PATCH 12/15] uadk_digest: solve build warning
|
||||
|
||||
solve build warning since no {}
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_digest.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/uadk_digest.c b/src/uadk_digest.c
|
||||
index 43bbf60..9a583b4 100644
|
||||
--- a/src/uadk_digest.c
|
||||
+++ b/src/uadk_digest.c
|
||||
@@ -202,10 +202,11 @@ static int digest_soft_init(struct digest_priv_ctx *md_ctx)
|
||||
int app_datasize;
|
||||
|
||||
/* Allocate a soft ctx for hardware engine */
|
||||
- if (md_ctx->soft_ctx == NULL)
|
||||
+ if (md_ctx->soft_ctx == NULL) {
|
||||
md_ctx->soft_ctx = EVP_MD_CTX_new();
|
||||
if (md_ctx->soft_ctx == NULL)
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
ctx = md_ctx->soft_ctx;
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
33
0013-cipher-remove-aead-in-v2-temporarily-for-nginx.patch
Normal file
33
0013-cipher-remove-aead-in-v2-temporarily-for-nginx.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 2432c3f2c3014ffd3cab7ed2405e988a3a533387 Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Sat, 11 May 2024 08:10:51 +0000
|
||||
Subject: [PATCH 13/15] cipher: remove aead in v2 temporarily for nginx
|
||||
|
||||
The aead has issues causing nginx failure.
|
||||
log:
|
||||
do aead update operation failed, ret: -22, state: 0!
|
||||
|
||||
Temporarily, remove aead support to make nginx work.
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_cipher_adapter.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/uadk_cipher_adapter.c b/src/uadk_cipher_adapter.c
|
||||
index caf8af3..b4a7a0e 100644
|
||||
--- a/src/uadk_cipher_adapter.c
|
||||
+++ b/src/uadk_cipher_adapter.c
|
||||
@@ -34,9 +34,6 @@ static int cipher_hw_v2_nids[] = {
|
||||
NID_sm4_ecb,
|
||||
NID_des_ede3_cbc,
|
||||
NID_des_ede3_ecb,
|
||||
- NID_aes_128_gcm,
|
||||
- NID_aes_192_gcm,
|
||||
- NID_aes_256_gcm
|
||||
};
|
||||
|
||||
static int cipher_hw_v3_nids[] = {
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
From b840e2d5d9ff7b828b0e82047e06fa374aa6354c Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Sun, 26 May 2024 01:17:38 +0000
|
||||
Subject: [PATCH 14/15] sm2: fix build warning in openssl 3.0 of incompatible
|
||||
pointer type
|
||||
|
||||
openssl 3.0 introduce const, fixed by version check
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_sm2.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/uadk_sm2.c b/src/uadk_sm2.c
|
||||
index c0a5303..b8548d1 100644
|
||||
--- a/src/uadk_sm2.c
|
||||
+++ b/src/uadk_sm2.c
|
||||
@@ -1605,7 +1605,11 @@ static int sm2_digest_custom(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
|
||||
return EVP_DigestUpdate(mctx, z, (size_t)mdlen);
|
||||
}
|
||||
|
||||
+# if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
static int sm2_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
|
||||
+# else
|
||||
+static int sm2_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
|
||||
+# endif
|
||||
{
|
||||
struct sm2_ctx *dctx, *sctx;
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
101
0015-aead-fix-build-warning-of-storing-address-of-local-v.patch
Normal file
101
0015-aead-fix-build-warning-of-storing-address-of-local-v.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From ee30a80cf45d0c165a3a993d29ffca94a3747111 Mon Sep 17 00:00:00 2001
|
||||
From: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
Date: Sun, 26 May 2024 01:59:06 +0000
|
||||
Subject: [PATCH 15/15] aead: fix build warning of storing address of local
|
||||
variable
|
||||
|
||||
uadk_aead.c:280:33: warning: storing the address of local variable \
|
||||
'params' in '*priv.setup.sched_param' [-Wdangling-pointer=]
|
||||
|
||||
The local variable will disappear when func returns, so its address
|
||||
should not be stored.
|
||||
|
||||
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
|
||||
---
|
||||
src/uadk_aead.c | 33 +++++++++++++++++----------------
|
||||
1 file changed, 17 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/uadk_aead.c b/src/uadk_aead.c
|
||||
index c7527ed..2a5c024 100644
|
||||
--- a/src/uadk_aead.c
|
||||
+++ b/src/uadk_aead.c
|
||||
@@ -46,7 +46,6 @@
|
||||
|
||||
struct aead_priv_ctx {
|
||||
handle_t sess;
|
||||
- struct wd_aead_sess_setup setup;
|
||||
struct wd_aead_req req;
|
||||
unsigned char *data;
|
||||
unsigned char iv[AES_GCM_BLOCK_SIZE];
|
||||
@@ -262,24 +261,17 @@ static int uadk_e_init_aead_cipher(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static int uadk_e_ctx_init(struct aead_priv_ctx *priv, const unsigned char *ckey, int ckey_len)
|
||||
+static int uadk_e_ctx_init(struct aead_priv_ctx *priv, const unsigned char *ckey,
|
||||
+ int ckey_len, struct wd_aead_sess_setup *setup)
|
||||
{
|
||||
- struct sched_params params = {0};
|
||||
int ret;
|
||||
|
||||
ret = uadk_e_init_aead_cipher();
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
- params.type = priv->req.op_type;
|
||||
- ret = uadk_e_is_env_enabled("aead");
|
||||
- if (ret)
|
||||
- params.type = 0;
|
||||
-
|
||||
- params.numa_id = g_aead_engine.numa_id;
|
||||
- priv->setup.sched_param = ¶ms;
|
||||
if (!priv->sess) {
|
||||
- priv->sess = wd_aead_alloc_sess(&priv->setup);
|
||||
+ priv->sess = wd_aead_alloc_sess(setup);
|
||||
if (!priv->sess) {
|
||||
fprintf(stderr, "uadk engine failed to alloc aead session!\n");
|
||||
return 0;
|
||||
@@ -316,6 +308,8 @@ out:
|
||||
static int uadk_e_aes_gcm_init(EVP_CIPHER_CTX *ctx, const unsigned char *ckey,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
+ struct wd_aead_sess_setup setup;
|
||||
+ struct sched_params params = {0};
|
||||
struct aead_priv_ctx *priv;
|
||||
int ret, ckey_len;
|
||||
|
||||
@@ -331,10 +325,10 @@ static int uadk_e_aes_gcm_init(EVP_CIPHER_CTX *ctx, const unsigned char *ckey,
|
||||
if (iv)
|
||||
memcpy(priv->iv, iv, AES_GCM_IV_LEN);
|
||||
|
||||
- priv->setup.calg = WD_CIPHER_AES;
|
||||
- priv->setup.cmode = WD_CIPHER_GCM;
|
||||
- priv->setup.dalg = 0;
|
||||
- priv->setup.dmode = 0;
|
||||
+ setup.calg = WD_CIPHER_AES;
|
||||
+ setup.cmode = WD_CIPHER_GCM;
|
||||
+ setup.dalg = 0;
|
||||
+ setup.dmode = 0;
|
||||
|
||||
priv->req.assoc_bytes = 0;
|
||||
priv->req.out_bytes = 0;
|
||||
@@ -354,8 +348,15 @@ static int uadk_e_aes_gcm_init(EVP_CIPHER_CTX *ctx, const unsigned char *ckey,
|
||||
else
|
||||
priv->req.op_type = WD_CIPHER_DECRYPTION_DIGEST;
|
||||
|
||||
+ params.type = priv->req.op_type;
|
||||
+ ret = uadk_e_is_env_enabled("aead");
|
||||
+ if (ret)
|
||||
+ params.type = 0;
|
||||
+ params.numa_id = g_aead_engine.numa_id;
|
||||
+ setup.sched_param = ¶ms;
|
||||
+
|
||||
ckey_len = EVP_CIPHER_CTX_key_length(ctx);
|
||||
- ret = uadk_e_ctx_init(priv, ckey, ckey_len);
|
||||
+ ret = uadk_e_ctx_init(priv, ckey, ckey_len, &setup);
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Name: uadk_engine
|
||||
Summary: UADK Accelerator Engine
|
||||
Version: 1.3.0
|
||||
Release: 2
|
||||
Release: 3
|
||||
License: Apache-2.0
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
ExclusiveOS: linux
|
||||
@ -20,6 +20,14 @@ Patch0004: 0004-uadk_engine-cleanup-code-style-of-async-functions.patch
|
||||
Patch0005: 0005-cipher-cleanup-repeated-function-invoking.patch
|
||||
Patch0006: 0006-digest-add-ctx-allocation-check.patch
|
||||
Patch0007: 0007-sm2-add-ctx-allocation-check.patch
|
||||
Patch0008: 0008-uadk_prov_cipher-enable-padding-for-block-mode.patch
|
||||
Patch0009: 0009-uadk_prov_cipher-dec-and-enc-use-same-op.patch
|
||||
Patch0010: 0010-kmgmt-KEYMGMT-struct-is-different-in-3.2.patch
|
||||
Patch0011: 0011-uadk_prov_cipher-do_soft-when-hw-failed.patch
|
||||
Patch0012: 0012-uadk_digest-solve-build-warning.patch
|
||||
Patch0013: 0013-cipher-remove-aead-in-v2-temporarily-for-nginx.patch
|
||||
Patch0014: 0014-sm2-fix-build-warning-in-openssl-3.0-of-incompatible.patch
|
||||
Patch0015: 0015-aead-fix-build-warning-of-storing-address-of-local-v.patch
|
||||
|
||||
%description
|
||||
This package contains the UADK Accelerator Engine
|
||||
@ -70,14 +78,11 @@ fi
|
||||
/sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
* Sun Apr 7 2024 JiangShui Yang <yangjiangshui@h-partners.com> 1.2.0-1
|
||||
* Fri May 31 2024 Zhao Mengmeng <zhaomengmeng@kylinos.cn> 1.3.0-3
|
||||
- Backport uadk engine patch
|
||||
|
||||
* Mon Mar 20 2023 linwenkai <linwenkai6@hisilicon.com> 1.0.0-10
|
||||
- Backport uadk engine build patch
|
||||
|
||||
* Thu Feb 9 2023 linwenkai <linwenkai6@hisilicon.com> 1.0.0-9
|
||||
- Fix uadk engine build compatiable problem
|
||||
* Sun Apr 7 2024 JiangShui Yang <yangjiangshui@h-partners.com> 1.3.0-2
|
||||
- Backport uadk engine patch
|
||||
|
||||
* Mon Jan 22 2024 Zhangfei Gao <zhangfei.gao@linaro.org> 1.3.0-1
|
||||
- uadk_eingine: update to 1.3.0
|
||||
@ -94,7 +99,7 @@ fi
|
||||
* Fri Dec 16 2022 JiangShui Yang <yangjiangshui@h-partners.com> 1.0.0-8
|
||||
- Backport uadk engine patch for v1.0.1
|
||||
|
||||
* Tus Jul 26 2022 Yang Shen <shenyang39@huawei.com> 1.0.0-7
|
||||
* Tue Jul 26 2022 Yang Shen <shenyang39@huawei.com> 1.0.0-7
|
||||
- Backport uadk engine patch from v1.0.0 to v1.0.1
|
||||
|
||||
* Mon Mar 21 2022 linwenkai <linwenkai6@hisilicon.com> 1.0.0-6
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user