Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: net/quic/crypto/quic_crypto_client_config.cc

Issue 1437023002: Landing Recent QUIC changes until 2015-11-09 20:32 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_client_config.h" 5 #include "net/quic/crypto/quic_crypto_client_config.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 void QuicCryptoClientConfig::CachedState::InvalidateServerConfig() { 182 void QuicCryptoClientConfig::CachedState::InvalidateServerConfig() {
183 server_config_.clear(); 183 server_config_.clear();
184 scfg_.reset(); 184 scfg_.reset();
185 SetProofInvalid(); 185 SetProofInvalid();
186 queue<QuicConnectionId> empty_queue; 186 queue<QuicConnectionId> empty_queue;
187 swap(server_designated_connection_ids_, empty_queue); 187 swap(server_designated_connection_ids_, empty_queue);
188 } 188 }
189 189
190 void QuicCryptoClientConfig::CachedState::SetProof(const vector<string>& certs, 190 void QuicCryptoClientConfig::CachedState::SetProof(const vector<string>& certs,
191 StringPiece cert_sct,
191 StringPiece signature) { 192 StringPiece signature) {
192 bool has_changed = 193 bool has_changed =
193 signature != server_config_sig_ || certs_.size() != certs.size(); 194 signature != server_config_sig_ || certs_.size() != certs.size();
194 195
195 if (!has_changed) { 196 if (!has_changed) {
196 for (size_t i = 0; i < certs_.size(); i++) { 197 for (size_t i = 0; i < certs_.size(); i++) {
197 if (certs_[i] != certs[i]) { 198 if (certs_[i] != certs[i]) {
198 has_changed = true; 199 has_changed = true;
199 break; 200 break;
200 } 201 }
201 } 202 }
202 } 203 }
203 204
204 if (!has_changed) { 205 if (!has_changed) {
205 return; 206 return;
206 } 207 }
207 208
208 // If the proof has changed then it needs to be revalidated. 209 // If the proof has changed then it needs to be revalidated.
209 SetProofInvalid(); 210 SetProofInvalid();
210 certs_ = certs; 211 certs_ = certs;
212 cert_sct_ = cert_sct.as_string();
211 server_config_sig_ = signature.as_string(); 213 server_config_sig_ = signature.as_string();
212 } 214 }
213 215
214 void QuicCryptoClientConfig::CachedState::Clear() { 216 void QuicCryptoClientConfig::CachedState::Clear() {
215 server_config_.clear(); 217 server_config_.clear();
216 source_address_token_.clear(); 218 source_address_token_.clear();
217 certs_.clear(); 219 certs_.clear();
220 cert_sct_.clear();
218 server_config_sig_.clear(); 221 server_config_sig_.clear();
219 server_config_valid_ = false; 222 server_config_valid_ = false;
220 proof_verify_details_.reset(); 223 proof_verify_details_.reset();
221 scfg_.reset(); 224 scfg_.reset();
222 ++generation_counter_; 225 ++generation_counter_;
223 queue<QuicConnectionId> empty_queue; 226 queue<QuicConnectionId> empty_queue;
224 swap(server_designated_connection_ids_, empty_queue); 227 swap(server_designated_connection_ids_, empty_queue);
225 } 228 }
226 229
227 void QuicCryptoClientConfig::CachedState::ClearProof() { 230 void QuicCryptoClientConfig::CachedState::ClearProof() {
228 SetProofInvalid(); 231 SetProofInvalid();
229 certs_.clear(); 232 certs_.clear();
233 cert_sct_.clear();
230 server_config_sig_.clear(); 234 server_config_sig_.clear();
231 } 235 }
232 236
233 void QuicCryptoClientConfig::CachedState::SetProofValid() { 237 void QuicCryptoClientConfig::CachedState::SetProofValid() {
234 server_config_valid_ = true; 238 server_config_valid_ = true;
235 } 239 }
236 240
237 void QuicCryptoClientConfig::CachedState::SetProofInvalid() { 241 void QuicCryptoClientConfig::CachedState::SetProofInvalid() {
238 server_config_valid_ = false; 242 server_config_valid_ = false;
239 ++generation_counter_; 243 ++generation_counter_;
240 } 244 }
241 245
242 bool QuicCryptoClientConfig::CachedState::Initialize( 246 bool QuicCryptoClientConfig::CachedState::Initialize(
243 StringPiece server_config, 247 StringPiece server_config,
244 StringPiece source_address_token, 248 StringPiece source_address_token,
245 const vector<string>& certs, 249 const vector<string>& certs,
250 const string& cert_sct,
246 StringPiece signature, 251 StringPiece signature,
247 QuicWallTime now) { 252 QuicWallTime now) {
248 DCHECK(server_config_.empty()); 253 DCHECK(server_config_.empty());
249 254
250 if (server_config.empty()) { 255 if (server_config.empty()) {
251 RecordDiskCacheServerConfigState(SERVER_CONFIG_EMPTY); 256 RecordDiskCacheServerConfigState(SERVER_CONFIG_EMPTY);
252 return false; 257 return false;
253 } 258 }
254 259
255 string error_details; 260 string error_details;
256 ServerConfigState state = SetServerConfig(server_config, now, 261 ServerConfigState state = SetServerConfig(server_config, now,
257 &error_details); 262 &error_details);
258 RecordDiskCacheServerConfigState(state); 263 RecordDiskCacheServerConfigState(state);
259 if (state != SERVER_CONFIG_VALID) { 264 if (state != SERVER_CONFIG_VALID) {
260 DVLOG(1) << "SetServerConfig failed with " << error_details; 265 DVLOG(1) << "SetServerConfig failed with " << error_details;
261 return false; 266 return false;
262 } 267 }
263 268
264 signature.CopyToString(&server_config_sig_); 269 signature.CopyToString(&server_config_sig_);
265 source_address_token.CopyToString(&source_address_token_); 270 source_address_token.CopyToString(&source_address_token_);
266 certs_ = certs; 271 certs_ = certs;
272 cert_sct_ = cert_sct;
267 return true; 273 return true;
268 } 274 }
269 275
270 const string& QuicCryptoClientConfig::CachedState::server_config() const { 276 const string& QuicCryptoClientConfig::CachedState::server_config() const {
271 return server_config_; 277 return server_config_;
272 } 278 }
273 279
274 const string& 280 const string&
275 QuicCryptoClientConfig::CachedState::source_address_token() const { 281 QuicCryptoClientConfig::CachedState::source_address_token() const {
276 return source_address_token_; 282 return source_address_token_;
277 } 283 }
278 284
279 const vector<string>& QuicCryptoClientConfig::CachedState::certs() const { 285 const vector<string>& QuicCryptoClientConfig::CachedState::certs() const {
280 return certs_; 286 return certs_;
281 } 287 }
282 288
289 const string& QuicCryptoClientConfig::CachedState::cert_sct() const {
290 return cert_sct_;
291 }
292
283 const string& QuicCryptoClientConfig::CachedState::signature() const { 293 const string& QuicCryptoClientConfig::CachedState::signature() const {
284 return server_config_sig_; 294 return server_config_sig_;
285 } 295 }
286 296
287 bool QuicCryptoClientConfig::CachedState::proof_valid() const { 297 bool QuicCryptoClientConfig::CachedState::proof_valid() const {
288 return server_config_valid_; 298 return server_config_valid_;
289 } 299 }
290 300
291 uint64 QuicCryptoClientConfig::CachedState::generation_counter() const { 301 uint64 QuicCryptoClientConfig::CachedState::generation_counter() const {
292 return generation_counter_; 302 return generation_counter_;
293 } 303 }
294 304
295 const ProofVerifyDetails* 305 const ProofVerifyDetails*
296 QuicCryptoClientConfig::CachedState::proof_verify_details() const { 306 QuicCryptoClientConfig::CachedState::proof_verify_details() const {
297 return proof_verify_details_.get(); 307 return proof_verify_details_.get();
298 } 308 }
299 309
300 void QuicCryptoClientConfig::CachedState::set_source_address_token( 310 void QuicCryptoClientConfig::CachedState::set_source_address_token(
301 StringPiece token) { 311 StringPiece token) {
302 source_address_token_ = token.as_string(); 312 source_address_token_ = token.as_string();
303 } 313 }
304 314
315 void QuicCryptoClientConfig::CachedState::set_cert_sct(StringPiece cert_sct) {
316 cert_sct_ = cert_sct.as_string();
317 }
318
305 void QuicCryptoClientConfig::CachedState::SetProofVerifyDetails( 319 void QuicCryptoClientConfig::CachedState::SetProofVerifyDetails(
306 ProofVerifyDetails* details) { 320 ProofVerifyDetails* details) {
307 proof_verify_details_.reset(details); 321 proof_verify_details_.reset(details);
308 } 322 }
309 323
310 void QuicCryptoClientConfig::CachedState::InitializeFrom( 324 void QuicCryptoClientConfig::CachedState::InitializeFrom(
311 const QuicCryptoClientConfig::CachedState& other) { 325 const QuicCryptoClientConfig::CachedState& other) {
312 DCHECK(server_config_.empty()); 326 DCHECK(server_config_.empty());
313 DCHECK(!server_config_valid_); 327 DCHECK(!server_config_valid_);
314 server_config_ = other.server_config_; 328 server_config_ = other.server_config_;
315 source_address_token_ = other.source_address_token_; 329 source_address_token_ = other.source_address_token_;
316 certs_ = other.certs_; 330 certs_ = other.certs_;
331 cert_sct_ = other.cert_sct_;
317 server_config_sig_ = other.server_config_sig_; 332 server_config_sig_ = other.server_config_sig_;
318 server_config_valid_ = other.server_config_valid_; 333 server_config_valid_ = other.server_config_valid_;
319 server_designated_connection_ids_ = other.server_designated_connection_ids_; 334 server_designated_connection_ids_ = other.server_designated_connection_ids_;
320 if (other.proof_verify_details_.get() != nullptr) { 335 if (other.proof_verify_details_.get() != nullptr) {
321 proof_verify_details_.reset(other.proof_verify_details_->Clone()); 336 proof_verify_details_.reset(other.proof_verify_details_->Clone());
322 } 337 }
323 ++generation_counter_; 338 ++generation_counter_;
324 } 339 }
325 340
326 QuicConnectionId 341 QuicConnectionId
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (disable_ecdsa_) { 427 if (disable_ecdsa_) {
413 out->SetTaglist(kPDMD, kX59R, 0); 428 out->SetTaglist(kPDMD, kX59R, 0);
414 } else { 429 } else {
415 out->SetTaglist(kPDMD, kX509, 0); 430 out->SetTaglist(kPDMD, kX509, 0);
416 } 431 }
417 432
418 if (common_cert_sets) { 433 if (common_cert_sets) {
419 out->SetStringPiece(kCCS, common_cert_sets->GetCommonHashes()); 434 out->SetStringPiece(kCCS, common_cert_sets->GetCommonHashes());
420 } 435 }
421 436
437 if (preferred_version > QUIC_VERSION_29) {
438 out->SetStringPiece(kCertificateSCTTag, "");
439 }
440
422 const vector<string>& certs = cached->certs(); 441 const vector<string>& certs = cached->certs();
423 // We save |certs| in the QuicCryptoNegotiatedParameters so that, if the 442 // We save |certs| in the QuicCryptoNegotiatedParameters so that, if the
424 // client config is being used for multiple connections, another connection 443 // client config is being used for multiple connections, another connection
425 // doesn't update the cached certificates and cause us to be unable to 444 // doesn't update the cached certificates and cause us to be unable to
426 // process the server's compressed certificate chain. 445 // process the server's compressed certificate chain.
427 out_params->cached_certs = certs; 446 out_params->cached_certs = certs;
428 if (!certs.empty()) { 447 if (!certs.empty()) {
429 vector<uint64> hashes; 448 vector<uint64> hashes;
430 hashes.reserve(certs.size()); 449 hashes.reserve(certs.size());
431 for (vector<string>::const_iterator i = certs.begin(); 450 for (vector<string>::const_iterator i = certs.begin();
(...skipping 28 matching lines...) Expand all
460 return QUIC_CRYPTO_INTERNAL_ERROR; 479 return QUIC_CRYPTO_INTERNAL_ERROR;
461 } 480 }
462 481
463 StringPiece scid; 482 StringPiece scid;
464 if (!scfg->GetStringPiece(kSCID, &scid)) { 483 if (!scfg->GetStringPiece(kSCID, &scid)) {
465 *error_details = "SCFG missing SCID"; 484 *error_details = "SCFG missing SCID";
466 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 485 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
467 } 486 }
468 out->SetStringPiece(kSCID, scid); 487 out->SetStringPiece(kSCID, scid);
469 488
489 if (preferred_version > QUIC_VERSION_29) {
490 out->SetStringPiece(kCertificateSCTTag, "");
491 }
492
470 const QuicTag* their_aeads; 493 const QuicTag* their_aeads;
471 const QuicTag* their_key_exchanges; 494 const QuicTag* their_key_exchanges;
472 size_t num_their_aeads, num_their_key_exchanges; 495 size_t num_their_aeads, num_their_key_exchanges;
473 if (scfg->GetTaglist(kAEAD, &their_aeads, 496 if (scfg->GetTaglist(kAEAD, &their_aeads,
474 &num_their_aeads) != QUIC_NO_ERROR || 497 &num_their_aeads) != QUIC_NO_ERROR ||
475 scfg->GetTaglist(kKEXS, &their_key_exchanges, 498 scfg->GetTaglist(kKEXS, &their_key_exchanges,
476 &num_their_key_exchanges) != QUIC_NO_ERROR) { 499 &num_their_key_exchanges) != QUIC_NO_ERROR) {
477 *error_details = "Missing AEAD or KEXS"; 500 *error_details = "Missing AEAD or KEXS";
478 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 501 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
479 } 502 }
(...skipping 10 matching lines...) Expand all
490 !QuicUtils::FindMutualTag( 513 !QuicUtils::FindMutualTag(
491 kexs, their_key_exchanges, num_their_key_exchanges, 514 kexs, their_key_exchanges, num_their_key_exchanges,
492 QuicUtils::LOCAL_PRIORITY, &out_params->key_exchange, 515 QuicUtils::LOCAL_PRIORITY, &out_params->key_exchange,
493 &key_exchange_index)) { 516 &key_exchange_index)) {
494 *error_details = "Unsupported AEAD or KEXS"; 517 *error_details = "Unsupported AEAD or KEXS";
495 return QUIC_CRYPTO_NO_SUPPORT; 518 return QUIC_CRYPTO_NO_SUPPORT;
496 } 519 }
497 out->SetTaglist(kAEAD, out_params->aead, 0); 520 out->SetTaglist(kAEAD, out_params->aead, 0);
498 out->SetTaglist(kKEXS, out_params->key_exchange, 0); 521 out->SetTaglist(kKEXS, out_params->key_exchange, 0);
499 522
523 if (!tb_key_params.empty()) {
524 const QuicTag* their_tbkps;
525 size_t num_their_tbkps;
526 switch (scfg->GetTaglist(kTBKP, &their_tbkps, &num_their_tbkps)) {
527 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
528 break;
529 case QUIC_NO_ERROR:
530 if (QuicUtils::FindMutualTag(tb_key_params, their_tbkps,
531 num_their_tbkps, QuicUtils::LOCAL_PRIORITY,
532 &out_params->token_binding_key_param,
533 nullptr)) {
534 out->SetTaglist(kTBKP, out_params->token_binding_key_param, 0);
535 }
536 break;
537 default:
538 *error_details = "Invalid TBKP";
539 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
540 }
541 }
542
500 StringPiece public_value; 543 StringPiece public_value;
501 if (scfg->GetNthValue24(kPUBS, key_exchange_index, &public_value) != 544 if (scfg->GetNthValue24(kPUBS, key_exchange_index, &public_value) !=
502 QUIC_NO_ERROR) { 545 QUIC_NO_ERROR) {
503 *error_details = "Missing public value"; 546 *error_details = "Missing public value";
504 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 547 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
505 } 548 }
506 549
507 StringPiece orbit; 550 StringPiece orbit;
508 if (!scfg->GetStringPiece(kORBT, &orbit) || orbit.size() != kOrbitSize) { 551 if (!scfg->GetStringPiece(kORBT, &orbit) || orbit.size() != kOrbitSize) {
509 *error_details = "SCFG missing OBIT"; 552 *error_details = "SCFG missing OBIT";
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 *error_details = "Symmetric key setup failed"; 681 *error_details = "Symmetric key setup failed";
639 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED; 682 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
640 } 683 }
641 684
642 return QUIC_NO_ERROR; 685 return QUIC_NO_ERROR;
643 } 686 }
644 687
645 QuicErrorCode QuicCryptoClientConfig::CacheNewServerConfig( 688 QuicErrorCode QuicCryptoClientConfig::CacheNewServerConfig(
646 const CryptoHandshakeMessage& message, 689 const CryptoHandshakeMessage& message,
647 QuicWallTime now, 690 QuicWallTime now,
691 const QuicVersion version,
648 const vector<string>& cached_certs, 692 const vector<string>& cached_certs,
649 CachedState* cached, 693 CachedState* cached,
650 string* error_details) { 694 string* error_details) {
651 DCHECK(error_details != nullptr); 695 DCHECK(error_details != nullptr);
652 696
653 StringPiece scfg; 697 StringPiece scfg;
654 if (!message.GetStringPiece(kSCFG, &scfg)) { 698 if (!message.GetStringPiece(kSCFG, &scfg)) {
655 *error_details = "Missing SCFG"; 699 *error_details = "Missing SCFG";
656 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; 700 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND;
657 } 701 }
658 702
659 CachedState::ServerConfigState state = cached->SetServerConfig( 703 CachedState::ServerConfigState state = cached->SetServerConfig(
660 scfg, now, error_details); 704 scfg, now, error_details);
661 if (state == CachedState::SERVER_CONFIG_EXPIRED) { 705 if (state == CachedState::SERVER_CONFIG_EXPIRED) {
662 return QUIC_CRYPTO_SERVER_CONFIG_EXPIRED; 706 return QUIC_CRYPTO_SERVER_CONFIG_EXPIRED;
663 } 707 }
664 // TODO(rtenneti): Return more specific error code than returning 708 // TODO(rtenneti): Return more specific error code than returning
665 // QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER. 709 // QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER.
666 if (state != CachedState::SERVER_CONFIG_VALID) { 710 if (state != CachedState::SERVER_CONFIG_VALID) {
667 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 711 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
668 } 712 }
669 713
670 StringPiece token; 714 StringPiece token;
671 if (message.GetStringPiece(kSourceAddressTokenTag, &token)) { 715 if (message.GetStringPiece(kSourceAddressTokenTag, &token)) {
672 cached->set_source_address_token(token); 716 cached->set_source_address_token(token);
673 } 717 }
674 718
675 StringPiece proof, cert_bytes; 719 StringPiece proof, cert_bytes, cert_sct;
676 bool has_proof = message.GetStringPiece(kPROF, &proof); 720 bool has_proof = message.GetStringPiece(kPROF, &proof);
677 bool has_cert = message.GetStringPiece(kCertificateTag, &cert_bytes); 721 bool has_cert = message.GetStringPiece(kCertificateTag, &cert_bytes);
678 if (has_proof && has_cert) { 722 if (has_proof && has_cert) {
679 vector<string> certs; 723 vector<string> certs;
680 if (!CertCompressor::DecompressChain(cert_bytes, cached_certs, 724 if (!CertCompressor::DecompressChain(cert_bytes, cached_certs,
681 common_cert_sets, &certs)) { 725 common_cert_sets, &certs)) {
682 *error_details = "Certificate data invalid"; 726 *error_details = "Certificate data invalid";
683 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 727 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
684 } 728 }
685 729
686 cached->SetProof(certs, proof); 730 if (version > QUIC_VERSION_29) {
731 message.GetStringPiece(kCertificateSCTTag, &cert_sct);
732 }
733 cached->SetProof(certs, cert_sct, proof);
687 } else { 734 } else {
688 // Secure QUIC: clear existing proof as we have been sent a new SCFG 735 // Secure QUIC: clear existing proof as we have been sent a new SCFG
689 // without matching proof/certs. 736 // without matching proof/certs.
690 cached->ClearProof(); 737 cached->ClearProof();
691 738
692 if (has_proof && !has_cert) { 739 if (has_proof && !has_cert) {
693 *error_details = "Certificate missing"; 740 *error_details = "Certificate missing";
694 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 741 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
695 } 742 }
696 743
697 if (!has_proof && has_cert) { 744 if (!has_proof && has_cert) {
698 *error_details = "Proof missing"; 745 *error_details = "Proof missing";
699 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 746 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
700 } 747 }
701 } 748 }
702 749
703 return QUIC_NO_ERROR; 750 return QUIC_NO_ERROR;
704 } 751 }
705 752
706 QuicErrorCode QuicCryptoClientConfig::ProcessRejection( 753 QuicErrorCode QuicCryptoClientConfig::ProcessRejection(
707 const CryptoHandshakeMessage& rej, 754 const CryptoHandshakeMessage& rej,
708 QuicWallTime now, 755 QuicWallTime now,
756 const QuicVersion version,
709 CachedState* cached, 757 CachedState* cached,
710 QuicCryptoNegotiatedParameters* out_params, 758 QuicCryptoNegotiatedParameters* out_params,
711 string* error_details) { 759 string* error_details) {
712 DCHECK(error_details != nullptr); 760 DCHECK(error_details != nullptr);
713 761
714 if ((rej.tag() != kREJ) && (rej.tag() != kSREJ)) { 762 if ((rej.tag() != kREJ) && (rej.tag() != kSREJ)) {
715 *error_details = "Message is not REJ or SREJ"; 763 *error_details = "Message is not REJ or SREJ";
716 return QUIC_CRYPTO_INTERNAL_ERROR; 764 return QUIC_CRYPTO_INTERNAL_ERROR;
717 } 765 }
718 766
719 QuicErrorCode error = CacheNewServerConfig(rej, now, out_params->cached_certs, 767 QuicErrorCode error = CacheNewServerConfig(
720 cached, error_details); 768 rej, now, version, out_params->cached_certs, cached, error_details);
721 if (error != QUIC_NO_ERROR) { 769 if (error != QUIC_NO_ERROR) {
722 return error; 770 return error;
723 } 771 }
724 772
725 StringPiece nonce; 773 StringPiece nonce;
726 if (rej.GetStringPiece(kServerNonceTag, &nonce)) { 774 if (rej.GetStringPiece(kServerNonceTag, &nonce)) {
727 out_params->server_nonce = nonce.as_string(); 775 out_params->server_nonce = nonce.as_string();
728 } 776 }
729 777
730 const uint32* reject_reasons; 778 const uint32* reject_reasons;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 *error_details = "Symmetric key setup failed"; 870 *error_details = "Symmetric key setup failed";
823 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED; 871 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
824 } 872 }
825 873
826 return QUIC_NO_ERROR; 874 return QUIC_NO_ERROR;
827 } 875 }
828 876
829 QuicErrorCode QuicCryptoClientConfig::ProcessServerConfigUpdate( 877 QuicErrorCode QuicCryptoClientConfig::ProcessServerConfigUpdate(
830 const CryptoHandshakeMessage& server_config_update, 878 const CryptoHandshakeMessage& server_config_update,
831 QuicWallTime now, 879 QuicWallTime now,
880 const QuicVersion version,
832 CachedState* cached, 881 CachedState* cached,
833 QuicCryptoNegotiatedParameters* out_params, 882 QuicCryptoNegotiatedParameters* out_params,
834 string* error_details) { 883 string* error_details) {
835 DCHECK(error_details != nullptr); 884 DCHECK(error_details != nullptr);
836 885
837 if (server_config_update.tag() != kSCUP) { 886 if (server_config_update.tag() != kSCUP) {
838 *error_details = "ServerConfigUpdate must have kSCUP tag."; 887 *error_details = "ServerConfigUpdate must have kSCUP tag.";
839 return QUIC_INVALID_CRYPTO_MESSAGE_TYPE; 888 return QUIC_INVALID_CRYPTO_MESSAGE_TYPE;
840 } 889 }
841 890 return CacheNewServerConfig(server_config_update, now, version,
842 return CacheNewServerConfig(server_config_update, now,
843 out_params->cached_certs, cached, error_details); 891 out_params->cached_certs, cached, error_details);
844 } 892 }
845 893
846 ProofVerifier* QuicCryptoClientConfig::proof_verifier() const { 894 ProofVerifier* QuicCryptoClientConfig::proof_verifier() const {
847 return proof_verifier_.get(); 895 return proof_verifier_.get();
848 } 896 }
849 897
850 ChannelIDSource* QuicCryptoClientConfig::channel_id_source() const { 898 ChannelIDSource* QuicCryptoClientConfig::channel_id_source() const {
851 return channel_id_source_.get(); 899 return channel_id_source_.get();
852 } 900 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } 968 }
921 969
922 // Update canonical version to point at the "most recent" entry. 970 // Update canonical version to point at the "most recent" entry.
923 canonical_server_map_[suffix_server_id] = server_id; 971 canonical_server_map_[suffix_server_id] = server_id;
924 972
925 server_state->InitializeFrom(*canonical_state); 973 server_state->InitializeFrom(*canonical_state);
926 return true; 974 return true;
927 } 975 }
928 976
929 } // namespace net 977 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.h ('k') | net/quic/crypto/quic_crypto_client_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698