未验证 提交 18e95910 编写于 作者: O openharmony_ci 提交者: Gitee

!131 fix-CVE-2023-3817-for-OpenHarmony-3.1-Release

Merge pull request !131 from code4lala/fix-CVE-2023-3817-for-OpenHarmony-3.1-Release
...@@ -6,6 +6,22 @@ ...@@ -6,6 +6,22 @@
For a full list of changes, see the git commit log; for example, For a full list of changes, see the git commit log; for example,
https://github.com/openssl/openssl/commits/ and pick the appropriate https://github.com/openssl/openssl/commits/ and pick the appropriate
release branch. release branch.
*) Fix excessive time spent checking DH q parameter value.
The function DH_check() performs various checks on DH parameters. After
fixing CVE-2023-3446 it was discovered that a large q parameter value can
also trigger an overly long computation during some of these checks.
A correct q value, if present, cannot be larger than the modulus p
parameter, thus it is unnecessary to perform these checks if q is larger
than p.
If DH_check() is called with such q parameter value,
DH_CHECK_INVALID_Q_VALUE return flag is set and the computationally
intensive checks are skipped.
(CVE-2023-3817)
[Tomáš Mráz]
*) Fix DH_check() excessive time with over sized modulus *) Fix DH_check() excessive time with over sized modulus
The function DH_check() performs various checks on DH parameters. One of The function DH_check() performs various checks on DH parameters. One of
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
This file gives a brief overview of the major changes between each OpenSSL This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file. release. For more details please read the CHANGES file.
o Fix excessive time spent checking DH q parameter value (CVE-2023-3817)
o Fix DH_check() excessive time with over sized modulus (CVE-2023-3446) o Fix DH_check() excessive time with over sized modulus (CVE-2023-3446)
o Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466) o Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466)
o Mitigate for very slow `OBJ_obj2txt()` performance with gigantic o Mitigate for very slow `OBJ_obj2txt()` performance with gigantic
......
...@@ -97,7 +97,7 @@ int DH_check_ex(const DH *dh) ...@@ -97,7 +97,7 @@ int DH_check_ex(const DH *dh)
int DH_check(const DH *dh, int *ret) int DH_check(const DH *dh, int *ret)
{ {
int ok = 0, r; int ok = 0, r, q_good = 0;
BN_CTX *ctx = NULL; BN_CTX *ctx = NULL;
BIGNUM *t1 = NULL, *t2 = NULL; BIGNUM *t1 = NULL, *t2 = NULL;
...@@ -119,7 +119,14 @@ int DH_check(const DH *dh, int *ret) ...@@ -119,7 +119,14 @@ int DH_check(const DH *dh, int *ret)
if (t2 == NULL) if (t2 == NULL)
goto err; 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) if (BN_cmp(dh->g, BN_value_one()) <= 0)
*ret |= DH_NOT_SUITABLE_GENERATOR; *ret |= DH_NOT_SUITABLE_GENERATOR;
else if (BN_cmp(dh->g, dh->p) >= 0) else if (BN_cmp(dh->g, dh->p) >= 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册