summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_internal.h
diff options
context:
space:
mode:
authorjsing <>2021-09-16 19:25:30 +0000
committerjsing <>2021-09-16 19:25:30 +0000
commit2d955253865a6015861bd8fe88e65001b0fcf007 (patch)
tree721c70e4e05fb8482881613ba81112e77e594f1e /src/lib/libssl/tls13_internal.h
parenta490f30feab724ed170f288710f349bf893262b4 (diff)
downloadopenbsd-2d955253865a6015861bd8fe88e65001b0fcf007.tar.gz
openbsd-2d955253865a6015861bd8fe88e65001b0fcf007.tar.bz2
openbsd-2d955253865a6015861bd8fe88e65001b0fcf007.zip
Implement flushing for TLSv1.3 handshakes.
When we finish sending a flight of records, flush the record layer output. This effectively means calling BIO_flush() on the wbio. Some things (such as apache2) have custom BIOs that perform buffering and do not actually send on BIO_write(). Without BIO_flush() the server thinks it has sent data and starts receiving records, however the client never sends records since it never received those that the server should have sent. Joint work with tb@ ok tb@
Diffstat (limited to 'src/lib/libssl/tls13_internal.h')
-rw-r--r--src/lib/libssl/tls13_internal.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index cb59634edc..20cb52ebdd 100644
--- a/src/lib/libssl/tls13_internal.h
+++ b/src/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_internal.h,v 1.93 2021/09/14 14:35:09 tb Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.94 2021/09/16 19:25:30 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -92,6 +92,7 @@ typedef void (*tls13_phh_sent_cb)(void *_cb_arg);
92typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg); 92typedef ssize_t (*tls13_read_cb)(void *_buf, size_t _buflen, void *_cb_arg);
93typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen, 93typedef ssize_t (*tls13_write_cb)(const void *_buf, size_t _buflen,
94 void *_cb_arg); 94 void *_cb_arg);
95typedef ssize_t (*tls13_flush_cb)(void *_cb_arg);
95typedef void (*tls13_handshake_message_cb)(void *_cb_arg); 96typedef void (*tls13_handshake_message_cb)(void *_cb_arg);
96typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret); 97typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret);
97typedef int (*tls13_ocsp_status_cb)(void *_cb_arg); 98typedef int (*tls13_ocsp_status_cb)(void *_cb_arg);
@@ -200,6 +201,7 @@ struct tls13_record_layer;
200struct tls13_record_layer_callbacks { 201struct tls13_record_layer_callbacks {
201 tls13_read_cb wire_read; 202 tls13_read_cb wire_read;
202 tls13_write_cb wire_write; 203 tls13_write_cb wire_write;
204 tls13_flush_cb wire_flush;
203 tls13_alert_cb alert_recv; 205 tls13_alert_cb alert_recv;
204 tls13_alert_cb alert_sent; 206 tls13_alert_cb alert_sent;
205 tls13_phh_recv_cb phh_recv; 207 tls13_phh_recv_cb phh_recv;
@@ -226,6 +228,7 @@ int tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
226 struct tls13_secret *write_key); 228 struct tls13_secret *write_key);
227ssize_t tls13_record_layer_send_pending(struct tls13_record_layer *rl); 229ssize_t tls13_record_layer_send_pending(struct tls13_record_layer *rl);
228ssize_t tls13_record_layer_phh(struct tls13_record_layer *rl, CBS *cbs); 230ssize_t tls13_record_layer_phh(struct tls13_record_layer *rl, CBS *cbs);
231ssize_t tls13_record_layer_flush(struct tls13_record_layer *rl);
229 232
230ssize_t tls13_read_handshake_data(struct tls13_record_layer *rl, uint8_t *buf, size_t n); 233ssize_t tls13_read_handshake_data(struct tls13_record_layer *rl, uint8_t *buf, size_t n);
231ssize_t tls13_write_handshake_data(struct tls13_record_layer *rl, const uint8_t *buf, 234ssize_t tls13_write_handshake_data(struct tls13_record_layer *rl, const uint8_t *buf,
@@ -283,6 +286,7 @@ struct tls13_ctx {
283 struct tls13_handshake_stage handshake_stage; 286 struct tls13_handshake_stage handshake_stage;
284 int handshake_started; 287 int handshake_started;
285 int handshake_completed; 288 int handshake_completed;
289 int need_flush;
286 int middlebox_compat; 290 int middlebox_compat;
287 int send_dummy_ccs; 291 int send_dummy_ccs;
288 int send_dummy_ccs_after; 292 int send_dummy_ccs_after;
@@ -328,6 +332,7 @@ int tls13_legacy_connect(SSL *ssl);
328int tls13_legacy_return_code(SSL *ssl, ssize_t ret); 332int tls13_legacy_return_code(SSL *ssl, ssize_t ret);
329ssize_t tls13_legacy_wire_read_cb(void *buf, size_t n, void *arg); 333ssize_t tls13_legacy_wire_read_cb(void *buf, size_t n, void *arg);
330ssize_t tls13_legacy_wire_write_cb(const void *buf, size_t n, void *arg); 334ssize_t tls13_legacy_wire_write_cb(const void *buf, size_t n, void *arg);
335ssize_t tls13_legacy_wire_flush_cb(void *arg);
331int tls13_legacy_pending(const SSL *ssl); 336int tls13_legacy_pending(const SSL *ssl);
332int tls13_legacy_read_bytes(SSL *ssl, int type, unsigned char *buf, int len, 337int tls13_legacy_read_bytes(SSL *ssl, int type, unsigned char *buf, int len,
333 int peek); 338 int peek);