From 020d0389396d0ee01041188a3d1b211a1d6b6c6a Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Tue, 18 Apr 2023 19:30:54 +0100 Subject: QUIC DISPATCH/APL: Implement SSL_get0_connection Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20765) --- ssl/quic/quic_impl.c | 14 ++++++++++++++ ssl/ssl_lib.c | 12 ++++++++++++ 2 files changed, 26 insertions(+) (limited to 'ssl') diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 01b99c5461..3ed03b1c86 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -1821,6 +1821,20 @@ int SSL_inject_net_dgram(SSL *s, const unsigned char *buf, return ret; } +/* + * SSL_get0_connection + * ------------------- + */ +SSL *ossl_quic_get0_connection(SSL *s) +{ + QCTX ctx; + + if (!expect_quic(s, &ctx)) + return NULL; + + return &ctx.qc->ssl; +} + /* * QUIC Front-End I/O API: SSL_CTX Management * ========================================== diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 56cbbac5f8..31905a23d4 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -7311,6 +7311,18 @@ SSL *SSL_new_stream(SSL *s, uint64_t flags) #endif } +SSL *SSL_get0_connection(SSL *s) +{ +#ifndef OPENSSL_NO_QUIC + if (!IS_QUIC(s)) + return s; + + return ossl_quic_get0_connection(s); +#else + return s; +#endif +} + int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk) { unsigned char *data = NULL; -- cgit v1.2.1