]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC APL: Add skeleton listener API methods
authorHugo Landau <hlandau@openssl.org>
Thu, 11 Jan 2024 09:33:36 +0000 (09:33 +0000)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 11 Sep 2024 07:32:29 +0000 (17:32 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23334)

include/internal/quic_ssl.h
include/openssl/ssl.h.in
ssl/quic/quic_impl.c
ssl/ssl_lib.c

index 4b8eb83d6f198285a7f30e143acc2e3d29ac8fbb..f0dcf59ba0b3cc77e9c0ec0caed472b2c38fe2a9 100644 (file)
@@ -77,6 +77,7 @@ __owur int ossl_quic_conn_set_initial_peer_addr(SSL *s,
                                                 const BIO_ADDR *peer_addr);
 __owur SSL *ossl_quic_conn_stream_new(SSL *s, uint64_t flags);
 __owur SSL *ossl_quic_get0_connection(SSL *s);
+__owur SSL *ossl_quic_get0_listener(SSL *s);
 __owur int ossl_quic_get_stream_type(SSL *s);
 __owur uint64_t ossl_quic_get_stream_id(SSL *s);
 __owur int ossl_quic_is_stream_local(SSL *s);
@@ -91,6 +92,9 @@ __owur int ossl_quic_get_value_uint(SSL *s, uint32_t class_, uint32_t id,
                                     uint64_t *value);
 __owur int ossl_quic_set_value_uint(SSL *s, uint32_t class_, uint32_t id,
                                     uint64_t value);
+__owur SSL *ossl_quic_accept_connection(SSL *ssl, uint64_t flags);
+__owur size_t ossl_quic_get_accept_connection_queue_len(SSL *ssl);
+__owur int ossl_quic_listen(SSL *ssl);
 
 __owur int ossl_quic_stream_reset(SSL *ssl,
                                   const SSL_STREAM_RESET_ARGS *args,
index 575c5b53fc2642ba04fb509adb7cb13cb7df7c41..707ffa6df022a764ad7a18fc0ad90baff63136a2 100644 (file)
@@ -2292,7 +2292,12 @@ __owur int SSL_set1_initial_peer_addr(SSL *s, const BIO_ADDR *peer_addr);
 __owur SSL *SSL_get0_connection(SSL *s);
 __owur int SSL_is_connection(SSL *s);
 
+__owur int SSL_is_listener(SSL *ssl);
+__owur SSL *SSL_get0_listener(SSL *s);
 __owur SSL *SSL_new_listener(SSL_CTX *ctx, uint64_t flags);
+__owur SSL *SSL_accept_connection(SSL *ssl, uint64_t flags);
+__owur size_t SSL_get_accept_connection_queue_len(SSL *ssl);
+__owur int SSL_listen(SSL *ssl);
 
 #define SSL_STREAM_TYPE_NONE        0
 #define SSL_STREAM_TYPE_READ        (1U << 0)
index f0e18bc7500369241b5177b92b89dc96a0477843..3f305e8bf71750ae3a4b083f8cfe943720b19256 100644 (file)
@@ -3003,6 +3003,20 @@ SSL *ossl_quic_get0_connection(SSL *s)
     return &ctx.qc->obj.ssl;
 }
 
+/*
+ * SSL_get0_listener
+ * -----------------
+ */
+SSL *ossl_quic_get0_listener(SSL *s)
+{
+    QCTX ctx;
+
+    if (!expect_quic(s, &ctx))
+        return NULL;
+
+    return NULL; // XXX TODO
+}
+
 /*
  * SSL_get_stream_type
  * -------------------
@@ -3992,6 +4006,21 @@ err:
     return NULL;
 }
 
+SSL *ossl_quic_accept_connection(SSL *ssl, uint64_t flags)
+{
+    return NULL; // TODO XXX
+}
+
+size_t ossl_quic_get_accept_connection_queue_len(SSL *ssl)
+{
+    return 0; // TODO XXX
+}
+
+int ossl_quic_listen(SSL *ssl)
+{
+    return 0; // TODO XXX
+}
+
 /*
  * QUIC Front-End I/O API: SSL_CTX Management
  * ==========================================
index 60ea517235fdda511e92533ac24a2041e71c3e1d..fabfba2e83faae674a19daeb454cf90f4b686ec7 100644 (file)
@@ -7534,6 +7534,23 @@ int SSL_is_connection(SSL *s)
     return SSL_get0_connection(s) == s;
 }
 
+SSL *SSL_get0_listener(SSL *s)
+{
+#ifndef OPENSSL_NO_QUIC
+    if (!IS_QUIC(s))
+        return s;
+
+    return ossl_quic_get0_listener(s);
+#else
+    return s;
+#endif
+}
+
+int SSL_is_listener(SSL *s)
+{
+    return SSL_get0_listener(s) == s;
+}
+
 int SSL_get_stream_type(SSL *s)
 {
 #ifndef OPENSSL_NO_QUIC
@@ -7729,6 +7746,42 @@ SSL *SSL_new_listener(SSL_CTX *ctx, uint64_t flags)
 #endif
 }
 
+SSL *SSL_accept_connection(SSL *ssl, uint64_t flags)
+{
+#ifndef OPENSSL_NO_QUIC
+    if (!IS_QUIC(ssl))
+        return NULL;
+
+    return ossl_quic_accept_connection(ssl, flags);
+#else
+    return NULL;
+#endif
+}
+
+size_t SSL_get_accept_connection_queue_len(SSL *ssl)
+{
+#ifndef OPENSSL_NO_QUIC
+    if (!IS_QUIC(ssl))
+        return 0;
+
+    return ossl_quic_get_accept_connection_queue_len(ssl);
+#else
+    return 0;
+#endif
+}
+
+int SSL_listen(SSL *ssl)
+{
+#ifndef OPENSSL_NO_QUIC
+    if (!IS_QUIC(ssl))
+        return 0;
+
+    return ossl_quic_listen(ssl);
+#else
+    return 0;
+#endif
+}
+
 int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk)
 {
     unsigned char *data = NULL;