]> git.ipfire.org Git - thirdparty/bind9.git/commit
TLS: clear error queue before doing IO or calling SSL_get_error()
authorArtem Boldariev <artem@boldariev.com>
Tue, 4 Oct 2022 18:03:23 +0000 (21:03 +0300)
committerArtem Boldariev <artem@boldariev.com>
Wed, 12 Oct 2022 13:24:04 +0000 (16:24 +0300)
commit6789b88d258378befc528b1a8ac9a36b9c4fea1e
tree9a7a8ca00383fb0fd5fe82c6a3a465eebd40faf3
parent1c026f3286a191b56a182c141b230091a76b6aee
TLS: clear error queue before doing IO or calling SSL_get_error()

Ensure that TLS error is empty before calling SSL_get_error() or doing
SSL I/O so that the result will not get affected by prior error
statuses.

In particular, the improper error handling led to intermittent unit
test failure and, thus, could be responsible for some of the system
test failures and other intermittent TLS-related issues.

See here for more details:

https://www.openssl.org/docs/man3.0/man3/SSL_get_error.html

In particular, it mentions the following:

> The current thread's error queue must be empty before the TLS/SSL
> I/O operation is attempted, or SSL_get_error() will not work
> reliably.

As we use the result of SSL_get_error() to decide on I/O operations,
we need to ensure that it works reliably by cleaning the error queue.

TLS DNS: empty error queue before attempting I/O
lib/isc/netmgr/tlsdns.c
lib/isc/netmgr/tlsstream.c