| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/crypto/quic_crypto_server_config.h" | 5 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 info->reject_reasons.push_back(SERVER_CONFIG_INCHOATE_HELLO_FAILURE); | 1036 info->reject_reasons.push_back(SERVER_CONFIG_INCHOATE_HELLO_FAILURE); |
| 1037 // Report no client nonce as INCHOATE_HELLO_FAILURE. | 1037 // Report no client nonce as INCHOATE_HELLO_FAILURE. |
| 1038 helper.ValidationComplete(QUIC_NO_ERROR, ""); | 1038 helper.ValidationComplete(QUIC_NO_ERROR, ""); |
| 1039 return; | 1039 return; |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 bool found_error = false; | 1042 bool found_error = false; |
| 1043 if (source_address_token_error != HANDSHAKE_OK) { | 1043 if (source_address_token_error != HANDSHAKE_OK) { |
| 1044 info->reject_reasons.push_back(source_address_token_error); | 1044 info->reject_reasons.push_back(source_address_token_error); |
| 1045 // No valid source address token. | 1045 // No valid source address token. |
| 1046 if (FLAGS_use_early_return_when_verifying_chlo) { | |
| 1047 helper.ValidationComplete(QUIC_NO_ERROR, ""); | |
| 1048 return; | |
| 1049 } | |
| 1050 found_error = true; | 1046 found_error = true; |
| 1051 } | 1047 } |
| 1052 | 1048 |
| 1053 if (version > QUIC_VERSION_25) { | 1049 if (version > QUIC_VERSION_25) { |
| 1054 bool x509_supported = false; | 1050 bool x509_supported = false; |
| 1055 bool x509_ecdsa_supported = false; | 1051 bool x509_ecdsa_supported = false; |
| 1056 ParseProofDemand(client_hello, &x509_supported, &x509_ecdsa_supported); | 1052 ParseProofDemand(client_hello, &x509_supported, &x509_ecdsa_supported); |
| 1057 string serialized_config = primary_config->serialized; | 1053 string serialized_config = primary_config->serialized; |
| 1058 string chlo_hash; | 1054 string chlo_hash; |
| 1059 CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash); | 1055 CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash); |
| 1060 if (!proof_source_->GetProof( | 1056 if (!proof_source_->GetProof( |
| 1061 server_ip, info->sni.as_string(), serialized_config, version, | 1057 server_ip, info->sni.as_string(), serialized_config, version, |
| 1062 chlo_hash, x509_ecdsa_supported, &crypto_proof->chain, | 1058 chlo_hash, x509_ecdsa_supported, &crypto_proof->chain, |
| 1063 &crypto_proof->signature, &crypto_proof->cert_sct)) { | 1059 &crypto_proof->signature, &crypto_proof->cert_sct)) { |
| 1064 found_error = true; | 1060 found_error = true; |
| 1065 info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); | 1061 info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); |
| 1066 } | 1062 } |
| 1067 | 1063 |
| 1068 if (!ValidateExpectedLeafCertificate(client_hello, *crypto_proof)) { | 1064 if (!ValidateExpectedLeafCertificate(client_hello, *crypto_proof)) { |
| 1069 found_error = true; | 1065 found_error = true; |
| 1070 info->reject_reasons.push_back(INVALID_EXPECTED_LEAF_CERTIFICATE); | 1066 info->reject_reasons.push_back(INVALID_EXPECTED_LEAF_CERTIFICATE); |
| 1071 } | 1067 } |
| 1072 } | 1068 } |
| 1073 | 1069 |
| 1074 if (info->client_nonce.size() != kNonceSize) { | 1070 if (info->client_nonce.size() != kNonceSize) { |
| 1075 info->reject_reasons.push_back(CLIENT_NONCE_INVALID_FAILURE); | 1071 info->reject_reasons.push_back(CLIENT_NONCE_INVALID_FAILURE); |
| 1076 // Invalid client nonce. | 1072 // Invalid client nonce. |
| 1077 LOG(ERROR) << "Invalid client nonce: " << client_hello.DebugString(); | 1073 LOG(ERROR) << "Invalid client nonce: " << client_hello.DebugString(); |
| 1078 DVLOG(1) << "Invalid client nonce."; | 1074 DVLOG(1) << "Invalid client nonce."; |
| 1079 if (FLAGS_use_early_return_when_verifying_chlo) { | |
| 1080 helper.ValidationComplete(QUIC_NO_ERROR, ""); | |
| 1081 return; | |
| 1082 } | |
| 1083 found_error = true; | 1075 found_error = true; |
| 1084 } | 1076 } |
| 1085 | 1077 |
| 1086 // Server nonce is optional, and used for key derivation if present. | 1078 // Server nonce is optional, and used for key derivation if present. |
| 1087 client_hello.GetStringPiece(kServerNonceTag, &info->server_nonce); | 1079 client_hello.GetStringPiece(kServerNonceTag, &info->server_nonce); |
| 1088 | 1080 |
| 1089 if (version > QUIC_VERSION_32) { | 1081 if (version > QUIC_VERSION_32) { |
| 1090 DVLOG(1) << "No 0-RTT replay protection in QUIC_VERSION_33 and higher."; | 1082 DVLOG(1) << "No 0-RTT replay protection in QUIC_VERSION_33 and higher."; |
| 1091 // If the server nonce is empty and we're requiring handshake confirmation | 1083 // If the server nonce is empty and we're requiring handshake confirmation |
| 1092 // for DoS reasons then we must reject the CHLO. | 1084 // for DoS reasons then we must reject the CHLO. |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 priority(0), | 1821 priority(0), |
| 1830 source_address_token_boxer(nullptr) {} | 1822 source_address_token_boxer(nullptr) {} |
| 1831 | 1823 |
| 1832 QuicCryptoServerConfig::Config::~Config() { | 1824 QuicCryptoServerConfig::Config::~Config() { |
| 1833 STLDeleteElements(&key_exchanges); | 1825 STLDeleteElements(&key_exchanges); |
| 1834 } | 1826 } |
| 1835 | 1827 |
| 1836 QuicCryptoProof::QuicCryptoProof() {} | 1828 QuicCryptoProof::QuicCryptoProof() {} |
| 1837 QuicCryptoProof::~QuicCryptoProof() {} | 1829 QuicCryptoProof::~QuicCryptoProof() {} |
| 1838 } // namespace net | 1830 } // namespace net |
| OLD | NEW |