QUIC Dispatch: Introduce the QUIC_XSO object
authorHugo Landau <hlandau@openssl.org>
Tue, 18 Apr 2023 18:30:53 +0000 (19:30 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 12 May 2023 13:46:03 +0000 (14:46 +0100)
The QUIC_XSO (external stream object) is to a QUIC stream what a
QUIC_CONNECTION is to a QUIC connection. Both are SSL objects. The
QUIC_CONNECTION type is the internal representation of a QUIC connection
SSL object (QCSO) and the QUIC_XSO type is the internal representation
of a QUIC stream SSL object (QSSO) type. The name QUIC_XSO has been
chosen to be distinct from the existing QUIC_STREAM type which is our
existing internal stream type. QUIC_XSO is to a QUIC_STREAM what
QUIC_CONNECTION is to a QUIC_CHANNEL; in other words, QUIC_CONNECTION
and QUIC_XSO objects form part of the API personality layer, whereas
QUIC_CHANNEL and QUIC_STREAM objects form part of the QUIC core and are
distinct from the API personality layer.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)

include/internal/quic_ssl.h
ssl/quic/quic_local.h
ssl/ssl_lib.c
ssl/ssl_local.h

index 0b6c3f298f94b4a72f7c1b9fd98fea9b0a418e9d..22e7eb5789112001a8f7e7553c9f7b53ef98afdb 100644 (file)
@@ -38,6 +38,7 @@ __owur const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u);
 int ossl_quic_renegotiate_check(SSL *ssl, int initok);
 
 typedef struct quic_conn_st QUIC_CONNECTION;
+typedef struct quic_xso_st QUIC_XSO;
 
 int ossl_quic_do_handshake(QUIC_CONNECTION *qc);
 void ossl_quic_set_connect_state(QUIC_CONNECTION *qc);
index 4d6d18ae37de7e4bacd12b02e3c378186690e051..fa5d8cee1ee243ccd0f30a0531bf26f1f2864d1d 100644 (file)
@@ -167,11 +167,11 @@ void ossl_quic_conn_on_remote_conn_close(QUIC_CONNECTION *qc,
          ? (c QUIC_CONNECTION *)(ssl)            \
          : NULL))
 
-#  define QUIC_STREAM_FROM_SSL_int(ssl, c)       \
+#  define QUIC_XSO_FROM_SSL_int(ssl, c)          \
      ((ssl) == NULL ? NULL                       \
       : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION \
-          || (ssl)->type == SSL_TYPE_QUIC_STREAM \
-         ? (c QUIC_STREAM *)(ssl)                \
+          || (ssl)->type == SSL_TYPE_QUIC_XSO    \
+         ? (c QUIC_XSO *)(ssl)                   \
          : NULL))
 
 #  define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c)               \
@@ -181,7 +181,7 @@ void ossl_quic_conn_on_remote_conn_close(QUIC_CONNECTION *qc,
          : NULL))
 # else
 #  define QUIC_CONNECTION_FROM_SSL_int(ssl, c) NULL
-#  define QUIC_STREAM_FROM_SSL_int(ssl, c) NULL
+#  define QUIC_XSO_FROM_SSL_int(ssl, c) NULL
 #  define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c) NULL
 # endif
 
@@ -189,10 +189,10 @@ void ossl_quic_conn_on_remote_conn_close(QUIC_CONNECTION *qc,
     QUIC_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
 # define QUIC_CONNECTION_FROM_CONST_SSL(ssl) \
     QUIC_CONNECTION_FROM_SSL_int(ssl, const)
-# define QUIC_STREAM_FROM_SSL(ssl) \
-    QUIC_STREAM_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
-# define QUIC_STREAM_FROM_CONST_SSL(ssl) \
-    QUIC_STREAM_FROM_SSL_int(ssl, const)
+# define QUIC_XSO_FROM_SSL(ssl) \
+    QUIC_XSO_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define QUIC_XSO_FROM_CONST_SSL(ssl) \
+    QUIC_XSO_FROM_SSL_int(ssl, const)
 # define SSL_CONNECTION_FROM_QUIC_SSL(ssl) \
     SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
 # define SSL_CONNECTION_FROM_CONST_QUIC_SSL(ssl) \
index ed70023bcdc6efb95df26906c3415e4fef05b1a5..8a6b9861e8f4e50b65b3f300426aee8f56ca7bb2 100644 (file)
@@ -931,7 +931,7 @@ int SSL_is_dtls(const SSL *s)
     SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
 
 #ifndef OPENSSL_NO_QUIC
-    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_STREAM)
+    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
         return 0;
 #endif
 
@@ -946,7 +946,7 @@ int SSL_is_tls(const SSL *s)
     SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
 
 #ifndef OPENSSL_NO_QUIC
-    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_STREAM)
+    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
         return 0;
 #endif
 
@@ -959,7 +959,7 @@ int SSL_is_tls(const SSL *s)
 int SSL_is_quic(const SSL *s)
 {
 #ifndef OPENSSL_NO_QUIC
-    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_STREAM)
+    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
         return 1;
 #endif
     return 0;
@@ -4774,7 +4774,7 @@ const char *SSL_get_version(const SSL *s)
 
 #ifndef OPENSSL_NO_QUIC
     /* We only support QUICv1 - so if its QUIC its QUICv1 */
-    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_STREAM)
+    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
         return "QUICv1";
 #endif
 
@@ -5116,7 +5116,7 @@ int SSL_version(const SSL *s)
 
 #ifndef OPENSSL_NO_QUIC
     /* We only support QUICv1 - so if its QUIC its QUICv1 */
-    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_STREAM)
+    if (s->type == SSL_TYPE_QUIC_CONNECTION || s->type == SSL_TYPE_QUIC_XSO)
         return OSSL_QUIC1_VERSION;
 #endif
     /* TODO(QUIC): Do we want to report QUIC version this way instead? */
index 044cbf5bf421f3339caa5ab64710c3c7c721c44f..485b18fb21db4007090e1b86105de4b3859719a0 100644 (file)
@@ -1191,7 +1191,7 @@ typedef struct cert_pkey_st CERT_PKEY;
 
 #define SSL_TYPE_SSL_CONNECTION  0
 #define SSL_TYPE_QUIC_CONNECTION 1
-#define SSL_TYPE_QUIC_STREAM     2
+#define SSL_TYPE_QUIC_XSO        2
 
 struct ssl_st {
     int type;