Refactor how TLS versions get enabled
This brings it closer in line to how QUIC_VERSION_99 is handled and sets up the
flag to be switched to a reloadable flag (blocked on being enabled). In particular,
AllSupportedVersions() now returns versions that include PROTOCOL_TLS1_3 for the
handshake_protocol.
When a TLS version is in use, it is safe to assume that
ParsedQuicVersion::KnowsWhichDecrypterToUse always returns true. This is because
KnowsWhichDecrypterToUse is enabled for QUIC_VERSION_47 and above, while TLS versions
only exist when CRYPTO frames are in use, which is currently only transport version 99.
gfe-relnote: refactor of TLS version code; protected by quic_supports_tls_handshake
PiperOrigin-RevId: 250599516
Change-Id: Ibfe68d74089ce29edeee219671c81e1643702000
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 6873edd..9100f32 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -30,12 +30,7 @@
ParsedQuicVersion::ParsedQuicVersion(HandshakeProtocol handshake_protocol,
QuicTransportVersion transport_version)
: handshake_protocol(handshake_protocol),
- transport_version(transport_version) {
- if (handshake_protocol == PROTOCOL_TLS1_3 &&
- !GetQuicFlag(FLAGS_quic_supports_tls_handshake)) {
- QUIC_BUG << "TLS use attempted when not enabled";
- }
-}
+ transport_version(transport_version) {}
bool ParsedQuicVersion::KnowsWhichDecrypterToUse() const {
return transport_version >= QUIC_VERSION_47 ||
@@ -120,10 +115,8 @@
}
ParsedQuicVersion ParseQuicVersionLabel(QuicVersionLabel version_label) {
- std::vector<HandshakeProtocol> protocols = {PROTOCOL_QUIC_CRYPTO};
- if (GetQuicFlag(FLAGS_quic_supports_tls_handshake)) {
- protocols.push_back(PROTOCOL_TLS1_3);
- }
+ std::vector<HandshakeProtocol> protocols = {PROTOCOL_QUIC_CRYPTO,
+ PROTOCOL_TLS1_3};
for (QuicTransportVersion version : kSupportedTransportVersions) {
for (HandshakeProtocol handshake : protocols) {
if (version_label ==
@@ -185,10 +178,6 @@
ParsedQuicVersionVector AllSupportedVersions() {
ParsedQuicVersionVector supported_versions;
for (HandshakeProtocol protocol : kSupportedHandshakeProtocols) {
- if (protocol == PROTOCOL_TLS1_3 &&
- !GetQuicFlag(FLAGS_quic_supports_tls_handshake)) {
- continue;
- }
for (QuicTransportVersion version : kSupportedTransportVersions) {
if (protocol == PROTOCOL_TLS1_3 &&
!QuicVersionUsesCryptoFrames(version)) {
@@ -232,6 +221,10 @@
ParsedQuicVersionVector filtered_versions;
filtered_versions.reserve(versions.size());
for (ParsedQuicVersion version : versions) {
+ if (version.handshake_protocol == PROTOCOL_TLS1_3 &&
+ !GetQuicFlag(FLAGS_quic_supports_tls_handshake)) {
+ continue;
+ }
if (version.transport_version == QUIC_VERSION_99) {
if (GetQuicReloadableFlag(quic_enable_version_99) &&
GetQuicReloadableFlag(quic_enable_version_47) &&