From 475112fd38b66d68bc7c2bc6ec19735652cf6aae Mon Sep 17 00:00:00 2001 From: jsing Date: Sat, 27 Aug 2022 09:12:55 +0000 Subject: [PATCH] Handle SSL_do_handshake() being called before SSL_provide_quic_data(). If SSL_do_handshake() is called before SSL_provide_quic_data() has been called, the QUIC read buffer will not have been initialised. In this case we want to return TLS13_IO_WANT_POLLIN so that the QUIC stack will provide handshake data. --- lib/libssl/tls13_quic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libssl/tls13_quic.c b/lib/libssl/tls13_quic.c index ceb666ac4c6..92bbb011c82 100644 --- a/lib/libssl/tls13_quic.c +++ b/lib/libssl/tls13_quic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_quic.c,v 1.4 2022/08/21 19:39:44 jsing Exp $ */ +/* $OpenBSD: tls13_quic.c,v 1.5 2022/08/27 09:12:55 jsing Exp $ */ /* * Copyright (c) 2022 Joel Sing * @@ -58,6 +58,9 @@ tls13_quic_handshake_read_cb(void *buf, size_t n, void *arg) { struct tls13_ctx *ctx = arg; + if (ctx->hs->tls13.quic_read_buffer == NULL) + return TLS13_IO_WANT_POLLIN; + return tls_buffer_read(ctx->hs->tls13.quic_read_buffer, buf, n); } -- 2.20.1