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 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_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/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
17 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
18 #include "net/quic/crypto/crypto_handshake.h" | 18 #include "net/quic/crypto/crypto_handshake.h" |
19 #include "net/quic/crypto/crypto_handshake_message.h" | 19 #include "net/quic/crypto/crypto_handshake_message.h" |
20 #include "net/quic/crypto/crypto_protocol.h" | 20 #include "net/quic/crypto/crypto_protocol.h" |
21 #include "net/quic/crypto/crypto_secret_boxer.h" | 21 #include "net/quic/crypto/crypto_secret_boxer.h" |
| 22 #include "net/quic/crypto/source_address_token.h" |
22 #include "net/quic/quic_time.h" | 23 #include "net/quic/quic_time.h" |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 | 26 |
26 class CryptoHandshakeMessage; | 27 class CryptoHandshakeMessage; |
27 class EphemeralKeySource; | 28 class EphemeralKeySource; |
28 class KeyExchange; | 29 class KeyExchange; |
29 class ProofSource; | 30 class ProofSource; |
30 class QuicClock; | 31 class QuicClock; |
31 class QuicDecrypter; | 32 class QuicDecrypter; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 QuicConnectionId connection_id, | 205 QuicConnectionId connection_id, |
205 IPEndPoint client_address, | 206 IPEndPoint client_address, |
206 QuicVersion version, | 207 QuicVersion version, |
207 const QuicVersionVector& supported_versions, | 208 const QuicVersionVector& supported_versions, |
208 const QuicClock* clock, | 209 const QuicClock* clock, |
209 QuicRandom* rand, | 210 QuicRandom* rand, |
210 QuicCryptoNegotiatedParameters* params, | 211 QuicCryptoNegotiatedParameters* params, |
211 CryptoHandshakeMessage* out, | 212 CryptoHandshakeMessage* out, |
212 std::string* error_details) const; | 213 std::string* error_details) const; |
213 | 214 |
| 215 // BuildServerConfigUpdateMessage sets |out| to be a SCUP message containing |
| 216 // the current primary config, an up to date source-address token, and cert |
| 217 // chain and proof in the case of secure QUIC. Returns true if successfully |
| 218 // filled |out|. |
| 219 // |
| 220 // |cached_network_params| is optional, and can be NULL. |
214 bool BuildServerConfigUpdateMessage( | 221 bool BuildServerConfigUpdateMessage( |
215 const IPEndPoint& client_ip, | 222 const IPEndPoint& client_ip, |
216 const QuicClock* clock, | 223 const QuicClock* clock, |
217 QuicRandom* rand, | 224 QuicRandom* rand, |
218 const QuicCryptoNegotiatedParameters& params, | 225 const QuicCryptoNegotiatedParameters& params, |
| 226 const CachedNetworkParameters* cached_network_params, |
219 CryptoHandshakeMessage* out) const; | 227 CryptoHandshakeMessage* out) const; |
220 | 228 |
221 // SetProofSource installs |proof_source| as the ProofSource for handshakes. | 229 // SetProofSource installs |proof_source| as the ProofSource for handshakes. |
222 // This object takes ownership of |proof_source|. | 230 // This object takes ownership of |proof_source|. |
223 void SetProofSource(ProofSource* proof_source); | 231 void SetProofSource(ProofSource* proof_source); |
224 | 232 |
225 // SetEphemeralKeySource installs an object that can cache ephemeral keys for | 233 // SetEphemeralKeySource installs an object that can cache ephemeral keys for |
226 // a short period of time. This object takes ownership of | 234 // a short period of time. This object takes ownership of |
227 // |ephemeral_key_source|. If not set then ephemeral keys will be generated | 235 // |ephemeral_key_source|. If not set then ephemeral keys will be generated |
228 // per-connection. | 236 // per-connection. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 QuicRandom* rand, | 389 QuicRandom* rand, |
382 QuicCryptoNegotiatedParameters *params, | 390 QuicCryptoNegotiatedParameters *params, |
383 CryptoHandshakeMessage* out) const; | 391 CryptoHandshakeMessage* out) const; |
384 | 392 |
385 // ParseConfigProtobuf parses the given config protobuf and returns a | 393 // ParseConfigProtobuf parses the given config protobuf and returns a |
386 // scoped_refptr<Config> if successful. The caller adopts the reference to the | 394 // scoped_refptr<Config> if successful. The caller adopts the reference to the |
387 // Config. On error, ParseConfigProtobuf returns NULL. | 395 // Config. On error, ParseConfigProtobuf returns NULL. |
388 scoped_refptr<Config> ParseConfigProtobuf(QuicServerConfigProtobuf* protobuf); | 396 scoped_refptr<Config> ParseConfigProtobuf(QuicServerConfigProtobuf* protobuf); |
389 | 397 |
390 // NewSourceAddressToken returns a fresh source address token for the given | 398 // NewSourceAddressToken returns a fresh source address token for the given |
391 // IP address. | 399 // IP address. |cached_network_params| is optional, and can be NULL. |
392 std::string NewSourceAddressToken(const Config& config, | 400 std::string NewSourceAddressToken( |
393 const IPEndPoint& ip, | 401 const Config& config, |
394 QuicRandom* rand, | 402 const IPEndPoint& ip, |
395 QuicWallTime now) const; | 403 QuicRandom* rand, |
| 404 QuicWallTime now, |
| 405 const CachedNetworkParameters* cached_network_params) const; |
396 | 406 |
397 // ValidateSourceAddressToken returns HANDSHAKE_OK if the source address token | 407 // ValidateSourceAddressToken returns HANDSHAKE_OK if the source address token |
398 // in |token| is a valid and timely token for the IP address |ip| given that | 408 // in |token| is a valid and timely token for the IP address |ip| given that |
399 // the current time is |now|. Otherwise it returns the reason for failure. | 409 // the current time is |now|. Otherwise it returns the reason for failure. |
400 HandshakeFailureReason ValidateSourceAddressToken(const Config& config, | 410 HandshakeFailureReason ValidateSourceAddressToken(const Config& config, |
401 base::StringPiece token, | 411 base::StringPiece token, |
402 const IPEndPoint& ip, | 412 const IPEndPoint& ip, |
403 QuicWallTime now) const; | 413 QuicWallTime now) const; |
404 | 414 |
405 // NewServerNonce generates and encrypts a random nonce. | 415 // NewServerNonce generates and encrypts a random nonce. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 uint32 source_address_token_lifetime_secs_; | 488 uint32 source_address_token_lifetime_secs_; |
479 uint32 server_nonce_strike_register_max_entries_; | 489 uint32 server_nonce_strike_register_max_entries_; |
480 uint32 server_nonce_strike_register_window_secs_; | 490 uint32 server_nonce_strike_register_window_secs_; |
481 | 491 |
482 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); | 492 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); |
483 }; | 493 }; |
484 | 494 |
485 } // namespace net | 495 } // namespace net |
486 | 496 |
487 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 497 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
OLD | NEW |