Move the fix of SSL_get_error() in OpenSSL 1.1.1

Moving to lsec_socket_error() coverts better 'errno == 0' with SSL_ERROR_SYSCALL.
This commit is contained in:
Bruno Silvestre 2021-05-29 10:11:02 -03:00
parent 359151144b
commit bdbc67b188
2 changed files with 11 additions and 4 deletions

View File

@ -48,4 +48,10 @@
//------------------------------------------------------------------------------
#if !defined(LIBRESSL_VERSION_NUMBER) && ((OPENSSL_VERSION_NUMBER & 0xFFFFF000L) == 0x10101000L)
#define LSEC_OPENSSL_1_1_1
#endif
//------------------------------------------------------------------------------
#endif

View File

@ -48,6 +48,11 @@ static int lsec_socket_error()
#if defined(WIN32)
return WSAGetLastError();
#else
#if defined(LSEC_OPENSSL_1_1_1)
// Bug in OpenSSL 1.1.1
if (errno == 0)
return LSEC_IO_SSL;
#endif
return errno;
#endif
}
@ -182,10 +187,6 @@ static int ssl_send(void *ctx, const char *data, size_t count, size_t *sent,
ssl->error = SSL_ERROR_SSL;
return LSEC_IO_SSL;
}
/* Return failure when SSL reports syscall error
* but errno is not set to break send operation. */
if (errno == 0)
return LSEC_IO_SSL;
if (err == 0)
return IO_CLOSED;
return lsec_socket_error();