A compilation error occurred because the wd_util.h is not an externally visible header file, so use wd.h and wd_alg_common.h here.
Signed-off-by: Qi Tao taoqi10@huawei.com --- include/drv/wd_agg_drv.h | 1 + include/wd_agg.h | 1 - include/wd_dae.h | 1 + 3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/drv/wd_agg_drv.h b/include/drv/wd_agg_drv.h index cf99a704..3d26eeb3 100644 --- a/include/drv/wd_agg_drv.h +++ b/include/drv/wd_agg_drv.h @@ -8,6 +8,7 @@
#include <asm/types.h> #include "wd_agg.h" +#include "wd_util.h"
#ifdef __cplusplus extern "C" { diff --git a/include/wd_agg.h b/include/wd_agg.h index e37023b5..aac3d406 100644 --- a/include/wd_agg.h +++ b/include/wd_agg.h @@ -8,7 +8,6 @@
#include <dlfcn.h> #include <asm/types.h> -#include "wd_util.h" #include "wd_dae.h"
#ifdef __cplusplus diff --git a/include/wd_dae.h b/include/wd_dae.h index 5f22d90c..aa9f966c 100644 --- a/include/wd_dae.h +++ b/include/wd_dae.h @@ -9,6 +9,7 @@ #include <dlfcn.h> #include <stdbool.h> #include <asm/types.h> +#include "wd_alg_common.h" #include "wd.h"
#ifdef __cplusplus
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 917b60d1..09c135e2 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -752,7 +752,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++) @@ -794,7 +794,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 be80d224..a8330741 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -648,12 +648,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;