From d27f5accc09bc63d81a6a972fd019e208cddc9a8 Mon Sep 17 00:00:00 2001
From: Kai Ye <yekai13@huawei.com>
Date: Tue, 14 Dec 2021 19:24:48 +0800
Subject: [PATCH 04/28] digest/v1: fixed hmac key 0 length checking

The length of keylen checking v1 and v2 should be the same.

Signed-off-by: Kai Ye <yekai13@huawei.com>
---
 v1/wd_digest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/v1/wd_digest.c b/v1/wd_digest.c
index 6b22cdd..d684512 100644
--- a/v1/wd_digest.c
+++ b/v1/wd_digest.c
@@ -243,7 +243,7 @@ int wcrypto_set_digest_key(void *ctx, __u8 *key, __u16 key_len)
 		return -WD_EINVAL;
 	}
 
-	if (key_len > MAX_HMAC_KEY_SIZE) {
+	if (key_len == 0 || key_len > MAX_HMAC_KEY_SIZE) {
 		WD_ERR("%s: input key length err!\n", __func__);
 		return -WD_EINVAL;
 	}
-- 
2.31.1

