Fix ssl3_do_write() to correctly handle retries

A BIO is documented to return -1 on write retry - but sometimes they return
0. ssl3_do_write() was incorrectly handling a 0 response.

Fixes #21422

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21434)
This commit is contained in:
Matt Caswell 2023-07-12 15:50:25 +01:00 committed by Pauli
parent 149c4f9816
commit 404fb9965e

View File

@ -92,7 +92,7 @@ int ssl3_do_write(SSL_CONNECTION *s, int type)
ret = ssl3_write_bytes(ssl, type, &s->init_buf->data[s->init_off],
s->init_num, &written);
if (ret < 0)
if (ret <= 0)
return -1;
if (type == SSL3_RT_HANDSHAKE)
/*