diff options
author | jsing <> | 2020-11-03 17:41:39 +0000 |
---|---|---|
committer | jsing <> | 2020-11-03 17:41:39 +0000 |
commit | a706869ac70670ecb35789f6076ad655477e08e6 (patch) | |
tree | 0c5fb43083efa0cdcdcc5ead4355aab342727ce6 /src/lib | |
parent | b7e071d468fd49ea9bbc98532eb8d0fff0bf974a (diff) | |
download | openbsd-a706869ac70670ecb35789f6076ad655477e08e6.tar.gz openbsd-a706869ac70670ecb35789f6076ad655477e08e6.tar.bz2 openbsd-a706869ac70670ecb35789f6076ad655477e08e6.zip |
Only check BIO_should_read() on read and BIO_should_write() on write.
The TLSv1.3 code that drives a BIO currently checks BIO_should_read()
after BIO_write() and BIO_should_write() after BIO_read(), which was
modelled on SSL_get_error(). However, there are certain cases where
this can confuse the caller - primarily where the same BIO is being
used for both read and write and the caller is manipulating the retry
flags. SSL_get_error() tends avoids this issue by relying on another
layer of state tracking.
Unfortunately haproxy hits this situation - it has its own BIO_METHOD,
the same BIO is used for both read and write and it manipulates the
retry flags - resulting in it stalling.
Issued noted by Thorsten Lockert <tholo@tzecmaun.org>
ok beck@ tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/tls13_legacy.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lib/libssl/tls13_legacy.c b/src/lib/libssl/tls13_legacy.c index 463d56372e..81a317d4a5 100644 --- a/src/lib/libssl/tls13_legacy.c +++ b/src/lib/libssl/tls13_legacy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_legacy.c,v 1.18 2020/10/11 12:45:52 guenther Exp $ */ | 1 | /* $OpenBSD: tls13_legacy.c,v 1.19 2020/11/03 17:41:39 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -36,8 +36,6 @@ tls13_legacy_wire_read(SSL *ssl, uint8_t *buf, size_t len) | |||
36 | if ((n = BIO_read(ssl->rbio, buf, len)) <= 0) { | 36 | if ((n = BIO_read(ssl->rbio, buf, len)) <= 0) { |
37 | if (BIO_should_read(ssl->rbio)) | 37 | if (BIO_should_read(ssl->rbio)) |
38 | return TLS13_IO_WANT_POLLIN; | 38 | return TLS13_IO_WANT_POLLIN; |
39 | if (BIO_should_write(ssl->rbio)) | ||
40 | return TLS13_IO_WANT_POLLOUT; | ||
41 | if (n == 0) | 39 | if (n == 0) |
42 | return TLS13_IO_EOF; | 40 | return TLS13_IO_EOF; |
43 | 41 | ||
@@ -75,8 +73,6 @@ tls13_legacy_wire_write(SSL *ssl, const uint8_t *buf, size_t len) | |||
75 | errno = 0; | 73 | errno = 0; |
76 | 74 | ||
77 | if ((n = BIO_write(ssl->wbio, buf, len)) <= 0) { | 75 | if ((n = BIO_write(ssl->wbio, buf, len)) <= 0) { |
78 | if (BIO_should_read(ssl->wbio)) | ||
79 | return TLS13_IO_WANT_POLLIN; | ||
80 | if (BIO_should_write(ssl->wbio)) | 76 | if (BIO_should_write(ssl->wbio)) |
81 | return TLS13_IO_WANT_POLLOUT; | 77 | return TLS13_IO_WANT_POLLOUT; |
82 | 78 | ||