diff options
author | Hugo Landau <hlandau@openssl.org> | 2024-03-22 07:24:05 +0000 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2024-04-19 09:31:30 +0100 |
commit | fc6e5374bc980790112e18339dbb13645b207dfb (patch) | |
tree | b34fa77211b110fcd69e3190f817dadd9ef88039 | |
parent | 8dbccd330f76b27d1bdc62cf3ee26dec6fba33e9 (diff) |
QUIC: Avoid ticking before a connection is established
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23995)
-rw-r--r-- | ssl/quic/quic_channel.c | 5 | ||||
-rw-r--r-- | ssl/quic/quic_tls.c | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 2daf112f08..3fa7a8c8f4 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -1800,7 +1800,6 @@ static int ch_generate_transport_params(QUIC_CHANNEL *ch) ch->local_transport_params = (unsigned char *)buf_mem->data; buf_mem->data = NULL; - if (!ossl_quic_tls_set_transport_params(ch->qtls, ch->local_transport_params, buf_len)) goto err; @@ -1870,6 +1869,10 @@ void ossl_quic_channel_subtick(QUIC_CHANNEL *ch, QUIC_TICK_RESULT *res, * - determine the time at which we should next be ticked. */ + /* Nothing to do yet if connection has not been started. */ + if (ch->state == QUIC_CHANNEL_STATE_IDLE) + return; + /* If we are in the TERMINATED state, there is nothing to do. */ if (ossl_quic_channel_is_terminated(ch)) { res->net_read_desired = 0; diff --git a/ssl/quic/quic_tls.c b/ssl/quic/quic_tls.c index b2ad28e5d1..d705f77678 100644 --- a/ssl/quic/quic_tls.c +++ b/ssl/quic/quic_tls.c @@ -52,6 +52,9 @@ struct quic_tls_st { /* Set if the handshake has completed */ unsigned int complete : 1; + + /* Set if we have consumed the local transport parameters yet. */ + unsigned int local_transport_params_consumed : 1; }; struct ossl_record_layer_st { @@ -606,6 +609,7 @@ static int add_transport_params_cb(SSL *s, unsigned int ext_type, *out = qtls->local_transport_params; *outlen = qtls->local_transport_params_len; + qtls->local_transport_params_consumed = 1; return 1; } @@ -833,6 +837,9 @@ int ossl_quic_tls_set_transport_params(QUIC_TLS *qtls, const unsigned char *transport_params, size_t transport_params_len) { + if (qtls->local_transport_params_consumed) + return 0; + qtls->local_transport_params = transport_params; qtls->local_transport_params_len = transport_params_len; return 1; |