Handle zero byte reads/writes that trigger handshakes in the TLSv1.3 stack.
authorjsing <jsing@openbsd.org>
Sun, 6 Feb 2022 16:08:14 +0000 (16:08 +0000)
committerjsing <jsing@openbsd.org>
Sun, 6 Feb 2022 16:08:14 +0000 (16:08 +0000)
commit2f68c8e7a4d61b92b7d534481fc1cc6ca76ae984
tree0255d7458cdc32a2e123cc67077709a0634dbc9f
parent920057b9e89cbdecc5bde46a6ee2835b85075aad
Handle zero byte reads/writes that trigger handshakes in the TLSv1.3 stack.

With the legaacy stack, it is possible to do a zero byte SSL_read() or
SSL_write() that triggers the handshake, but then returns zero without
SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE being flagged. This currently
works in the TLSv1.3 stack by returning TLS_IO_WANT_POLLIN or
TLS_IO_WANT_POLLOUT, which is then hidden by SSL_get_error().

However, due to upcoming changes to SSL_get_error() this will no longer be
the case. In order to maintain the existing legacy behaviour, explicitly
handle zero byte reads and writes in the TLSv1.3 stack, following
completion of a handshake.

ok inoguchi@ tb@
lib/libssl/tls13_legacy.c