
From: Wenkai Lin <linwenkai6@hisilicon.com> For the gcm stream mode, assoc bytes should not be 0, check it to avoid hardware error. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> --- v1/drv/hisi_sec_udrv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/v1/drv/hisi_sec_udrv.c b/v1/drv/hisi_sec_udrv.c index 5dd2a696..605f3d04 100644 --- a/v1/drv/hisi_sec_udrv.c +++ b/v1/drv/hisi_sec_udrv.c @@ -2634,8 +2634,13 @@ static int fill_aead_stream_bd3(struct wd_queue *q, struct wcrypto_aead_msg *msg switch (msg->msg_state) { case WCRYPTO_AEAD_MSG_FIRST: - if (msg->cmode == WCRYPTO_CIPHER_GCM) + if (msg->cmode == WCRYPTO_CIPHER_GCM) { + if (unlikely(!msg->assoc_bytes)) { + WD_ERR("invalid: first bd assoc bytes is 0!\n"); + return -WD_EINVAL; + } fill_gcm_first_bd3(msg, sqe); + } break; case WCRYPTO_AEAD_MSG_MIDDLE: if (msg->cmode == WCRYPTO_CIPHER_GCM) -- 2.33.0