15 Star 6 Fork 58

src-openEuler/edk2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0043-DH_check-Do-not-try-checking-q-properties-if-it-is-o.patch 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
YeXiao 提交于 2024-01-25 02:11 +08:00 . Fix some CVE
From 6b25764750b0e484d3fc09f27a75ff2428c46cd6 Mon Sep 17 00:00:00 2001
From: Tomas Mraz <[email protected]>
Date: Fri, 21 Jul 2023 11:39:41 +0200
Subject: [PATCH 09/11] DH_check(): Do not try checking q properties if it is
obviously invalid
If |q| >= |p| then the q value is obviously wrong as q
is supposed to be a prime divisor of p-1.
We check if p is overly large so this added test implies that
q is not large either when performing subsequent tests using that
q value.
Otherwise if it is too large these additional checks of the q value
such as the primality test can then trigger DoS by doing overly long
computations.
Fixes CVE-2023-3817
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
reference: https://github.com/openssl/openssl/pull/21551
Signed-off-by: yexiao <[email protected]>
---
.../Library/OpensslLib/openssl/crypto/dh/dh_check.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/dh/dh_check.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/dh/dh_check.c
index e5f9dd50..28543412 100644
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/dh/dh_check.c
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/dh/dh_check.c
@@ -97,7 +97,7 @@ int DH_check_ex(const DH *dh)
int DH_check(const DH *dh, int *ret)
{
- int ok = 0, r;
+ int ok = 0, r, q_good = 0;
BN_CTX *ctx = NULL;
BIGNUM *t1 = NULL, *t2 = NULL;
@@ -119,7 +119,14 @@ int DH_check(const DH *dh, int *ret)
if (t2 == NULL)
goto err;
- if (dh->q) {
+ if (dh->q != NULL) {
+ if (BN_ucmp(dh->p, dh->q) > 0)
+ q_good = 1;
+ else
+ *ret |= DH_CHECK_INVALID_Q_VALUE;
+ }
+
+ if (q_good) {
if (BN_cmp(dh->g, BN_value_one()) <= 0)
*ret |= DH_NOT_SUITABLE_GENERATOR;
else if (BN_cmp(dh->g, dh->p) >= 0)
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/edk2.git
[email protected]:src-openeuler/edk2.git
src-openeuler
edk2
edk2
openEuler-24.03-LTS-update-before-20241025

搜索帮助