]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC: Minor cleanup
authorHugo Landau <hlandau@openssl.org>
Wed, 4 Jan 2023 07:24:08 +0000 (07:24 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 13 Jan 2023 13:20:35 +0000 (13:20 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19703)

ssl/quic/quic_channel.c
ssl/quic/quic_demux.c

index 346ecde6330358a01318f9231c3e3e33ee1998d4..9d740416a7ed734aca40b17066f4f2ac51604c76 100644 (file)
@@ -500,9 +500,9 @@ static int ch_on_handshake_yield_secret(uint32_t enc_level, int direction,
         /* TX */
         if (enc_level <= ch->tx_enc_level)
             /*
-            * Does not make sense for us to try and provision an EL we have already
-            * attained.
-            */
+             * Does not make sense for us to try and provision an EL we have already
+             * attained.
+             */
             return 0;
 
         if (!ossl_qtx_provide_secret(ch->qtx, enc_level,
@@ -515,15 +515,15 @@ static int ch_on_handshake_yield_secret(uint32_t enc_level, int direction,
         /* RX */
         if (enc_level <= ch->rx_enc_level)
             /*
-            * Does not make sense for us to try and provision an EL we have already
-            * attained.
-            */
+             * Does not make sense for us to try and provision an EL we have already
+             * attained.
+             */
             return 0;
 
         /*
-        * Ensure all crypto streams for previous ELs are now empty of available
-        * data.
-        */
+         * Ensure all crypto streams for previous ELs are now empty of available
+         * data.
+         */
         for (i = QUIC_ENC_LEVEL_INITIAL; i < enc_level; ++i)
             if (!crypto_ensure_empty(ch->crypto_recv[ossl_quic_enc_level_to_pn_space(i)])) {
                 /* Protocol violation (RFC 9001 s. 4.1.3) */
@@ -1036,6 +1036,8 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
          * If the handshake layer gave us a new secret, we need to do RX again
          * because packets that were not previously processable and were
          * deferred might now be processable.
+         *
+         * TODO(QUIC): Consider handling this in the yield_secret callback.
          */
     } while (ch->have_new_rx_secret);
 
@@ -1162,11 +1164,13 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch)
     switch (ch->qrx_pkt->hdr->type) {
         case QUIC_PKT_TYPE_RETRY:
             if (ch->doing_retry)
-                /* It is not allowed to ask a client to do a retry more than
-                 * once. */
+                /*
+                 * It is not allowed to ask a client to do a retry more than
+                 * once.
+                 */
                 return;
 
-            /* TODO if server */
+            /* TODO(QUIC): handle server mode */
 
             if (ch->qrx_pkt->hdr->len <= QUIC_RETRY_INTEGRITY_TAG_LEN)
                 /* Packets with zero-length Retry Tokens are invalid. */
@@ -1198,7 +1202,7 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch)
             break;
 
         case QUIC_PKT_TYPE_0RTT:
-            /* TODO if server */
+            /* TODO(QQUIC): handle if server */
             /* Clients should never receive 0-RTT packets */
             break;
 
@@ -1360,7 +1364,7 @@ int ossl_quic_channel_set_net_wbio(QUIC_CHANNEL *ch, BIO *net_wbio)
 
 int ossl_quic_channel_start(QUIC_CHANNEL *ch)
 {
-    /* TODO SERVER */
+    /* TODO(QUIC): handle server */
     if (ch->state != QUIC_CHANNEL_STATE_IDLE)
         /* Calls to connect are idempotent */
         return 1;
index 810be8af03b822a746c5e930a5fa12e6f3211ad7..376a15244ee2a5d5808807bcba7f855aabb9e1b2 100644 (file)
@@ -541,8 +541,6 @@ int ossl_quic_demux_inject(QUIC_DEMUX *demux,
         return 0;
 
     urxe = ossl_list_urxe_head(&demux->urx_free);
-    if (buf_len > urxe->alloc_len)
-        return 0;
 
     assert(urxe->demux_state == URXE_DEMUX_STATE_FREE);