From 2723c0159f0f84e2169b124dca9f4eb0dc6863f9 Mon Sep 17 00:00:00 2001 From: yexiao Date: Mon, 3 Jul 2023 17:16:16 +0800 Subject: [PATCH] fix CVE-2022-4304 depend on commit 3845d4e4f3f4060582bf830303ee314637ab9dac Signed-off-by: yexiao --- ...-Fix-Timing-Oracle-in-RSA-decryption.patch | 22 +++++++++++++++---- edk2.spec | 5 ++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/0044-Fix-Timing-Oracle-in-RSA-decryption.patch b/0044-Fix-Timing-Oracle-in-RSA-decryption.patch index f2ad6ca..3e08019 100644 --- a/0044-Fix-Timing-Oracle-in-RSA-decryption.patch +++ b/0044-Fix-Timing-Oracle-in-RSA-decryption.patch @@ -1,4 +1,4 @@ -From 9f2a0cc85d0b7ef04f377e9a67515c031e76b9a4 Mon Sep 17 00:00:00 2001 +From 4f0946198959b1df82096082f6b08c8e45f9690a Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 20 Jan 2023 15:26:54 +0000 Subject: [PATCH] Fix Timing Oracle in RSA decryption @@ -23,6 +23,7 @@ Signed-off-by: yexiao CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 + .../Library/OpensslLib/OpensslLibCrypto.inf | 1 + .../OpensslLib/openssl/crypto/bn/bn_blind.c | 14 - + .../OpensslLib/openssl/crypto/bn/bn_err.c | 2 + .../OpensslLib/openssl/crypto/bn/bn_local.h | 14 + .../OpensslLib/openssl/crypto/bn/build.info | 3 +- .../openssl/crypto/bn/rsa_sup_mul.c | 614 ++++++++++++++++++ @@ -30,11 +31,11 @@ Signed-off-by: yexiao .../OpensslLib/openssl/crypto/rsa/rsa_ossl.c | 17 +- .../OpensslLib/openssl/include/crypto/bn.h | 5 + .../openssl/include/openssl/bnerr.h | 1 + - 10 files changed, 653 insertions(+), 20 deletions(-) + 11 files changed, 655 insertions(+), 20 deletions(-) create mode 100644 CryptoPkg/Library/OpensslLib/openssl/crypto/bn/rsa_sup_mul.c diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Library/OpensslLib/OpensslLib.inf -index b00bb74..ec5be59 100644 +index a010e6b..354336a 100644 --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf @@ -155,6 +155,7 @@ @@ -46,7 +47,7 @@ index b00bb74..ec5be59 100644 $(OPENSSL_PATH)/crypto/bn/bn_x931p.c $(OPENSSL_PATH)/crypto/buffer/buf_err.c diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf -index 3557711..ee68e48 100644 +index de8a9ef..03b7ddf 100644 --- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf +++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf @@ -155,6 +155,7 @@ @@ -82,6 +83,19 @@ index 76fc7eb..6e9d239 100644 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) { BN_BLINDING *ret = NULL; +diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_err.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_err.c +index dd87c15..3dd8d9a 100644 +--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_err.c ++++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_err.c +@@ -73,6 +73,8 @@ static const ERR_STRING_DATA BN_str_functs[] = { + {ERR_PACK(ERR_LIB_BN, BN_F_BN_SET_WORDS, 0), "bn_set_words"}, + {ERR_PACK(ERR_LIB_BN, BN_F_BN_STACK_PUSH, 0), "BN_STACK_push"}, + {ERR_PACK(ERR_LIB_BN, BN_F_BN_USUB, 0), "BN_usub"}, ++ {ERR_PACK(ERR_LIB_BN, BN_F_OSSL_BN_RSA_DO_UNBLIND, 0), ++ "ossl_bn_rsa_do_unblind"}, + {0, NULL} + }; + diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_local.h b/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_local.h index 8ad69cc..0965135 100644 --- a/CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_local.h diff --git a/edk2.spec b/edk2.spec index 8f32027..19076fd 100644 --- a/edk2.spec +++ b/edk2.spec @@ -5,7 +5,7 @@ Name: edk2 Version: %{stable_date} -Release: 16 +Release: 17 Summary: EFI Development Kit II License: BSD-2-Clause-Patent URL: https://github.com/tianocore/edk2 @@ -252,6 +252,9 @@ chmod +x %{buildroot}%{_bindir}/Rsa2048Sha256GenerateKeys %endif %changelog +* Fri Jul 10 2023 yexiao - 202002-17 +- fix Patch0046 + * Fri March 10 2023 yexiao - 202002-16 - fix CVE-2022-4304 -- Gitee