From 9f0ade7c470b0ee9be3c25d38bbec7d05ca4237e Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Wed, 4 Jan 2023 07:24:08 +0000 Subject: [PATCH] QUIC: Minor cleanup Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/19703) --- ssl/quic/quic_channel.c | 32 ++++++++++++++++++-------------- ssl/quic/quic_demux.c | 2 -- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 346ecde6330..9d740416a7e 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -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; diff --git a/ssl/quic/quic_demux.c b/ssl/quic/quic_demux.c index 810be8af03b..376a15244ee 100644 --- a/ssl/quic/quic_demux.c +++ b/ssl/quic/quic_demux.c @@ -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); -- 2.47.2