]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC CONFORMANCE: Enforce packet header reserved bits
authorHugo Landau <hlandau@openssl.org>
Tue, 6 Jun 2023 15:25:11 +0000 (16:25 +0100)
committerPauli <pauli@openssl.org>
Sun, 16 Jul 2023 22:17:57 +0000 (08:17 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21135)

ssl/quic/quic_channel.c

index d430637a57203a573f258d6e8da5a7eb22e9ee9c..1952b7390c8515812b4247b0637735804627c49e 100644 (file)
@@ -1822,6 +1822,18 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch)
          */
         return;
 
+    /*
+     * RFC 9000 s. 17.2: "An endpoint MUST treat receipt of a packet that has a
+     * non-zero value for [the reserved bits] after removing both packet and
+     * header protection as a connection error of type PROTOCOL_VIOLATION."
+     */
+    if (ossl_quic_pkt_type_is_encrypted(ch->qrx_pkt->hdr->type)
+        && ch->qrx_pkt->hdr->reserved != 0) {
+        ossl_quic_channel_raise_protocol_error(ch, QUIC_ERR_PROTOCOL_VIOLATION,
+                                               0, "packet header reserved bits");
+        return;
+    }
+
     /* Handle incoming packet. */
     switch (ch->qrx_pkt->hdr->type) {
     case QUIC_PKT_TYPE_RETRY: