This series backport upstream 8 patches, it also fix spec file error by removing wrong changelog and fixing wrong date. Signed-off-by: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
71 lines
2.0 KiB
Diff
71 lines
2.0 KiB
Diff
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
|
|
|