Since OpenSSL 3.0, an "unexpected eof while reading" error is put in OpenSSL error queue when an EOF is encountered while performing a SSL read operation. The _generic_read function correctly checks for both error codes SSL_ERROR_SYSCALL (OpenSSL < 3.0) and SSL_ERROR_SSL (OpenSSL >= 3.0) to detect unexpected EOF and emulate zero-length read in this case, however it doesn't clear the error queue.
When OpenSSL 3.0+ is used, it means SSL errors can leak to other unrelated places where the SSL error queue is checked. For example it can lead to SSL connections being wrongfully closed at the same time an EOF is encountered unexpectedly on an unrelated SSL connection.
Since OpenSSL 3.0, an "unexpected eof while reading" error is put in OpenSSL error queue when an EOF is encountered while performing a SSL read operation. The
_generic_read
function correctly checks for both error codesSSL_ERROR_SYSCALL
(OpenSSL < 3.0) andSSL_ERROR_SSL
(OpenSSL >= 3.0) to detect unexpected EOF and emulate zero-length read in this case, however it doesn't clear the error queue.When OpenSSL 3.0+ is used, it means SSL errors can leak to other unrelated places where the SSL error queue is checked. For example it can lead to SSL connections being wrongfully closed at the same time an EOF is encountered unexpectedly on an unrelated SSL connection.