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

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

Issue 1660533002: Landing Recent QUIC changes until 01/26/2016 18:14 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.h ('k') | net/quic/quic_arena_scoped_ptr_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 10
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 SelectNewPrimaryConfig(now); 515 SelectNewPrimaryConfig(now);
516 DCHECK(primary_config_.get()); 516 DCHECK(primary_config_.get());
517 DCHECK_EQ(configs_.find(primary_config_->id)->second, primary_config_); 517 DCHECK_EQ(configs_.find(primary_config_->id)->second, primary_config_);
518 } 518 }
519 519
520 memcpy(primary_orbit, primary_config_->orbit, sizeof(primary_orbit)); 520 memcpy(primary_orbit, primary_config_->orbit, sizeof(primary_orbit));
521 } 521 }
522 522
523 requested_config = GetConfigWithScid(requested_scid); 523 requested_config = GetConfigWithScid(requested_scid);
524 primary_config = primary_config_; 524 primary_config = primary_config_;
525 crypto_proof->primary_scid = primary_config->id; 525 if (FLAGS_quic_crypto_proof_use_ref) {
526 crypto_proof->config = primary_config_;
527 } else {
528 crypto_proof->primary_scid = primary_config->id;
529 }
526 } 530 }
527 531
528 if (result->error_code == QUIC_NO_ERROR) { 532 if (result->error_code == QUIC_NO_ERROR) {
529 EvaluateClientHello(server_ip, version, primary_orbit, requested_config, 533 EvaluateClientHello(server_ip, version, primary_orbit, requested_config,
530 primary_config, crypto_proof, result, done_cb); 534 primary_config, crypto_proof, result, done_cb);
531 } else { 535 } else {
532 done_cb->Run(result); 536 done_cb->Run(result);
533 } 537 }
534 } 538 }
535 539
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 579
576 if (!next_config_promotion_time_.IsZero() && 580 if (!next_config_promotion_time_.IsZero() &&
577 next_config_promotion_time_.IsAfter(now)) { 581 next_config_promotion_time_.IsAfter(now)) {
578 SelectNewPrimaryConfig(now); 582 SelectNewPrimaryConfig(now);
579 DCHECK(primary_config_.get()); 583 DCHECK(primary_config_.get());
580 DCHECK_EQ(configs_.find(primary_config_->id)->second, primary_config_); 584 DCHECK_EQ(configs_.find(primary_config_->id)->second, primary_config_);
581 } 585 }
582 586
583 // Use the config that the client requested in order to do key-agreement. 587 // Use the config that the client requested in order to do key-agreement.
584 // Otherwise give it a copy of |primary_config_| to use. 588 // Otherwise give it a copy of |primary_config_| to use.
585 primary_config = GetConfigWithScid(crypto_proof->primary_scid); 589 if (FLAGS_quic_crypto_proof_use_ref) {
590 primary_config = crypto_proof->config;
591 } else {
592 primary_config = GetConfigWithScid(crypto_proof->primary_scid);
593 }
586 if (!primary_config) { 594 if (!primary_config) {
587 *error_details = "Configuration not found"; 595 *error_details = "Configuration not found";
588 QUIC_BUG << "Primary config not found"; 596 QUIC_BUG << "Primary config not found";
589 return QUIC_CRYPTO_INTERNAL_ERROR; 597 return QUIC_CRYPTO_INTERNAL_ERROR;
590 } 598 }
591 599
592 requested_config = GetConfigWithScid(requested_scid); 600 requested_config = GetConfigWithScid(requested_scid);
593 } 601 }
594 602
595 if (validate_chlo_result.error_code != QUIC_NO_ERROR) { 603 if (validate_chlo_result.error_code != QUIC_NO_ERROR) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 745 }
738 746
739 char plaintext[kMaxPacketSize]; 747 char plaintext[kMaxPacketSize];
740 size_t plaintext_length = 0; 748 size_t plaintext_length = 0;
741 const bool success = crypters.decrypter->DecryptPacket( 749 const bool success = crypters.decrypter->DecryptPacket(
742 kDefaultPathId, 0 /* packet number */, 750 kDefaultPathId, 0 /* packet number */,
743 StringPiece() /* associated data */, cetv_ciphertext, plaintext, 751 StringPiece() /* associated data */, cetv_ciphertext, plaintext,
744 &plaintext_length, kMaxPacketSize); 752 &plaintext_length, kMaxPacketSize);
745 if (!success) { 753 if (!success) {
746 *error_details = "CETV decryption failure"; 754 *error_details = "CETV decryption failure";
747 return QUIC_PACKET_TOO_LARGE; 755 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
748 } 756 }
749 scoped_ptr<CryptoHandshakeMessage> cetv( 757 scoped_ptr<CryptoHandshakeMessage> cetv(
750 CryptoFramer::ParseMessage(StringPiece(plaintext, plaintext_length))); 758 CryptoFramer::ParseMessage(StringPiece(plaintext, plaintext_length)));
751 if (!cetv.get()) { 759 if (!cetv.get()) {
752 *error_details = "CETV parse error"; 760 *error_details = "CETV parse error";
753 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; 761 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
754 } 762 }
755 763
756 StringPiece key, signature; 764 StringPiece key, signature;
757 if (cetv->GetStringPiece(kCIDK, &key) && 765 if (cetv->GetStringPiece(kCIDK, &key) &&
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 : channel_id_enabled(false), 1804 : channel_id_enabled(false),
1797 is_primary(false), 1805 is_primary(false),
1798 primary_time(QuicWallTime::Zero()), 1806 primary_time(QuicWallTime::Zero()),
1799 priority(0), 1807 priority(0),
1800 source_address_token_boxer(nullptr) {} 1808 source_address_token_boxer(nullptr) {}
1801 1809
1802 QuicCryptoServerConfig::Config::~Config() { 1810 QuicCryptoServerConfig::Config::~Config() {
1803 STLDeleteElements(&key_exchanges); 1811 STLDeleteElements(&key_exchanges);
1804 } 1812 }
1805 1813
1814 QuicCryptoProof::QuicCryptoProof() : certs(nullptr) {}
1815 QuicCryptoProof::~QuicCryptoProof() {}
1806 } // namespace net 1816 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.h ('k') | net/quic/quic_arena_scoped_ptr_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698