From fdcdb818f72ac625c711664d071738c3a716c7af Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Wed, 14 Feb 2024 13:27:10 -0500 Subject: [PATCH] Update to .NET SDK 7.0.116 and Runtime 7.0.16 Resolves: RHEL-23789 --- .gitignore | 1 + dotnet7.0.spec | 13 +- runtime-re-enable-implicit-rejection.patch | 169 +++++++++++++++++++++ sources | 2 +- 4 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 runtime-re-enable-implicit-rejection.patch diff --git a/.gitignore b/.gitignore index a6b1e21..7a2bb3c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ /dotnet-v7.0.113.tar.gz /dotnet-v7.0.114.tar.gz /dotnet-v7.0.115.tar.gz +/dotnet-v7.0.116.tar.gz diff --git a/dotnet7.0.spec b/dotnet7.0.spec index c0563dd..2f7e393 100644 --- a/dotnet7.0.spec +++ b/dotnet7.0.spec @@ -7,10 +7,10 @@ # until that's done, disable LTO. This has to happen before setting the flags below. %define _lto_cflags %{nil} -%global host_version 7.0.15 -%global runtime_version 7.0.15 +%global host_version 7.0.16 +%global runtime_version 7.0.16 %global aspnetcore_runtime_version %{runtime_version} -%global sdk_version 7.0.115 +%global sdk_version 7.0.116 %global sdk_feature_band_version %(echo %{sdk_version} | cut -d '-' -f 1 | sed -e 's|[[:digit:]][[:digit:]]$|00|') %global templates_version %{runtime_version} #%%global templates_version %%(echo %%{runtime_version} | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+1 }') @@ -84,6 +84,8 @@ Patch1: roslyn-analyzers-ppc64le-apphost.patch # same segment, leading to crashes involving GS cookie # https://github.com/dotnet/runtime/pull/52244 Patch2: runtime-clang-17.patch +# https://github.com/dotnet/runtime/pull/95217#issuecomment-1842799362 +Patch3: runtime-re-enable-implicit-rejection.patch %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -406,6 +408,7 @@ popd %patch1 -p1 %patch2 -p1 +%patch3 -p1 # Fix bad hardcoded path in build sed -i 's|/usr/share/dotnet|%{_libdir}/dotnet|' src/runtime/src/native/corehost/hostmisc/pal.unix.cpp @@ -618,6 +621,10 @@ rm -rf %{buildroot}%{_libdir}/dotnet/packs/NETStandard.Library.Ref/2.1.0 %changelog +* Wed Feb 14 2024 Omair Majid - 7.0.116-2 +- Update to .NET SDK 7.0.116 and Runtime 7.0.16 +- Resolves: RHEL-23789 + * Mon Jan 15 2024 Omair Majid - 7.0.115-2 - Update to .NET SDK 7.0.115 and Runtime 7.0.15 - Resolves: RHEL-19799 diff --git a/runtime-re-enable-implicit-rejection.patch b/runtime-re-enable-implicit-rejection.patch new file mode 100644 index 0000000..a2f5071 --- /dev/null +++ b/runtime-re-enable-implicit-rejection.patch @@ -0,0 +1,169 @@ +From f55ebb4597a1a931edee16283fc43a4ff33d1029 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Fri, 2 Feb 2024 12:23:28 -0500 +Subject: [PATCH] Revert "Disable implicit rejection for RSA PKCS#1 (#95217)" + +This reverts commit a314c5b3580a9fe25c59d917ff0b7594efc6f81f. + +To quote Clemens Lang: + +> [Disabling implcit rejection] re-enables a Bleichenbacher timing oracle +> attack against PKCS#1v1.5 decryption. See +> https://people.redhat.com/~hkario/marvin/ for details and +> https://github.com/dotnet/runtime/pull/95157#issuecomment-1842784399 for a +> comment by the researcher who published the vulnerability and proposed the +> change in OpenSSL. + +For more details, see: +https://github.com/dotnet/runtime/pull/95217#issuecomment-1842799362 +--- + .../RSA/EncryptDecrypt.cs | 49 ++++--------------- + .../opensslshim.h | 6 --- + .../pal_evp_pkey_rsa.c | 13 ----- + 3 files changed, 10 insertions(+), 58 deletions(-) + +diff --git a/src/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs b/src/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs +index 55a044d62a6..e72d42e87d2 100644 +--- a/src/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs ++++ b/src/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs +@@ -338,10 +338,19 @@ private void RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, bool expectSucc + Assert.Equal(TestData.HelloBytes, output); + } + +- [ConditionalFact(nameof(PlatformSupportsEmptyRSAEncryption))] ++ [ConditionalFact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] + public void RoundtripEmptyArray() + { ++ if (OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(13, 6)) ++ { ++ throw new SkipTestException("iOS prior to 13.6 does not reliably support RSA encryption of empty data."); ++ } ++ if (OperatingSystem.IsTvOS() && !OperatingSystem.IsTvOSVersionAtLeast(14, 0)) ++ { ++ throw new SkipTestException("tvOS prior to 14.0 does not reliably support RSA encryption of empty data."); ++ } ++ + using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params)) + { + void RoundtripEmpty(RSAEncryptionPadding paddingMode) +@@ -692,26 +701,6 @@ public void NotSupportedValueMethods() + } + } + +- [ConditionalTheory] +- [InlineData(new byte[] { 1, 2, 3, 4 })] +- [InlineData(new byte[0])] +- public void Decrypt_Pkcs1_ErrorsForInvalidPadding(byte[] data) +- { +- if (data.Length == 0 && !PlatformSupportsEmptyRSAEncryption) +- { +- throw new SkipTestException("Platform does not support RSA encryption of empty data."); +- } +- +- using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params)) +- { +- byte[] encrypted = Encrypt(rsa, data, RSAEncryptionPadding.Pkcs1); +- encrypted[1] ^= 0xFF; +- +- // PKCS#1, the data, and the key are all deterministic so this should always throw an exception. +- Assert.ThrowsAny(() => Decrypt(rsa, encrypted, RSAEncryptionPadding.Pkcs1)); +- } +- } +- + public static IEnumerable OaepPaddingModes + { + get +@@ -726,23 +715,5 @@ public static IEnumerable OaepPaddingModes + } + } + } +- +- public static bool PlatformSupportsEmptyRSAEncryption +- { +- get +- { +- if (OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(13, 6)) +- { +- return false; +- } +- +- if (OperatingSystem.IsTvOS() && !OperatingSystem.IsTvOSVersionAtLeast(14, 0)) +- { +- return false; +- } +- +- return true; +- } +- } + } + } +diff --git a/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.h b/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.h +index 7d5ec84cc7d..efc0d470602 100644 +--- a/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.h ++++ b/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.h +@@ -276,10 +276,8 @@ const EVP_CIPHER* EVP_chacha20_poly1305(void); + REQUIRED_FUNCTION(ERR_peek_error) \ + REQUIRED_FUNCTION(ERR_peek_error_line) \ + REQUIRED_FUNCTION(ERR_peek_last_error) \ +- REQUIRED_FUNCTION(ERR_pop_to_mark) \ + FALLBACK_FUNCTION(ERR_put_error) \ + REQUIRED_FUNCTION(ERR_reason_error_string) \ +- REQUIRED_FUNCTION(ERR_set_mark) \ + LIGHTUP_FUNCTION(ERR_set_debug) \ + LIGHTUP_FUNCTION(ERR_set_error) \ + REQUIRED_FUNCTION(EVP_aes_128_cbc) \ +@@ -334,7 +332,6 @@ const EVP_CIPHER* EVP_chacha20_poly1305(void); + REQUIRED_FUNCTION(EVP_PKCS82PKEY) \ + REQUIRED_FUNCTION(EVP_PKEY2PKCS8) \ + REQUIRED_FUNCTION(EVP_PKEY_CTX_ctrl) \ +- REQUIRED_FUNCTION(EVP_PKEY_CTX_ctrl_str) \ + REQUIRED_FUNCTION(EVP_PKEY_CTX_free) \ + REQUIRED_FUNCTION(EVP_PKEY_CTX_get0_pkey) \ + REQUIRED_FUNCTION(EVP_PKEY_CTX_new) \ +@@ -761,10 +758,8 @@ FOR_ALL_OPENSSL_FUNCTIONS + #define ERR_peek_error_line ERR_peek_error_line_ptr + #define ERR_peek_last_error ERR_peek_last_error_ptr + #define ERR_put_error ERR_put_error_ptr +-#define ERR_pop_to_mark ERR_pop_to_mark_ptr + #define ERR_reason_error_string ERR_reason_error_string_ptr + #define ERR_set_debug ERR_set_debug_ptr +-#define ERR_set_mark ERR_set_mark_ptr + #define ERR_set_error ERR_set_error_ptr + #define EVP_aes_128_cbc EVP_aes_128_cbc_ptr + #define EVP_aes_128_cfb8 EVP_aes_128_cfb8_ptr +@@ -818,7 +813,6 @@ FOR_ALL_OPENSSL_FUNCTIONS + #define EVP_PKCS82PKEY EVP_PKCS82PKEY_ptr + #define EVP_PKEY2PKCS8 EVP_PKEY2PKCS8_ptr + #define EVP_PKEY_CTX_ctrl EVP_PKEY_CTX_ctrl_ptr +-#define EVP_PKEY_CTX_ctrl_str EVP_PKEY_CTX_ctrl_str_ptr + #define EVP_PKEY_CTX_free EVP_PKEY_CTX_free_ptr + #define EVP_PKEY_CTX_get0_pkey EVP_PKEY_CTX_get0_pkey_ptr + #define EVP_PKEY_CTX_new EVP_PKEY_CTX_new_ptr +diff --git a/src/runtime/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c b/src/runtime/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c +index 043bf9f9d1e..c9ccdf33e3a 100644 +--- a/src/runtime/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c ++++ b/src/runtime/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c +@@ -67,19 +67,6 @@ static bool ConfigureEncryption(EVP_PKEY_CTX* ctx, RsaPaddingMode padding, const + { + return false; + } +- +- // OpenSSL 3.2 introduced a change where PKCS#1 RSA decryption does not fail for invalid padding. +- // If the padding is invalid, the decryption operation returns random data. +- // See https://github.com/openssl/openssl/pull/13817 for background. +- // Some Linux distributions backported this change to previous versions of OpenSSL. +- // Here we do a best-effort to set a flag to revert the behavior to failing if the padding is invalid. +- ERR_set_mark(); +- +- EVP_PKEY_CTX_ctrl_str(ctx, "rsa_pkcs1_implicit_rejection", "0"); +- +- // Undo any changes to the error queue that may have occured while configuring implicit rejection if the +- // current version does not support implicit rejection. +- ERR_pop_to_mark(); + } + else + { +-- +2.43.0 + diff --git a/sources b/sources index b271e97..b6fc803 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (dotnet-v7.0.115.tar.gz) = 1e3f9cd896ff477ad6fca7f98940610473d31fcfb3a84f04dec39eab640a15fc519a4b9194b281e3d82c63016294f09d4bf050c2e907f7d16779b370f9f643f0 +SHA512 (dotnet-v7.0.116.tar.gz) = b198af3f62484b6fb6c7f5f1658e858cfc3fbedf0f34de2cb849a6621a5aa07e99aa8729da45764133d42cc99bf39d0ee8272071f5bb8568c1c87703d86c90c1