| 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_client_config.h" | 5 #include "net/quic/crypto/quic_crypto_client_config.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "net/quic/crypto/cert_compressor.h" | 9 #include "net/quic/crypto/cert_compressor.h" |
| 10 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" | 10 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (!has_changed) { | 142 if (!has_changed) { |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // If the proof has changed then it needs to be revalidated. | 146 // If the proof has changed then it needs to be revalidated. |
| 147 SetProofInvalid(); | 147 SetProofInvalid(); |
| 148 certs_ = certs; | 148 certs_ = certs; |
| 149 server_config_sig_ = signature.as_string(); | 149 server_config_sig_ = signature.as_string(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void QuicCryptoClientConfig::CachedState::Clear() { |
| 153 server_config_.clear(); |
| 154 source_address_token_.clear(); |
| 155 certs_.clear(); |
| 156 server_config_sig_.clear(); |
| 157 server_config_valid_ = false; |
| 158 proof_verify_details_.reset(); |
| 159 scfg_.reset(); |
| 160 ++generation_counter_; |
| 161 } |
| 162 |
| 152 void QuicCryptoClientConfig::CachedState::ClearProof() { | 163 void QuicCryptoClientConfig::CachedState::ClearProof() { |
| 153 SetProofInvalid(); | 164 SetProofInvalid(); |
| 154 certs_.clear(); | 165 certs_.clear(); |
| 155 server_config_sig_.clear(); | 166 server_config_sig_.clear(); |
| 156 } | 167 } |
| 157 | 168 |
| 158 void QuicCryptoClientConfig::CachedState::SetProofValid() { | 169 void QuicCryptoClientConfig::CachedState::SetProofValid() { |
| 159 server_config_valid_ = true; | 170 server_config_valid_ = true; |
| 160 } | 171 } |
| 161 | 172 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 278 |
| 268 CachedState* cached = new CachedState; | 279 CachedState* cached = new CachedState; |
| 269 cached_states_.insert(make_pair(server_id, cached)); | 280 cached_states_.insert(make_pair(server_id, cached)); |
| 270 PopulateFromCanonicalConfig(server_id, cached); | 281 PopulateFromCanonicalConfig(server_id, cached); |
| 271 return cached; | 282 return cached; |
| 272 } | 283 } |
| 273 | 284 |
| 274 void QuicCryptoClientConfig::ClearCachedStates() { | 285 void QuicCryptoClientConfig::ClearCachedStates() { |
| 275 for (CachedStateMap::const_iterator it = cached_states_.begin(); | 286 for (CachedStateMap::const_iterator it = cached_states_.begin(); |
| 276 it != cached_states_.end(); ++it) { | 287 it != cached_states_.end(); ++it) { |
| 277 CachedState* cached = it->second; | 288 it->second->Clear(); |
| 278 cached->ClearProof(); | |
| 279 cached->InvalidateServerConfig(); | |
| 280 } | 289 } |
| 281 } | 290 } |
| 282 | 291 |
| 283 void QuicCryptoClientConfig::FillInchoateClientHello( | 292 void QuicCryptoClientConfig::FillInchoateClientHello( |
| 284 const QuicServerId& server_id, | 293 const QuicServerId& server_id, |
| 285 const QuicVersion preferred_version, | 294 const QuicVersion preferred_version, |
| 286 const CachedState* cached, | 295 const CachedState* cached, |
| 287 QuicCryptoNegotiatedParameters* out_params, | 296 QuicCryptoNegotiatedParameters* out_params, |
| 288 CryptoHandshakeMessage* out) const { | 297 CryptoHandshakeMessage* out) const { |
| 289 out->set_tag(kCHLO); | 298 out->set_tag(kCHLO); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 return; | 754 return; |
| 746 } | 755 } |
| 747 | 756 |
| 748 // Update canonical version to point at the "most recent" entry. | 757 // Update canonical version to point at the "most recent" entry. |
| 749 canonical_server_map_[suffix_server_id] = server_id; | 758 canonical_server_map_[suffix_server_id] = server_id; |
| 750 | 759 |
| 751 server_state->InitializeFrom(*canonical_state); | 760 server_state->InitializeFrom(*canonical_state); |
| 752 } | 761 } |
| 753 | 762 |
| 754 } // namespace net | 763 } // namespace net |
| OLD | NEW |