summaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-04-18 19:30:54 +0100
committerHugo Landau <hlandau@openssl.org>2023-05-12 14:47:11 +0100
commit020d0389396d0ee01041188a3d1b211a1d6b6c6a (patch)
treec0055c5858e8593cbe3f5a80aa4ebc61e2b2923f /ssl
parent21c80696e51c2b183dad3b19aeb50fe26920f0aa (diff)
downloadopenssl-new-020d0389396d0ee01041188a3d1b211a1d6b6c6a.tar.gz
QUIC DISPATCH/APL: Implement SSL_get0_connection
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/quic/quic_impl.c14
-rw-r--r--ssl/ssl_lib.c12
2 files changed, 26 insertions, 0 deletions
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
@@ -1822,6 +1822,20 @@ int SSL_inject_net_dgram(SSL *s, const unsigned char *buf,
}
/*
+ * 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;