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/core/crypto/quic_crypto_server_config.h" | 5 #include "net/quic/core/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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (ip.IsIPv4()) { | 74 if (ip.IsIPv4()) { |
75 return ConvertIPv4ToIPv4MappedIPv6(ip); | 75 return ConvertIPv4ToIPv4MappedIPv6(ip); |
76 } | 76 } |
77 return ip; | 77 return ip; |
78 } | 78 } |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 class ValidateClientHelloHelper { | 82 class ValidateClientHelloHelper { |
83 public: | 83 public: |
84 // Note: stores a pointer to a unique_ptr, and std::moves the unique_ptr when | 84 // Note: stores pointers to unique_ptrs, and std::moves the unique_ptrs when |
85 // ValidationComplete is called. | 85 // ValidationComplete is called. |
86 ValidateClientHelloHelper( | 86 ValidateClientHelloHelper( |
87 std::unique_ptr<ValidateClientHelloResultCallback::Result>* result, | 87 std::unique_ptr<ValidateClientHelloResultCallback::Result>* result, |
88 ValidateClientHelloResultCallback* done_cb) | 88 std::unique_ptr<ValidateClientHelloResultCallback>* done_cb) |
89 : result_(result), done_cb_(done_cb) {} | 89 : result_(result), done_cb_(done_cb) {} |
90 | 90 |
91 ~ValidateClientHelloHelper() { | 91 ~ValidateClientHelloHelper() { |
92 QUIC_BUG_IF(done_cb_ != nullptr) | 92 QUIC_BUG_IF(done_cb_ != nullptr) |
93 << "Deleting ValidateClientHelloHelper with a pending callback."; | 93 << "Deleting ValidateClientHelloHelper with a pending callback."; |
94 } | 94 } |
95 | 95 |
96 void ValidationComplete( | 96 void ValidationComplete( |
97 QuicErrorCode error_code, | 97 QuicErrorCode error_code, |
98 const char* error_details, | 98 const char* error_details, |
99 std::unique_ptr<ProofSource::Details> proof_source_details) { | 99 std::unique_ptr<ProofSource::Details> proof_source_details) { |
100 (*result_)->error_code = error_code; | 100 (*result_)->error_code = error_code; |
101 (*result_)->error_details = error_details; | 101 (*result_)->error_details = error_details; |
102 done_cb_->Run(std::move(*result_), std::move(proof_source_details)); | 102 (*done_cb_)->Run(std::move(*result_), std::move(proof_source_details)); |
103 DetachCallback(); | 103 DetachCallback(); |
104 } | 104 } |
105 | 105 |
106 void DetachCallback() { | 106 void DetachCallback() { |
107 QUIC_BUG_IF(done_cb_ == nullptr) << "Callback already detached."; | 107 QUIC_BUG_IF(done_cb_ == nullptr) << "Callback already detached."; |
108 done_cb_ = nullptr; | 108 done_cb_ = nullptr; |
109 } | 109 } |
110 | 110 |
111 private: | 111 private: |
112 std::unique_ptr<ValidateClientHelloResultCallback::Result>* result_; | 112 std::unique_ptr<ValidateClientHelloResultCallback::Result>* result_; |
113 ValidateClientHelloResultCallback* done_cb_; | 113 std::unique_ptr<ValidateClientHelloResultCallback>* done_cb_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(ValidateClientHelloHelper); | 115 DISALLOW_COPY_AND_ASSIGN(ValidateClientHelloHelper); |
116 }; | 116 }; |
117 | 117 |
118 class VerifyNonceIsValidAndUniqueCallback | 118 class VerifyNonceIsValidAndUniqueCallback |
119 : public StrikeRegisterClient::ResultCallback { | 119 : public StrikeRegisterClient::ResultCallback { |
120 public: | 120 public: |
121 VerifyNonceIsValidAndUniqueCallback( | 121 VerifyNonceIsValidAndUniqueCallback( |
122 std::unique_ptr<ValidateClientHelloResultCallback::Result> result, | 122 std::unique_ptr<ValidateClientHelloResultCallback::Result> result, |
123 std::unique_ptr<ProofSource::Details> proof_source_details, | 123 std::unique_ptr<ProofSource::Details> proof_source_details, |
124 ValidateClientHelloResultCallback* done_cb) | 124 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) |
125 : result_(std::move(result)), | 125 : result_(std::move(result)), |
126 proof_source_details_(std::move(proof_source_details)), | 126 proof_source_details_(std::move(proof_source_details)), |
127 done_cb_(done_cb) {} | 127 done_cb_(std::move(done_cb)) {} |
128 | 128 |
129 protected: | 129 protected: |
130 void RunImpl(bool nonce_is_valid_and_unique, | 130 void RunImpl(bool nonce_is_valid_and_unique, |
131 InsertStatus nonce_error) override { | 131 InsertStatus nonce_error) override { |
132 DVLOG(1) << "Using client nonce, unique: " << nonce_is_valid_and_unique | 132 DVLOG(1) << "Using client nonce, unique: " << nonce_is_valid_and_unique |
133 << " nonce_error: " << nonce_error; | 133 << " nonce_error: " << nonce_error; |
134 if (!nonce_is_valid_and_unique) { | 134 if (!nonce_is_valid_and_unique) { |
135 HandshakeFailureReason client_nonce_error; | 135 HandshakeFailureReason client_nonce_error; |
136 switch (nonce_error) { | 136 switch (nonce_error) { |
137 case NONCE_INVALID_FAILURE: | 137 case NONCE_INVALID_FAILURE: |
(...skipping 24 matching lines...) Expand all Loading... |
162 break; | 162 break; |
163 } | 163 } |
164 result_->info.reject_reasons.push_back(client_nonce_error); | 164 result_->info.reject_reasons.push_back(client_nonce_error); |
165 } | 165 } |
166 done_cb_->Run(std::move(result_), std::move(proof_source_details_)); | 166 done_cb_->Run(std::move(result_), std::move(proof_source_details_)); |
167 } | 167 } |
168 | 168 |
169 private: | 169 private: |
170 std::unique_ptr<ValidateClientHelloResultCallback::Result> result_; | 170 std::unique_ptr<ValidateClientHelloResultCallback::Result> result_; |
171 std::unique_ptr<ProofSource::Details> proof_source_details_; | 171 std::unique_ptr<ProofSource::Details> proof_source_details_; |
172 ValidateClientHelloResultCallback* done_cb_; | 172 std::unique_ptr<ValidateClientHelloResultCallback> done_cb_; |
173 | 173 |
174 DISALLOW_COPY_AND_ASSIGN(VerifyNonceIsValidAndUniqueCallback); | 174 DISALLOW_COPY_AND_ASSIGN(VerifyNonceIsValidAndUniqueCallback); |
175 }; | 175 }; |
176 | 176 |
177 // static | 177 // static |
178 const char QuicCryptoServerConfig::TESTING[] = "secret string for testing"; | 178 const char QuicCryptoServerConfig::TESTING[] = "secret string for testing"; |
179 | 179 |
180 ClientHelloInfo::ClientHelloInfo(const IPAddress& in_client_ip, | 180 ClientHelloInfo::ClientHelloInfo(const IPAddress& in_client_ip, |
181 QuicWallTime in_now) | 181 QuicWallTime in_now) |
182 : client_ip(in_client_ip), now(in_now), valid_source_address_token(false) {} | 182 : client_ip(in_client_ip), now(in_now), valid_source_address_token(false) {} |
(...skipping 11 matching lines...) Expand all Loading... |
194 : client_hello(in_client_hello), | 194 : client_hello(in_client_hello), |
195 info(in_client_ip, in_now), | 195 info(in_client_ip, in_now), |
196 error_code(QUIC_NO_ERROR) {} | 196 error_code(QUIC_NO_ERROR) {} |
197 | 197 |
198 ValidateClientHelloResultCallback::Result::~Result() {} | 198 ValidateClientHelloResultCallback::Result::~Result() {} |
199 | 199 |
200 ValidateClientHelloResultCallback::ValidateClientHelloResultCallback() {} | 200 ValidateClientHelloResultCallback::ValidateClientHelloResultCallback() {} |
201 | 201 |
202 ValidateClientHelloResultCallback::~ValidateClientHelloResultCallback() {} | 202 ValidateClientHelloResultCallback::~ValidateClientHelloResultCallback() {} |
203 | 203 |
204 void ValidateClientHelloResultCallback::Run( | |
205 std::unique_ptr<Result> result, | |
206 std::unique_ptr<ProofSource::Details> details) { | |
207 RunImpl(std::move(result), std::move(details)); | |
208 delete this; | |
209 } | |
210 | |
211 QuicCryptoServerConfig::ConfigOptions::ConfigOptions() | 204 QuicCryptoServerConfig::ConfigOptions::ConfigOptions() |
212 : expiry_time(QuicWallTime::Zero()), | 205 : expiry_time(QuicWallTime::Zero()), |
213 channel_id_enabled(false), | 206 channel_id_enabled(false), |
214 token_binding_enabled(false), | 207 token_binding_enabled(false), |
215 p256(false) {} | 208 p256(false) {} |
216 | 209 |
217 QuicCryptoServerConfig::ConfigOptions::ConfigOptions( | 210 QuicCryptoServerConfig::ConfigOptions::ConfigOptions( |
218 const ConfigOptions& other) = default; | 211 const ConfigOptions& other) = default; |
219 | 212 |
220 QuicCryptoServerConfig::QuicCryptoServerConfig( | 213 QuicCryptoServerConfig::QuicCryptoServerConfig( |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 490 } |
498 } | 491 } |
499 | 492 |
500 void QuicCryptoServerConfig::ValidateClientHello( | 493 void QuicCryptoServerConfig::ValidateClientHello( |
501 const CryptoHandshakeMessage& client_hello, | 494 const CryptoHandshakeMessage& client_hello, |
502 const IPAddress& client_ip, | 495 const IPAddress& client_ip, |
503 const IPAddress& server_ip, | 496 const IPAddress& server_ip, |
504 QuicVersion version, | 497 QuicVersion version, |
505 const QuicClock* clock, | 498 const QuicClock* clock, |
506 QuicCryptoProof* crypto_proof, | 499 QuicCryptoProof* crypto_proof, |
507 ValidateClientHelloResultCallback* done_cb) const { | 500 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const { |
508 const QuicWallTime now(clock->WallNow()); | 501 const QuicWallTime now(clock->WallNow()); |
509 | 502 |
510 std::unique_ptr<ValidateClientHelloResultCallback::Result> result( | 503 std::unique_ptr<ValidateClientHelloResultCallback::Result> result( |
511 new ValidateClientHelloResultCallback::Result(client_hello, client_ip, | 504 new ValidateClientHelloResultCallback::Result(client_hello, client_ip, |
512 now)); | 505 now)); |
513 | 506 |
514 StringPiece requested_scid; | 507 StringPiece requested_scid; |
515 client_hello.GetStringPiece(kSCID, &requested_scid); | 508 client_hello.GetStringPiece(kSCID, &requested_scid); |
516 | 509 |
517 uint8_t primary_orbit[kOrbitSize]; | 510 uint8_t primary_orbit[kOrbitSize]; |
(...skipping 24 matching lines...) Expand all Loading... |
542 if (result->error_code == QUIC_NO_ERROR) { | 535 if (result->error_code == QUIC_NO_ERROR) { |
543 if (version > QUIC_VERSION_30) { | 536 if (version > QUIC_VERSION_30) { |
544 // QUIC v31 and above require a new proof for each CHLO so clear the | 537 // QUIC v31 and above require a new proof for each CHLO so clear the |
545 // existing proof, if any. | 538 // existing proof, if any. |
546 crypto_proof->chain = nullptr; | 539 crypto_proof->chain = nullptr; |
547 crypto_proof->signature = ""; | 540 crypto_proof->signature = ""; |
548 crypto_proof->cert_sct = ""; | 541 crypto_proof->cert_sct = ""; |
549 } | 542 } |
550 EvaluateClientHello(server_ip, version, primary_orbit, requested_config, | 543 EvaluateClientHello(server_ip, version, primary_orbit, requested_config, |
551 primary_config, crypto_proof, std::move(result), | 544 primary_config, crypto_proof, std::move(result), |
552 done_cb); | 545 std::move(done_cb)); |
553 } else { | 546 } else { |
554 done_cb->Run(std::move(result), /* details = */ nullptr); | 547 done_cb->Run(std::move(result), /* details = */ nullptr); |
555 } | 548 } |
556 } | 549 } |
557 | 550 |
558 QuicErrorCode QuicCryptoServerConfig::ProcessClientHello( | 551 QuicErrorCode QuicCryptoServerConfig::ProcessClientHello( |
559 const ValidateClientHelloResultCallback::Result& validate_chlo_result, | 552 const ValidateClientHelloResultCallback::Result& validate_chlo_result, |
560 bool reject_only, | 553 bool reject_only, |
561 QuicConnectionId connection_id, | 554 QuicConnectionId connection_id, |
562 const IPAddress& server_ip, | 555 const IPAddress& server_ip, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 const QuicCryptoServerConfig& config, | 993 const QuicCryptoServerConfig& config, |
1001 bool found_error, | 994 bool found_error, |
1002 const IPAddress& server_ip, | 995 const IPAddress& server_ip, |
1003 QuicVersion version, | 996 QuicVersion version, |
1004 const uint8_t* primary_orbit, | 997 const uint8_t* primary_orbit, |
1005 scoped_refptr<QuicCryptoServerConfig::Config> requested_config, | 998 scoped_refptr<QuicCryptoServerConfig::Config> requested_config, |
1006 scoped_refptr<QuicCryptoServerConfig::Config> primary_config, | 999 scoped_refptr<QuicCryptoServerConfig::Config> primary_config, |
1007 QuicCryptoProof* crypto_proof, | 1000 QuicCryptoProof* crypto_proof, |
1008 std::unique_ptr<ValidateClientHelloResultCallback::Result> | 1001 std::unique_ptr<ValidateClientHelloResultCallback::Result> |
1009 client_hello_state, | 1002 client_hello_state, |
1010 ValidateClientHelloResultCallback* done_cb) | 1003 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) |
1011 : config_(config), | 1004 : config_(config), |
1012 found_error_(found_error), | 1005 found_error_(found_error), |
1013 server_ip_(server_ip), | 1006 server_ip_(server_ip), |
1014 version_(version), | 1007 version_(version), |
1015 primary_orbit_(primary_orbit), | 1008 primary_orbit_(primary_orbit), |
1016 requested_config_(std::move(requested_config)), | 1009 requested_config_(std::move(requested_config)), |
1017 primary_config_(std::move(primary_config)), | 1010 primary_config_(std::move(primary_config)), |
1018 crypto_proof_(crypto_proof), | 1011 crypto_proof_(crypto_proof), |
1019 client_hello_state_(std::move(client_hello_state)), | 1012 client_hello_state_(std::move(client_hello_state)), |
1020 done_cb_(done_cb) {} | 1013 done_cb_(std::move(done_cb)) {} |
1021 | 1014 |
1022 void Run(bool ok, | 1015 void Run(bool ok, |
1023 const scoped_refptr<ProofSource::Chain>& chain, | 1016 const scoped_refptr<ProofSource::Chain>& chain, |
1024 const string& signature, | 1017 const string& signature, |
1025 const string& leaf_cert_sct, | 1018 const string& leaf_cert_sct, |
1026 std::unique_ptr<ProofSource::Details> details) override { | 1019 std::unique_ptr<ProofSource::Details> details) override { |
1027 if (ok) { | 1020 if (ok) { |
1028 crypto_proof_->chain = chain; | 1021 crypto_proof_->chain = chain; |
1029 crypto_proof_->signature = signature; | 1022 crypto_proof_->signature = signature; |
1030 crypto_proof_->cert_sct = leaf_cert_sct; | 1023 crypto_proof_->cert_sct = leaf_cert_sct; |
1031 } | 1024 } |
1032 config_.EvaluateClientHelloAfterGetProof( | 1025 config_.EvaluateClientHelloAfterGetProof( |
1033 found_error_, server_ip_, version_, primary_orbit_, requested_config_, | 1026 found_error_, server_ip_, version_, primary_orbit_, requested_config_, |
1034 primary_config_, crypto_proof_, std::move(details), !ok, | 1027 primary_config_, crypto_proof_, std::move(details), !ok, |
1035 std::move(client_hello_state_), done_cb_); | 1028 std::move(client_hello_state_), std::move(done_cb_)); |
1036 } | 1029 } |
1037 | 1030 |
1038 private: | 1031 private: |
1039 const QuicCryptoServerConfig& config_; | 1032 const QuicCryptoServerConfig& config_; |
1040 const bool found_error_; | 1033 const bool found_error_; |
1041 const IPAddress& server_ip_; | 1034 const IPAddress& server_ip_; |
1042 const QuicVersion version_; | 1035 const QuicVersion version_; |
1043 const uint8_t* primary_orbit_; | 1036 const uint8_t* primary_orbit_; |
1044 const scoped_refptr<QuicCryptoServerConfig::Config> requested_config_; | 1037 const scoped_refptr<QuicCryptoServerConfig::Config> requested_config_; |
1045 const scoped_refptr<QuicCryptoServerConfig::Config> primary_config_; | 1038 const scoped_refptr<QuicCryptoServerConfig::Config> primary_config_; |
1046 QuicCryptoProof* crypto_proof_; | 1039 QuicCryptoProof* crypto_proof_; |
1047 std::unique_ptr<ValidateClientHelloResultCallback::Result> | 1040 std::unique_ptr<ValidateClientHelloResultCallback::Result> |
1048 client_hello_state_; | 1041 client_hello_state_; |
1049 ValidateClientHelloResultCallback* done_cb_; | 1042 std::unique_ptr<ValidateClientHelloResultCallback> done_cb_; |
1050 }; | 1043 }; |
1051 | 1044 |
1052 void QuicCryptoServerConfig::EvaluateClientHello( | 1045 void QuicCryptoServerConfig::EvaluateClientHello( |
1053 const IPAddress& server_ip, | 1046 const IPAddress& server_ip, |
1054 QuicVersion version, | 1047 QuicVersion version, |
1055 const uint8_t* primary_orbit, | 1048 const uint8_t* primary_orbit, |
1056 scoped_refptr<Config> requested_config, | 1049 scoped_refptr<Config> requested_config, |
1057 scoped_refptr<Config> primary_config, | 1050 scoped_refptr<Config> primary_config, |
1058 QuicCryptoProof* crypto_proof, | 1051 QuicCryptoProof* crypto_proof, |
1059 std::unique_ptr<ValidateClientHelloResultCallback::Result> | 1052 std::unique_ptr<ValidateClientHelloResultCallback::Result> |
1060 client_hello_state, | 1053 client_hello_state, |
1061 ValidateClientHelloResultCallback* done_cb) const { | 1054 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const { |
1062 ValidateClientHelloHelper helper(&client_hello_state, done_cb); | 1055 ValidateClientHelloHelper helper(&client_hello_state, &done_cb); |
1063 | 1056 |
1064 const CryptoHandshakeMessage& client_hello = client_hello_state->client_hello; | 1057 const CryptoHandshakeMessage& client_hello = client_hello_state->client_hello; |
1065 ClientHelloInfo* info = &(client_hello_state->info); | 1058 ClientHelloInfo* info = &(client_hello_state->info); |
1066 | 1059 |
1067 if (client_hello.size() < kClientHelloMinimumSize) { | 1060 if (client_hello.size() < kClientHelloMinimumSize) { |
1068 helper.ValidationComplete(QUIC_CRYPTO_INVALID_VALUE_LENGTH, | 1061 helper.ValidationComplete(QUIC_CRYPTO_INVALID_VALUE_LENGTH, |
1069 "Client hello too small", nullptr); | 1062 "Client hello too small", nullptr); |
1070 return; | 1063 return; |
1071 } | 1064 } |
1072 | 1065 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 bool need_proof = true; | 1123 bool need_proof = true; |
1131 need_proof = !crypto_proof->chain; | 1124 need_proof = !crypto_proof->chain; |
1132 if (FLAGS_enable_async_get_proof) { | 1125 if (FLAGS_enable_async_get_proof) { |
1133 if (need_proof) { | 1126 if (need_proof) { |
1134 // Make an async call to GetProof and setup the callback to trampoline | 1127 // Make an async call to GetProof and setup the callback to trampoline |
1135 // back into EvaluateClientHelloAfterGetProof | 1128 // back into EvaluateClientHelloAfterGetProof |
1136 std::unique_ptr<EvaluateClientHelloCallback> cb( | 1129 std::unique_ptr<EvaluateClientHelloCallback> cb( |
1137 new EvaluateClientHelloCallback( | 1130 new EvaluateClientHelloCallback( |
1138 *this, found_error, server_ip, version, primary_orbit, | 1131 *this, found_error, server_ip, version, primary_orbit, |
1139 requested_config, primary_config, crypto_proof, | 1132 requested_config, primary_config, crypto_proof, |
1140 std::move(client_hello_state), done_cb)); | 1133 std::move(client_hello_state), std::move(done_cb))); |
1141 proof_source_->GetProof(server_ip, info->sni.as_string(), | 1134 proof_source_->GetProof(server_ip, info->sni.as_string(), |
1142 serialized_config, version, chlo_hash, | 1135 serialized_config, version, chlo_hash, |
1143 std::move(cb)); | 1136 std::move(cb)); |
1144 helper.DetachCallback(); | 1137 helper.DetachCallback(); |
1145 return; | 1138 return; |
1146 } | 1139 } |
1147 } | 1140 } |
1148 | 1141 |
1149 // No need to get a new proof if one was already generated. | 1142 // No need to get a new proof if one was already generated. |
1150 if (need_proof && | 1143 if (need_proof && |
1151 !proof_source_->GetProof(server_ip, info->sni.as_string(), | 1144 !proof_source_->GetProof(server_ip, info->sni.as_string(), |
1152 serialized_config, version, chlo_hash, | 1145 serialized_config, version, chlo_hash, |
1153 &crypto_proof->chain, &crypto_proof->signature, | 1146 &crypto_proof->chain, &crypto_proof->signature, |
1154 &crypto_proof->cert_sct)) { | 1147 &crypto_proof->cert_sct)) { |
1155 get_proof_failed = true; | 1148 get_proof_failed = true; |
1156 } | 1149 } |
1157 | 1150 |
1158 // Details are null because the synchronous version of GetProof does not | 1151 // Details are null because the synchronous version of GetProof does not |
1159 // return any stats. Eventually the synchronous codepath will be eliminated. | 1152 // return any stats. Eventually the synchronous codepath will be eliminated. |
1160 EvaluateClientHelloAfterGetProof( | 1153 EvaluateClientHelloAfterGetProof( |
1161 found_error, server_ip, version, primary_orbit, requested_config, | 1154 found_error, server_ip, version, primary_orbit, requested_config, |
1162 primary_config, crypto_proof, nullptr /* proof_source_details */, | 1155 primary_config, crypto_proof, nullptr /* proof_source_details */, |
1163 get_proof_failed, std::move(client_hello_state), done_cb); | 1156 get_proof_failed, std::move(client_hello_state), std::move(done_cb)); |
1164 helper.DetachCallback(); | 1157 helper.DetachCallback(); |
1165 } | 1158 } |
1166 | 1159 |
1167 void QuicCryptoServerConfig::EvaluateClientHelloAfterGetProof( | 1160 void QuicCryptoServerConfig::EvaluateClientHelloAfterGetProof( |
1168 bool found_error, | 1161 bool found_error, |
1169 const IPAddress& server_ip, | 1162 const IPAddress& server_ip, |
1170 QuicVersion version, | 1163 QuicVersion version, |
1171 const uint8_t* primary_orbit, | 1164 const uint8_t* primary_orbit, |
1172 scoped_refptr<Config> requested_config, | 1165 scoped_refptr<Config> requested_config, |
1173 scoped_refptr<Config> primary_config, | 1166 scoped_refptr<Config> primary_config, |
1174 QuicCryptoProof* crypto_proof, | 1167 QuicCryptoProof* crypto_proof, |
1175 std::unique_ptr<ProofSource::Details> proof_source_details, | 1168 std::unique_ptr<ProofSource::Details> proof_source_details, |
1176 bool get_proof_failed, | 1169 bool get_proof_failed, |
1177 std::unique_ptr<ValidateClientHelloResultCallback::Result> | 1170 std::unique_ptr<ValidateClientHelloResultCallback::Result> |
1178 client_hello_state, | 1171 client_hello_state, |
1179 ValidateClientHelloResultCallback* done_cb) const { | 1172 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const { |
1180 ValidateClientHelloHelper helper(&client_hello_state, done_cb); | 1173 ValidateClientHelloHelper helper(&client_hello_state, &done_cb); |
1181 const CryptoHandshakeMessage& client_hello = client_hello_state->client_hello; | 1174 const CryptoHandshakeMessage& client_hello = client_hello_state->client_hello; |
1182 ClientHelloInfo* info = &(client_hello_state->info); | 1175 ClientHelloInfo* info = &(client_hello_state->info); |
1183 | 1176 |
1184 if (get_proof_failed) { | 1177 if (get_proof_failed) { |
1185 found_error = true; | 1178 found_error = true; |
1186 info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); | 1179 info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); |
1187 } | 1180 } |
1188 | 1181 |
1189 if (!ValidateExpectedLeafCertificate(client_hello, *crypto_proof)) { | 1182 if (!ValidateExpectedLeafCertificate(client_hello, *crypto_proof)) { |
1190 found_error = true; | 1183 found_error = true; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 info->reject_reasons.push_back(SERVER_NONCE_REQUIRED_FAILURE); | 1261 info->reject_reasons.push_back(SERVER_NONCE_REQUIRED_FAILURE); |
1269 helper.ValidationComplete(QUIC_NO_ERROR, "", | 1262 helper.ValidationComplete(QUIC_NO_ERROR, "", |
1270 std::move(proof_source_details)); | 1263 std::move(proof_source_details)); |
1271 return; | 1264 return; |
1272 } | 1265 } |
1273 | 1266 |
1274 strike_register_client->VerifyNonceIsValidAndUnique( | 1267 strike_register_client->VerifyNonceIsValidAndUnique( |
1275 info->client_nonce, info->now, | 1268 info->client_nonce, info->now, |
1276 new VerifyNonceIsValidAndUniqueCallback(std::move(client_hello_state), | 1269 new VerifyNonceIsValidAndUniqueCallback(std::move(client_hello_state), |
1277 std::move(proof_source_details), | 1270 std::move(proof_source_details), |
1278 done_cb)); | 1271 std::move(done_cb))); |
1279 helper.DetachCallback(); | 1272 helper.DetachCallback(); |
1280 } | 1273 } |
1281 | 1274 |
1282 bool QuicCryptoServerConfig::BuildServerConfigUpdateMessage( | 1275 bool QuicCryptoServerConfig::BuildServerConfigUpdateMessage( |
1283 QuicVersion version, | 1276 QuicVersion version, |
1284 StringPiece chlo_hash, | 1277 StringPiece chlo_hash, |
1285 const SourceAddressTokens& previous_source_address_tokens, | 1278 const SourceAddressTokens& previous_source_address_tokens, |
1286 const IPAddress& server_ip, | 1279 const IPAddress& server_ip, |
1287 const IPAddress& client_ip, | 1280 const IPAddress& client_ip, |
1288 const QuicClock* clock, | 1281 const QuicClock* clock, |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 uint32_t window_secs) { | 1810 uint32_t window_secs) { |
1818 DCHECK(!server_nonce_strike_register_.get()); | 1811 DCHECK(!server_nonce_strike_register_.get()); |
1819 server_nonce_strike_register_window_secs_ = window_secs; | 1812 server_nonce_strike_register_window_secs_ = window_secs; |
1820 } | 1813 } |
1821 | 1814 |
1822 void QuicCryptoServerConfig::set_enable_serving_sct(bool enable_serving_sct) { | 1815 void QuicCryptoServerConfig::set_enable_serving_sct(bool enable_serving_sct) { |
1823 enable_serving_sct_ = enable_serving_sct; | 1816 enable_serving_sct_ = enable_serving_sct; |
1824 } | 1817 } |
1825 | 1818 |
1826 void QuicCryptoServerConfig::AcquirePrimaryConfigChangedCb( | 1819 void QuicCryptoServerConfig::AcquirePrimaryConfigChangedCb( |
1827 PrimaryConfigChangedCallback* cb) { | 1820 std::unique_ptr<PrimaryConfigChangedCallback> cb) { |
1828 base::AutoLock locked(configs_lock_); | 1821 base::AutoLock locked(configs_lock_); |
1829 primary_config_changed_cb_.reset(cb); | 1822 primary_config_changed_cb_ = std::move(cb); |
1830 } | 1823 } |
1831 | 1824 |
1832 string QuicCryptoServerConfig::NewSourceAddressToken( | 1825 string QuicCryptoServerConfig::NewSourceAddressToken( |
1833 const Config& config, | 1826 const Config& config, |
1834 const SourceAddressTokens& previous_tokens, | 1827 const SourceAddressTokens& previous_tokens, |
1835 const IPAddress& ip, | 1828 const IPAddress& ip, |
1836 QuicRandom* rand, | 1829 QuicRandom* rand, |
1837 QuicWallTime now, | 1830 QuicWallTime now, |
1838 const CachedNetworkParameters* cached_network_params) const { | 1831 const CachedNetworkParameters* cached_network_params) const { |
1839 SourceAddressTokens source_address_tokens; | 1832 SourceAddressTokens source_address_tokens; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 priority(0), | 2068 priority(0), |
2076 source_address_token_boxer(nullptr) {} | 2069 source_address_token_boxer(nullptr) {} |
2077 | 2070 |
2078 QuicCryptoServerConfig::Config::~Config() { | 2071 QuicCryptoServerConfig::Config::~Config() { |
2079 base::STLDeleteElements(&key_exchanges); | 2072 base::STLDeleteElements(&key_exchanges); |
2080 } | 2073 } |
2081 | 2074 |
2082 QuicCryptoProof::QuicCryptoProof() {} | 2075 QuicCryptoProof::QuicCryptoProof() {} |
2083 QuicCryptoProof::~QuicCryptoProof() {} | 2076 QuicCryptoProof::~QuicCryptoProof() {} |
2084 } // namespace net | 2077 } // namespace net |
OLD | NEW |