{
QUIC_CHANNEL *ch = arg;
- ossl_quic_channel_raise_protocol_error(ch, QUIC_ERR_CRYPTO_ERR_BEGIN + alert_code,
- 0, "handshake alert");
+ /*
+ * RFC 9001 s. 4.4: More specifically, servers MUST NOT send post-handshake
+ * TLS CertificateRequest messages, and clients MUST treat receipt of such
+ * messages as a connection error of type PROTOCOL_VIOLATION.
+ */
+ if (alert_code == SSL3_AD_UNEXPECTED_MESSAGE
+ && ch->handshake_complete
+ && ossl_quic_tls_is_cert_request(ch->qtls))
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_PROTOCOL_VIOLATION,
+ 0,
+ "Post-handshake TLS "
+ "CertificateRequest received");
+ else
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_CRYPTO_ERR_BEGIN
+ + alert_code,
+ 0, "handshake alert");
+
return 1;
}
return qtls->inerror;
}
+
+/*
+ * Returns true if the last handshake record message we processed was a
+ * CertificateRequest
+ */
+int ossl_quic_tls_is_cert_request(QUIC_TLS *qtls)
+{
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(qtls->args.s);
+
+ return sc->s3.tmp.message_type == SSL3_MT_CERTIFICATE_REQUEST;
+}