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)
This commit is contained in:
Hugo Landau 2023-04-18 19:30:53 +01:00
parent e88cdb8eb7
commit f8636c7e85
4 changed files with 15 additions and 14 deletions

View 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);

View 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) \

View 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? */

View 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;