summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-04-18 19:30:53 +0100
committerHugo Landau <hlandau@openssl.org>2023-05-12 14:46:03 +0100
commitf8636c7e85229bf780da7cf61c234695952f8cad (patch)
tree3b4804ddf353847a127f7e3fea2b78af37dc469b
parente88cdb8eb7b719803aaaef853db16abf3a4e73d1 (diff)
downloadopenssl-new-f8636c7e85229bf780da7cf61c234695952f8cad.tar.gz
QUIC Dispatch: Introduce the QUIC_XSO object
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)
-rw-r--r--include/internal/quic_ssl.h1
-rw-r--r--ssl/quic/quic_local.h16
-rw-r--r--ssl/ssl_lib.c10
-rw-r--r--ssl/ssl_local.h2
4 files changed, 15 insertions, 14 deletions
diff --git a/include/internal/quic_ssl.h b/include/internal/quic_ssl.h
index 0b6c3f298f..22e7eb5789 100644
--- a/include/internal/quic_ssl.h
+++ b/include/internal/quic_ssl.h
@@ -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);
diff --git a/ssl/quic/quic_local.h b/ssl/quic/quic_local.h
index 4d6d18ae37..fa5d8cee1e 100644
--- a/ssl/quic/quic_local.h
+++ b/ssl/quic/quic_local.h
@@ -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) \
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index ed70023bcd..8a6b9861e8 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -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? */
diff --git a/ssl/ssl_local.h b/ssl/ssl_local.h
index 044cbf5bf4..485b18fb21 100644
--- a/ssl/ssl_local.h
+++ b/ssl/ssl_local.h
@@ -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;