if (!qrx_validate_hdr(qrx, rxe))
goto malformed;
- /*
- * We automatically discard INITIAL keys when successfully decrypting a
- * HANDSHAKE packet.
- */
- if (enc_level == QUIC_ENC_LEVEL_HANDSHAKE)
- ossl_qrl_enc_level_set_discard(&qrx->el_set, QUIC_ENC_LEVEL_INITIAL);
-
/*
* The AAD data is the entire (unprotected) packet header including the PN.
* The packet header has been unprotected in place, so we can just reuse the
rxe->hdr.key_phase))
goto malformed;
+ /*
+ * We automatically discard INITIAL keys when successfully decrypting a
+ * HANDSHAKE packet.
+ */
+ if (enc_level == QUIC_ENC_LEVEL_HANDSHAKE)
+ ossl_qrl_enc_level_set_discard(&qrx->el_set, QUIC_ENC_LEVEL_INITIAL);
+
/*
* At this point, we have successfully authenticated the AEAD tag and no
* longer need to worry about exposing the Key Phase bit in timing channels.