Handle SSL_do_handshake() being called before SSL_provide_quic_data().
authorjsing <jsing@openbsd.org>
Sat, 27 Aug 2022 09:12:55 +0000 (09:12 +0000)
committerjsing <jsing@openbsd.org>
Sat, 27 Aug 2022 09:12:55 +0000 (09:12 +0000)
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

index ceb666a..92bbb01 100644 (file)
@@ -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 <jsing@openbsd.org>
  *
@@ -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);
 }