58 lines
1.9 KiB
Diff
58 lines
1.9 KiB
Diff
|
|
From 710eef70b45b48e040022181fd28cc65883a8fb1 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Qi Tao <taoqi10@huawei.com>
|
||
|
|
Date: Fri, 1 Nov 2024 16:19:31 +0800
|
||
|
|
Subject: [PATCH 38/39] uadk: fix code compatibility issue
|
||
|
|
|
||
|
|
The code check "req->in_bytes != req->out_bytes" is incompatible
|
||
|
|
with the software of other versions. Therefore, the check is deleted
|
||
|
|
and the size check of out_bytes and iv_bytes is added to the driver.
|
||
|
|
|
||
|
|
Signed-off-by: Qi Tao <taoqi10@huawei.com>
|
||
|
|
---
|
||
|
|
drv/hisi_sec.c | 4 ++--
|
||
|
|
wd_cipher.c | 6 ------
|
||
|
|
2 files changed, 2 insertions(+), 8 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c
|
||
|
|
index bdde39f..10db124 100644
|
||
|
|
--- a/drv/hisi_sec.c
|
||
|
|
+++ b/drv/hisi_sec.c
|
||
|
|
@@ -751,7 +751,7 @@ static void update_iv(struct wd_cipher_msg *msg)
|
||
|
|
msg->iv_bytes, msg->iv_bytes);
|
||
|
|
break;
|
||
|
|
case WD_CIPHER_OFB:
|
||
|
|
- if (msg->in_bytes < msg->iv_bytes)
|
||
|
|
+ if (msg->in_bytes < msg->iv_bytes || msg->out_bytes < msg->iv_bytes)
|
||
|
|
break;
|
||
|
|
/* The iv_bytes has been checked and it is not greater than AES_BLOCK_SIZE. */
|
||
|
|
for (i = 0; i < msg->iv_bytes; i++)
|
||
|
|
@@ -793,7 +793,7 @@ static void update_iv_sgl(struct wd_cipher_msg *msg)
|
||
|
|
break;
|
||
|
|
case WD_CIPHER_OFB:
|
||
|
|
/* The iv_bytes has been checked and it is not greater than AES_BLOCK_SIZE. */
|
||
|
|
- if (msg->in_bytes >= msg->iv_bytes) {
|
||
|
|
+ if (msg->in_bytes >= msg->iv_bytes && msg->out_bytes >= msg->iv_bytes) {
|
||
|
|
hisi_qm_sgl_copy(in, msg->in,
|
||
|
|
msg->in_bytes - msg->iv_bytes,
|
||
|
|
msg->iv_bytes, COPY_SGL_TO_PBUFF);
|
||
|
|
diff --git a/wd_cipher.c b/wd_cipher.c
|
||
|
|
index 0e5de25..ec6fb15 100644
|
||
|
|
--- a/wd_cipher.c
|
||
|
|
+++ b/wd_cipher.c
|
||
|
|
@@ -646,12 +646,6 @@ static int wd_cipher_check_params(handle_t h_sess,
|
||
|
|
return -WD_EINVAL;
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (unlikely(req->in_bytes != req->out_bytes)) {
|
||
|
|
- WD_ERR("cipher set out_bytes is error, size = %u\n",
|
||
|
|
- req->out_bytes);
|
||
|
|
- return -WD_EINVAL;
|
||
|
|
- }
|
||
|
|
-
|
||
|
|
ret = cipher_in_len_check(h_sess, req);
|
||
|
|
if (unlikely(ret))
|
||
|
|
return ret;
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|