Skip to content

Commit

Permalink
Remove asserts checking OpenSSL error queues (#66443)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rzikm committed Mar 10, 2022
1 parent 801e81e commit 5c0c317
Showing 1 changed file with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,6 @@ internal static SecurityStatusPalErrorCode DoSslHandshake(SafeSslHandle context,

internal static int Encrypt(SafeSslHandle context, ReadOnlySpan<byte> 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)
Expand Down Expand Up @@ -521,10 +517,6 @@ internal static int Encrypt(SafeSslHandle context, ReadOnlySpan<byte> input, ref

internal static int Decrypt(SafeSslHandle context, Span<byte> 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);
Expand Down

0 comments on commit 5c0c317

Please sign in to comment.