[PATCH] uadk: fix the issue of digest algorithm input 0 failure
From: Zhushuai Yin <yinzhushuai@huawei.com> When the input is 0, the hardware will also access the src address. In this case, src is NULL, which will cause the hardware to report an error. Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com> --- drv/hisi_sec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c index 1e95ce5..d19afe2 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -1751,7 +1751,11 @@ static int hisi_sec_digest_send(struct wd_alg_driver *drv, handle_t ctx, void *w sqe.sds_sa_type |= (__u8)(de | scene); sqe.type2.alen_ivllen |= (__u32)msg->in_bytes; - sqe.type2.data_src_addr = (__u64)(uintptr_t)msg->in; + /* avoid HW accessing address 0 when the pointer is NULL */ + if (msg->in) + sqe.type2.data_src_addr = (__u64)(uintptr_t)msg->in; + else + sqe.type2.data_src_addr = (__u64)(uintptr_t)msg->out; sqe.type2.mac_addr = (__u64)(uintptr_t)msg->out; ret = fill_digest_bd2_alg(msg, &sqe); @@ -1987,7 +1991,11 @@ static int hisi_sec_digest_send_v3(struct wd_alg_driver *drv, handle_t ctx, void } sqe.a_len_key = (__u32)msg->in_bytes; - sqe.data_src_addr = (__u64)(uintptr_t)msg->in; + /* avoid HW accessing address 0 when the pointer is NULL */ + if (msg->in) + sqe.data_src_addr = (__u64)(uintptr_t)msg->in; + else + sqe.data_src_addr = (__u64)(uintptr_t)msg->out; sqe.mac_addr = (__u64)(uintptr_t)msg->out; ret = fill_digest_bd3_alg(msg, &sqe); -- 2.43.0
participants (1)
-
ZongYu Wu