Index: net/quic/crypto/quic_crypto_server_config.cc |
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc |
index c523dd487d9f785ea6a1ff713ad338e77004ccd9..d1e2751720acb6bce05d50c1e281c0db11177ec6 100644 |
--- a/net/quic/crypto/quic_crypto_server_config.cc |
+++ b/net/quic/crypto/quic_crypto_server_config.cc |
@@ -547,27 +547,10 @@ QuicErrorCode QuicCryptoServerConfig::ProcessClientHello( |
validate_chlo_result.client_hello; |
const ClientHelloInfo& info = validate_chlo_result.info; |
- // If the client's preferred version is not the version we are currently |
- // speaking, then the client went through a version negotiation. In this |
- // case, we need to make sure that we actually do not support this version |
- // and that it wasn't a downgrade attack. |
- QuicTag client_version_tag; |
- if (client_hello.GetUint32(kVER, &client_version_tag) != QUIC_NO_ERROR) { |
- *error_details = "client hello missing version list"; |
- return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; |
- } |
- QuicVersion client_version = QuicTagToQuicVersion(client_version_tag); |
- if (client_version != version) { |
- // Just because client_version is a valid version enum doesn't mean that |
- // this server actually supports that version, so we check to see if |
- // it's actually in the supported versions list. |
- for (size_t i = 0; i < supported_versions.size(); ++i) { |
- if (client_version == supported_versions[i]) { |
- *error_details = "Downgrade attack detected"; |
- return QUIC_VERSION_NEGOTIATION_MISMATCH; |
- } |
- } |
- } |
+ QuicErrorCode valid = CryptoUtils::ValidateClientHello( |
+ client_hello, version, supported_versions, error_details); |
+ if (valid != QUIC_NO_ERROR) |
+ return valid; |
StringPiece requested_scid; |
client_hello.GetStringPiece(kSCID, &requested_scid); |