Skip to content

Commit 5c0c317

Browse files
authored
Remove asserts checking OpenSSL error queues (#66443)
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.
1 parent 801e81e commit 5c0c317

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

  • src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native

src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,6 @@ internal static SecurityStatusPalErrorCode DoSslHandshake(SafeSslHandle context,
477477

478478
internal static int Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref byte[] output, out Ssl.SslErrorCode errorCode)
479479
{
480-
#if DEBUG
481-
ulong assertNoError = Crypto.ErrPeekError();
482-
Debug.Assert(assertNoError == 0, $"OpenSsl error queue is not empty, run: 'openssl errstr {assertNoError:X}' for original error.");
483-
#endif
484480
int retVal = Ssl.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out errorCode);
485481

486482
if (retVal != input.Length)
@@ -521,10 +517,6 @@ internal static int Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref
521517

522518
internal static int Decrypt(SafeSslHandle context, Span<byte> buffer, out Ssl.SslErrorCode errorCode)
523519
{
524-
#if DEBUG
525-
ulong assertNoError = Crypto.ErrPeekError();
526-
Debug.Assert(assertNoError == 0, $"OpenSsl error queue is not empty, run: 'openssl errstr {assertNoError:X}' for original error.");
527-
#endif
528520
BioWrite(context.InputBio!, buffer);
529521

530522
int retVal = Ssl.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode);

0 commit comments

Comments
 (0)