QUIC CHANNEL: Defer transport parameter generation
authorHugo Landau <hlandau@openssl.org>
Mon, 22 Jan 2024 13:53:30 +0000 (13:53 +0000)
committerHugo Landau <hlandau@openssl.org>
Thu, 8 Feb 2024 16:50:00 +0000 (16:50 +0000)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23360)

ssl/quic/quic_channel.c

index 12be659168fbb67d1f652788dca862d100a49b39..48584ffd3a9ce5d12abea09c1255343943a9519c 100644 (file)
@@ -342,14 +342,6 @@ static int ch_init(QUIC_CHANNEL *ch)
     ossl_ackm_set_tx_max_ack_delay(ch->ackm, ossl_ms2time(ch->tx_max_ack_delay));
     ossl_ackm_set_rx_max_ack_delay(ch->ackm, ossl_ms2time(ch->rx_max_ack_delay));
 
-    /*
-     * Determine the QUIC Transport Parameters and serialize the transport
-     * parameters block. (For servers, we do this later as we must defer
-     * generation until we have received the client's transport parameters.)
-     */
-    if (!ch->is_server && !ch_generate_transport_params(ch))
-        goto err;
-
     ch_update_idle(ch);
     ossl_list_ch_insert_tail(&ch->port->channel_list, ch);
     ch->on_port_list = 1;
@@ -2584,6 +2576,15 @@ int ossl_quic_channel_start(QUIC_CHANNEL *ch)
                                           ch->qrx, ch->qtx))
         return 0;
 
+    /*
+     * Determine the QUIC Transport Parameters and serialize the transport
+     * parameters block. (For servers, we do this later as we must defer
+     * generation until we have received the client's transport parameters.)
+     */
+    if (!ch->is_server && !ch->got_local_transport_params
+        && !ch_generate_transport_params(ch))
+        return 0;
+
     /* Change state. */
     ch_record_state_transition(ch, QUIC_CHANNEL_STATE_ACTIVE);
     ch->doing_proactive_ver_neg = 0; /* not currently supported */