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

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

Issue 14651009: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integer constant is too large for 'unsigned long' type Created 7 years, 7 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
« no previous file with comments | « net/quic/crypto/common_cert_set_test.cc ('k') | net/quic/crypto/crypto_handshake.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_CRYPTO_HANDSHAKE_H_ 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_
6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ 6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_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_protocol.h" 15 #include "net/quic/crypto/crypto_protocol.h"
16 #include "net/quic/quic_protocol.h" 16 #include "net/quic/quic_protocol.h"
17 #include "net/quic/quic_time.h" 17 #include "net/quic/quic_time.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 class CommonCertSet;
21 class KeyExchange; 22 class KeyExchange;
22 class ProofVerifier; 23 class ProofVerifier;
23 class QuicClock; 24 class QuicClock;
24 class QuicDecrypter; 25 class QuicDecrypter;
25 class QuicEncrypter; 26 class QuicEncrypter;
26 class QuicRandom; 27 class QuicRandom;
27 28
28 // An intermediate format of a handshake message that's convenient for a 29 // An intermediate format of a handshake message that's convenient for a
29 // CryptoFramer to serialize from or parse into. 30 // CryptoFramer to serialize from or parse into.
30 class NET_EXPORT_PRIVATE CryptoHandshakeMessage { 31 class NET_EXPORT_PRIVATE CryptoHandshakeMessage {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ~QuicCryptoNegotiatedParameters(); 128 ~QuicCryptoNegotiatedParameters();
128 129
129 uint16 version; 130 uint16 version;
130 CryptoTag key_exchange; 131 CryptoTag key_exchange;
131 CryptoTag aead; 132 CryptoTag aead;
132 std::string premaster_secret; 133 std::string premaster_secret;
133 scoped_ptr<QuicEncrypter> encrypter; 134 scoped_ptr<QuicEncrypter> encrypter;
134 scoped_ptr<QuicDecrypter> decrypter; 135 scoped_ptr<QuicDecrypter> decrypter;
135 std::string server_config_id; 136 std::string server_config_id;
136 std::string server_nonce; 137 std::string server_nonce;
138 // cached_certs contains the cached certificates that a client used when
139 // sending a client hello.
140 std::vector<std::string> cached_certs;
137 }; 141 };
138 142
139 // QuicCryptoConfig contains common configuration between clients and servers. 143 // QuicCryptoConfig contains common configuration between clients and servers.
140 class NET_EXPORT_PRIVATE QuicCryptoConfig { 144 class NET_EXPORT_PRIVATE QuicCryptoConfig {
141 public: 145 public:
142 enum { 146 enum {
143 // CONFIG_VERSION is the one (and, for the moment, only) version number that 147 // CONFIG_VERSION is the one (and, for the moment, only) version number that
144 // we implement. 148 // we implement.
145 CONFIG_VERSION = 0, 149 CONFIG_VERSION = 0,
146 }; 150 };
147 151
148 // kLabel is constant that is used in key derivation to tie the resulting key 152 // kLabel is constant that is used in key derivation to tie the resulting key
149 // to this protocol. 153 // to this protocol.
150 static const char kLabel[]; 154 static const char kLabel[];
151 155
152 QuicCryptoConfig(); 156 QuicCryptoConfig();
153 ~QuicCryptoConfig(); 157 ~QuicCryptoConfig();
154 158
155 // Protocol version 159 // Protocol version
156 uint16 version; 160 uint16 version;
157 // Key exchange methods. The following two members' values correspond by 161 // Key exchange methods. The following two members' values correspond by
158 // index. 162 // index.
159 CryptoTagVector kexs; 163 CryptoTagVector kexs;
160 // Authenticated encryption with associated data (AEAD) algorithms. 164 // Authenticated encryption with associated data (AEAD) algorithms.
161 CryptoTagVector aead; 165 CryptoTagVector aead;
162 166
167 scoped_ptr<CommonCertSet> common_cert_set_;
168
163 private: 169 private:
164 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); 170 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig);
165 }; 171 };
166 172
167 // QuicCryptoClientConfig contains crypto-related configuration settings for a 173 // QuicCryptoClientConfig contains crypto-related configuration settings for a
168 // client. Note that this object isn't thread-safe. It's designed to be used on 174 // client. Note that this object isn't thread-safe. It's designed to be used on
169 // a single thread at a time. 175 // a single thread at a time.
170 class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig { 176 class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig {
171 public: 177 public:
172 // A CachedState contains the information that the client needs in order to 178 // A CachedState contains the information that the client needs in order to
(...skipping 12 matching lines...) Expand all
185 // if |server_config| is empty. The return value is owned by this object 191 // if |server_config| is empty. The return value is owned by this object
186 // and is destroyed when this object is. 192 // and is destroyed when this object is.
187 const CryptoHandshakeMessage* GetServerConfig() const; 193 const CryptoHandshakeMessage* GetServerConfig() const;
188 194
189 // SetServerConfig checks that |scfg| parses correctly and stores it in 195 // SetServerConfig checks that |scfg| parses correctly and stores it in
190 // |server_config|. It returns true if the parsing succeeds and false 196 // |server_config|. It returns true if the parsing succeeds and false
191 // otherwise. 197 // otherwise.
192 bool SetServerConfig(base::StringPiece scfg); 198 bool SetServerConfig(base::StringPiece scfg);
193 199
194 // SetProof stores a certificate chain and signature. 200 // SetProof stores a certificate chain and signature.
195 void SetProof(const std::vector<base::StringPiece>& certs, 201 void SetProof(const std::vector<std::string>& certs,
196 base::StringPiece signature); 202 base::StringPiece signature);
197 203
198 // SetProofValid records that the certificate chain and signature have been 204 // SetProofValid records that the certificate chain and signature have been
199 // validated and that it's safe to assume that the server is legitimate. 205 // validated and that it's safe to assume that the server is legitimate.
200 // (Note: this does not check the chain or signature.) 206 // (Note: this does not check the chain or signature.)
201 void SetProofValid(); 207 void SetProofValid();
202 208
203 const std::string& server_config() const; 209 const std::string& server_config() const;
204 const std::string& source_address_token() const; 210 const std::string& source_address_token() const;
205 const std::vector<std::string>& certs() const; 211 const std::vector<std::string>& certs() const;
(...skipping 24 matching lines...) Expand all
230 236
231 // LookupOrCreate returns a CachedState for the given hostname. If no such 237 // LookupOrCreate returns a CachedState for the given hostname. If no such
232 // CachedState currently exists, it will be created and cached. 238 // CachedState currently exists, it will be created and cached.
233 CachedState* LookupOrCreate(const std::string& server_hostname); 239 CachedState* LookupOrCreate(const std::string& server_hostname);
234 240
235 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a 241 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a
236 // source-address token or SCFG from a server. If |cached| is non-NULL, the 242 // source-address token or SCFG from a server. If |cached| is non-NULL, the
237 // source-address token will be taken from it. 243 // source-address token will be taken from it.
238 void FillInchoateClientHello(const std::string& server_hostname, 244 void FillInchoateClientHello(const std::string& server_hostname,
239 const CachedState* cached, 245 const CachedState* cached,
246 QuicCryptoNegotiatedParameters* out_params,
240 CryptoHandshakeMessage* out) const; 247 CryptoHandshakeMessage* out) const;
241 248
242 // FillClientHello sets |out| to be a CHLO message based on the configuration 249 // FillClientHello sets |out| to be a CHLO message based on the configuration
243 // of this object. This object must have cached enough information about 250 // of this object. This object must have cached enough information about
244 // |server_hostname| in order to perform a handshake. This can be checked 251 // |server_hostname| in order to perform a handshake. This can be checked
245 // with the |is_complete| member of |CachedState|. 252 // with the |is_complete| member of |CachedState|.
246 // 253 //
247 // |clock| and |rand| are used to generate the nonce and |out_params| is 254 // |clock| and |rand| are used to generate the nonce and |out_params| is
248 // filled with the results of the handshake that the server is expected to 255 // filled with the results of the handshake that the server is expected to
249 // accept. 256 // accept.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 std::map<std::string, CachedState*> cached_states_; 296 std::map<std::string, CachedState*> cached_states_;
290 297
291 scoped_ptr<ProofVerifier> proof_verifier_; 298 scoped_ptr<ProofVerifier> proof_verifier_;
292 299
293 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); 300 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig);
294 }; 301 };
295 302
296 } // namespace net 303 } // namespace net
297 304
298 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ 305 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/common_cert_set_test.cc ('k') | net/quic/crypto/crypto_handshake.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698