QUIC CONFORMANCE: Enforce packet header reserved bits

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)
This commit is contained in:
Hugo Landau 2023-06-06 16:25:11 +01:00 committed by Pauli
parent 5b9452e037
commit 08cb9a8327

View 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: