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

Unified Diff: net/quic/crypto/quic_crypto_client_config.cc

Issue 218923002: Merge internal change: 63891842 - QuicServerId changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/crypto/quic_crypto_client_config.cc
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index 83dca7d0418c85e2df8b7ed71a89479b2e7e8a9c..aed27a056050b12fac23b9c8bc3f894678034032 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -17,7 +17,7 @@
#include "net/quic/crypto/p256_key_exchange.h"
#include "net/quic/crypto/proof_verifier.h"
#include "net/quic/crypto/quic_encrypter.h"
-#include "net/quic/quic_session_key.h"
+#include "net/quic/quic_server_id.h"
#include "net/quic/quic_utils.h"
#if defined(OS_WIN)
@@ -261,20 +261,20 @@ void QuicCryptoClientConfig::SetDefaults() {
}
QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
- const QuicSessionKey& server_key) {
- CachedStateMap::const_iterator it = cached_states_.find(server_key);
+ const QuicServerId& server_id) {
+ CachedStateMap::const_iterator it = cached_states_.find(server_id);
if (it != cached_states_.end()) {
return it->second;
}
CachedState* cached = new CachedState;
- cached_states_.insert(make_pair(server_key, cached));
- PopulateFromCanonicalConfig(server_key, cached);
+ cached_states_.insert(make_pair(server_id, cached));
+ PopulateFromCanonicalConfig(server_id, cached);
return cached;
}
void QuicCryptoClientConfig::FillInchoateClientHello(
- const QuicSessionKey& server_key,
+ const QuicServerId& server_id,
const QuicVersion preferred_version,
const CachedState* cached,
QuicCryptoNegotiatedParameters* out_params,
@@ -284,8 +284,8 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
// Server name indication. We only send SNI if it's a valid domain name, as
// per the spec.
- if (CryptoUtils::IsValidSNI(server_key.host())) {
- out->SetStringPiece(kSNI, server_key.host());
+ if (CryptoUtils::IsValidSNI(server_id.host())) {
+ out->SetStringPiece(kSNI, server_id.host());
}
out->SetValue(kVER, QuicVersionToQuicTag(preferred_version));
@@ -293,7 +293,7 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
out->SetStringPiece(kSourceAddressTokenTag, cached->source_address_token());
}
- if (server_key.is_https()) {
+ if (server_id.is_https()) {
// Don't request ECDSA proofs on platforms that do not support ECDSA
// certificates.
bool disableECDSA = false;
@@ -330,7 +330,7 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
}
QuicErrorCode QuicCryptoClientConfig::FillClientHello(
- const QuicSessionKey& server_key,
+ const QuicServerId& server_id,
QuicConnectionId connection_id,
const QuicVersion preferred_version,
uint32 initial_flow_control_window_bytes,
@@ -342,7 +342,7 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
string* error_details) const {
DCHECK(error_details != NULL);
- FillInchoateClientHello(server_key, preferred_version, cached,
+ FillInchoateClientHello(server_id, preferred_version, cached,
out_params, out);
// Set initial receive window for flow control.
@@ -470,7 +470,7 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
hkdf_input.append(cached->server_config());
string key, signature;
- if (!channel_id_signer_->Sign(server_key.host(), hkdf_input,
+ if (!channel_id_signer_->Sign(server_id.host(), hkdf_input,
&key, &signature)) {
*error_details = "Channel ID signature failed";
return QUIC_INVALID_CHANNEL_ID_SIGNATURE;
@@ -683,15 +683,15 @@ void QuicCryptoClientConfig::SetChannelIDSigner(ChannelIDSigner* signer) {
}
void QuicCryptoClientConfig::InitializeFrom(
- const QuicSessionKey& server_key,
- const QuicSessionKey& canonical_server_key,
+ const QuicServerId& server_id,
+ const QuicServerId& canonical_server_id,
QuicCryptoClientConfig* canonical_crypto_config) {
CachedState* canonical_cached =
- canonical_crypto_config->LookupOrCreate(canonical_server_key);
+ canonical_crypto_config->LookupOrCreate(canonical_server_id);
if (!canonical_cached->proof_valid()) {
return;
}
- CachedState* cached = LookupOrCreate(server_key);
+ CachedState* cached = LookupOrCreate(server_id);
cached->InitializeFrom(*canonical_cached);
}
@@ -712,37 +712,37 @@ void QuicCryptoClientConfig::PreferAesGcm() {
}
void QuicCryptoClientConfig::PopulateFromCanonicalConfig(
- const QuicSessionKey& server_key,
+ const QuicServerId& server_id,
CachedState* server_state) {
DCHECK(server_state->IsEmpty());
unsigned i = 0;
for (; i < canoncial_suffixes_.size(); ++i) {
- if (EndsWith(server_key.host(), canoncial_suffixes_[i], false)) {
+ if (EndsWith(server_id.host(), canoncial_suffixes_[i], false)) {
break;
}
}
if (i == canoncial_suffixes_.size())
return;
- QuicSessionKey suffix_server_key(canoncial_suffixes_[i], server_key.port(),
- server_key.is_https(),
- server_key.privacy_mode());
- if (!ContainsKey(canonical_server_map_, suffix_server_key)) {
+ QuicServerId suffix_server_id(canoncial_suffixes_[i], server_id.port(),
+ server_id.is_https(),
+ server_id.privacy_mode());
+ if (!ContainsKey(canonical_server_map_, suffix_server_id)) {
// This is the first host we've seen which matches the suffix, so make it
// canonical.
- canonical_server_map_[suffix_server_key] = server_key;
+ canonical_server_map_[suffix_server_id] = server_id;
return;
}
- const QuicSessionKey& canonical_server_key =
- canonical_server_map_[suffix_server_key];
- CachedState* canonical_state = cached_states_[canonical_server_key];
+ const QuicServerId& canonical_server_id =
+ canonical_server_map_[suffix_server_id];
+ CachedState* canonical_state = cached_states_[canonical_server_id];
if (!canonical_state->proof_valid()) {
return;
}
// Update canonical version to point at the "most recent" entry.
- canonical_server_map_[suffix_server_key] = server_key;
+ canonical_server_map_[suffix_server_id] = server_id;
server_state->InitializeFrom(*canonical_state);
}

Powered by Google App Engine
This is Rietveld 408576698