libwd/0005-digest-v1-check-the-length-of-the-key-need-to-be-cha.patch
Yang Shen bd84f97fbf libwd: backport for uadk from 2.3.21 to 2.3.24
Update some patch for uadk from mainline.
To get more infomation, please visit the homepage:
https://github.com/Linaro/uadk

Signed-off-by: Yang Shen <shenyang39@huawei.com>
2022-01-10 08:56:20 +00:00

32 lines
910 B
Diff

From 6136bd700e5f5b23843a3e8aae9e3a925c37ca50 Mon Sep 17 00:00:00 2001
From: Kai Ye <yekai13@huawei.com>
Date: Tue, 14 Dec 2021 19:24:49 +0800
Subject: [PATCH 05/28] digest/v1: check the length of the key need to be
changed.
The maximum length of the key is fixed by digest spec.
Signed-off-by: Kai Ye <yekai13@huawei.com>
---
v1/wd_digest.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/v1/wd_digest.c b/v1/wd_digest.c
index d684512..aae4823 100644
--- a/v1/wd_digest.c
+++ b/v1/wd_digest.c
@@ -243,7 +243,9 @@ int wcrypto_set_digest_key(void *ctx, __u8 *key, __u16 key_len)
return -WD_EINVAL;
}
- if (key_len == 0 || key_len > MAX_HMAC_KEY_SIZE) {
+ if ((ctxt->setup.alg <= WCRYPTO_SHA224 && key_len >
+ MAX_HMAC_KEY_SIZE >> 1) || key_len == 0 ||
+ key_len > MAX_HMAC_KEY_SIZE) {
WD_ERR("%s: input key length err!\n", __func__);
return -WD_EINVAL;
}
--
2.31.1