summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-10-17 16:26:13 +0100
committerTomas Mraz <tomas@openssl.org>2023-10-19 11:53:07 +0200
commit56e303259ed48884c914fe24b354e9cc7b7532c3 (patch)
treedabc76fa636bea8a0f8742480247cbf274f9a6f4
parentfa9e6ad46860ea92aa2e1ba997b20c6dff76b42c (diff)
Ignore retry packets that arrive too late
RFC 9000 s 17.2.5.2 says > After the client has received and processed an Initial or Retry packet > from the server, it MUST discard any subsequent Retry packets that it > receives. We were checking for multiple Retry packets, but not if we had already processed an Initial packet. Fixes the assertion failure noted in https://github.com/openssl/openssl/pull/22368#issuecomment-1765618884 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22411)
-rw-r--r--ssl/quic/quic_channel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c
index 3da0caa4ea..a6ed14664e 100644
--- a/ssl/quic/quic_channel.c
+++ b/ssl/quic/quic_channel.c
@@ -2220,6 +2220,14 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch)
*/
return;
+ /*
+ * RFC 9000 s 17.2.5.2: After the client has received and processed an
+ * Initial or Retry packet from the server, it MUST discard any
+ * subsequent Retry packets that it receives.
+ */
+ if (ch->have_received_enc_pkt)
+ return;
+
if (ch->qrx_pkt->hdr->len <= QUIC_RETRY_INTEGRITY_TAG_LEN)
/* Packets with zero-length Retry Tokens are invalid. */
return;