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

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

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

Powered by Google App Engine
This is Rietveld 408576698