]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Return channel tls from ossl_quic_accept_connection
authorNeil Horman <nhorman@openssl.org>
Wed, 8 Jan 2025 19:12:28 +0000 (14:12 -0500)
committerNeil Horman <nhorman@openssl.org>
Thu, 23 Jan 2025 16:50:42 +0000 (11:50 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26361)

ssl/quic/quic_impl.c

index 7ad493d462f8ead652a90a240f16aca9ce50e1a7..735481634bb749a6cbc33b8668b40c1c8ddda005 100644 (file)
@@ -4522,7 +4522,7 @@ SSL *ossl_quic_accept_connection(SSL *ssl, uint64_t flags)
 {
     int ret;
     QCTX ctx;
-    QUIC_CONNECTION *qc = NULL;
+    SSL *conn_ssl = NULL;
     QUIC_CHANNEL *new_ch = NULL;
     int no_block = ((flags & SSL_ACCEPT_CONNECTION_NO_BLOCK) != 0);
 
@@ -4561,15 +4561,16 @@ SSL *ossl_quic_accept_connection(SSL *ssl, uint64_t flags)
             goto out;
     }
 
-    qc = create_qc_from_incoming_conn(ctx.ql, new_ch);
-    if (qc == NULL) {
-        ossl_quic_channel_free(new_ch);
-        goto out;
-    }
-
+    /*
+     * port_make_channel pre-allocates our user_ssl for us for each newly
+     * created channel, so once we pop the new channel from the port above
+     * we just need to extract it
+     */
+    conn_ssl = ossl_quic_channel_get0_tls(new_ch);
+    conn_ssl = SSL_CONNECTION_GET_USER_SSL(SSL_CONNECTION_FROM_SSL(conn_ssl));
 out:
     qctx_unlock(&ctx);
-    return qc != NULL ? &qc->obj.ssl : NULL;
+    return conn_ssl;
 }
 
 static QUIC_CONNECTION *create_qc_from_incoming_conn(QUIC_LISTENER *ql, QUIC_CHANNEL *ch)