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

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

Issue 192583004: QUIC - use QuicSessionKey tuple (host, port, is_https) instead of server_hostname (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with TOT 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 unified diff | Download patch | Annotate | Revision Log
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 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ 5 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_
6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/quic/crypto/crypto_handshake.h" 15 #include "net/quic/crypto/crypto_handshake.h"
16 #include "net/quic/quic_protocol.h" 16 #include "net/quic/quic_protocol.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 class ChannelIDSigner; 20 class ChannelIDSigner;
21 class CryptoHandshakeMessage; 21 class CryptoHandshakeMessage;
22 class ProofVerifier; 22 class ProofVerifier;
23 class ProofVerifyDetails; 23 class ProofVerifyDetails;
24 class QuicRandom; 24 class QuicRandom;
25 class QuicSessionKey;
25 26
26 // QuicCryptoClientConfig contains crypto-related configuration settings for a 27 // QuicCryptoClientConfig contains crypto-related configuration settings for a
27 // client. Note that this object isn't thread-safe. It's designed to be used on 28 // client. Note that this object isn't thread-safe. It's designed to be used on
28 // a single thread at a time. 29 // a single thread at a time.
29 class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig { 30 class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig {
30 public: 31 public:
31 // A CachedState contains the information that the client needs in order to 32 // A CachedState contains the information that the client needs in order to
32 // perform a 0-RTT handshake with a server. This information can be reused 33 // perform a 0-RTT handshake with a server. This information can be reused
33 // over several connections to the same server. 34 // over several connections to the same server.
34 class NET_EXPORT_PRIVATE CachedState { 35 class NET_EXPORT_PRIVATE CachedState {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 125
125 DISALLOW_COPY_AND_ASSIGN(CachedState); 126 DISALLOW_COPY_AND_ASSIGN(CachedState);
126 }; 127 };
127 128
128 QuicCryptoClientConfig(); 129 QuicCryptoClientConfig();
129 ~QuicCryptoClientConfig(); 130 ~QuicCryptoClientConfig();
130 131
131 // Sets the members to reasonable, default values. 132 // Sets the members to reasonable, default values.
132 void SetDefaults(); 133 void SetDefaults();
133 134
134 // LookupOrCreate returns a CachedState for the given hostname. If no such 135 // LookupOrCreate returns a CachedState for the given |server_key|. If no such
135 // CachedState currently exists, it will be created and cached. 136 // CachedState currently exists, it will be created and cached.
136 CachedState* LookupOrCreate(const std::string& server_hostname); 137 CachedState* LookupOrCreate(const QuicSessionKey& server_key);
137 138
138 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a 139 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a
139 // source-address token or SCFG from a server. If |cached| is non-NULL, the 140 // source-address token or SCFG from a server. If |cached| is non-NULL, the
140 // source-address token will be taken from it. |out_params| is used in order 141 // source-address token will be taken from it. |out_params| is used in order
141 // to store the cached certs that were sent as hints to the server in 142 // to store the cached certs that were sent as hints to the server in
142 // |out_params->cached_certs|. |preferred_version| is the version of the 143 // |out_params->cached_certs|. |preferred_version| is the version of the
143 // QUIC protocol that this client chose to use initially. This allows the 144 // QUIC protocol that this client chose to use initially. This allows the
144 // server to detect downgrade attacks. 145 // server to detect downgrade attacks.
145 void FillInchoateClientHello(const std::string& server_hostname, 146 void FillInchoateClientHello(const std::string& server_hostname,
146 const QuicVersion preferred_version, 147 const QuicVersion preferred_version,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void SetProofVerifier(ProofVerifier* verifier); 205 void SetProofVerifier(ProofVerifier* verifier);
205 206
206 ChannelIDSigner* channel_id_signer() const; 207 ChannelIDSigner* channel_id_signer() const;
207 208
208 // SetChannelIDSigner sets a ChannelIDSigner that will be called when the 209 // SetChannelIDSigner sets a ChannelIDSigner that will be called when the
209 // server supports channel IDs to sign a message proving possession of the 210 // server supports channel IDs to sign a message proving possession of the
210 // given ChannelID. This object takes ownership of |signer|. 211 // given ChannelID. This object takes ownership of |signer|.
211 void SetChannelIDSigner(ChannelIDSigner* signer); 212 void SetChannelIDSigner(ChannelIDSigner* signer);
212 213
213 // Initialize the CachedState from |canonical_crypto_config| for the 214 // Initialize the CachedState from |canonical_crypto_config| for the
214 // |canonical_server_hostname| as the initial CachedState for 215 // |canonical_server_key| as the initial CachedState for |server_key|. We will
215 // |server_hostname|. We will copy config data only if 216 // copy config data only if |canonical_crypto_config| has valid proof.
216 // |canonical_crypto_config| has valid proof. 217 void InitializeFrom(const QuicSessionKey& server_key,
217 void InitializeFrom(const std::string& server_hostname, 218 const QuicSessionKey& canonical_server_key,
218 const std::string& canonical_server_hostname,
219 QuicCryptoClientConfig* canonical_crypto_config); 219 QuicCryptoClientConfig* canonical_crypto_config);
220 220
221 private: 221 private:
222 // cached_states_ maps from the server hostname to the cached information 222 // cached_states_ maps from the server_key to the cached information about
223 // about that server. 223 // that server.
224 std::map<std::string, CachedState*> cached_states_; 224 std::map<QuicSessionKey, CachedState*> cached_states_;
225 225
226 scoped_ptr<ProofVerifier> proof_verifier_; 226 scoped_ptr<ProofVerifier> proof_verifier_;
227 scoped_ptr<ChannelIDSigner> channel_id_signer_; 227 scoped_ptr<ChannelIDSigner> channel_id_signer_;
228 228
229 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); 229 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig);
230 }; 230 };
231 231
232 } // namespace net 232 } // namespace net
233 233
234 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ 234 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698