summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_legacy.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libssl/tls13_legacy.c')
-rw-r--r--lib/libssl/tls13_legacy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libssl/tls13_legacy.c b/lib/libssl/tls13_legacy.c
index 39d7f0b3ed9..317a1cb0f51 100644
--- a/lib/libssl/tls13_legacy.c
+++ b/lib/libssl/tls13_legacy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_legacy.c,v 1.12 2020/07/30 16:57:53 jsing Exp $ */
+/* $OpenBSD: tls13_legacy.c,v 1.13 2020/09/13 15:04:35 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -35,6 +35,7 @@ tls13_legacy_wire_read(SSL *ssl, uint8_t *buf, size_t len)
}
ssl->internal->rwstate = SSL_READING;
+ errno = 0;
if ((n = BIO_read(ssl->rbio, buf, len)) <= 0) {
if (BIO_should_read(ssl->rbio))
@@ -44,6 +45,9 @@ tls13_legacy_wire_read(SSL *ssl, uint8_t *buf, size_t len)
if (n == 0)
return TLS13_IO_EOF;
+ if (ERR_peek_error() == 0 && errno != 0)
+ SYSerror(errno);
+
return TLS13_IO_FAILURE;
}
@@ -72,6 +76,7 @@ tls13_legacy_wire_write(SSL *ssl, const uint8_t *buf, size_t len)
}
ssl->internal->rwstate = SSL_WRITING;
+ errno = 0;
if ((n = BIO_write(ssl->wbio, buf, len)) <= 0) {
if (BIO_should_read(ssl->wbio))
@@ -79,6 +84,9 @@ tls13_legacy_wire_write(SSL *ssl, const uint8_t *buf, size_t len)
if (BIO_should_write(ssl->wbio))
return TLS13_IO_WANT_POLLOUT;
+ if (ERR_peek_error() == 0 && errno != 0)
+ SYSerror(errno);
+
return TLS13_IO_FAILURE;
}