From 490ba1662553df5e267d9a8b1bc8e27d23b7bc95 Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Thu, 10 Mar 2022 10:22:32 +0100 Subject: [PATCH] Remove asserts checking OpenSSL error queues Fixes #44689 As of #65148, libraries use different approach to handling OpenSSL errors. The original assert which would be hit if a previous operation left errors in the queue is no longer necessary as all OpenSSL calls are prepended by `ERR_clear_error()` to make sure the latest (and most relevant) error is reported. --- .../Interop.OpenSsl.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs index ed807385c9b574..2f88ef54ee0982 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs @@ -448,10 +448,6 @@ internal static SecurityStatusPalErrorCode DoSslHandshake(SafeSslHandle context, internal static int Encrypt(SafeSslHandle context, ReadOnlySpan input, ref byte[] output, out Ssl.SslErrorCode errorCode) { -#if DEBUG - ulong assertNoError = Crypto.ErrPeekError(); - Debug.Assert(assertNoError == 0, $"OpenSsl error queue is not empty, run: 'openssl errstr {assertNoError:X}' for original error."); -#endif int retVal = Ssl.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out errorCode); if (retVal != input.Length) @@ -492,10 +488,6 @@ internal static int Encrypt(SafeSslHandle context, ReadOnlySpan input, ref internal static int Decrypt(SafeSslHandle context, Span buffer, out Ssl.SslErrorCode errorCode) { -#if DEBUG - ulong assertNoError = Crypto.ErrPeekError(); - Debug.Assert(assertNoError == 0, $"OpenSsl error queue is not empty, run: 'openssl errstr {assertNoError:X}' for original error."); -#endif BioWrite(context.InputBio!, buffer); int retVal = Ssl.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode);