| 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> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bool p256; | 140 bool p256; |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 // |source_address_token_secret|: secret key material used for encrypting and | 143 // |source_address_token_secret|: secret key material used for encrypting and |
| 144 // decrypting source address tokens. It can be of any length as it is fed | 144 // decrypting source address tokens. It can be of any length as it is fed |
| 145 // into a KDF before use. In tests, use TESTING. | 145 // into a KDF before use. In tests, use TESTING. |
| 146 // |server_nonce_entropy|: an entropy source used to generate the orbit and | 146 // |server_nonce_entropy|: an entropy source used to generate the orbit and |
| 147 // key for server nonces, which are always local to a given instance of a | 147 // key for server nonces, which are always local to a given instance of a |
| 148 // server. | 148 // server. |
| 149 QuicCryptoServerConfig(base::StringPiece source_address_token_secret, | 149 QuicCryptoServerConfig(base::StringPiece source_address_token_secret, |
| 150 QuicRandom* server_nonce_entropy); | 150 QuicRandom* server_nonce_entropy, |
| 151 ProofSource* proof_source); |
| 151 ~QuicCryptoServerConfig(); | 152 ~QuicCryptoServerConfig(); |
| 152 | 153 |
| 153 // TESTING is a magic parameter for passing to the constructor in tests. | 154 // TESTING is a magic parameter for passing to the constructor in tests. |
| 154 static const char TESTING[]; | 155 static const char TESTING[]; |
| 155 | 156 |
| 156 // Generates a QuicServerConfigProtobuf protobuf suitable for | 157 // Generates a QuicServerConfigProtobuf protobuf suitable for |
| 157 // AddConfig and SetConfigs. | 158 // AddConfig and SetConfigs. |
| 158 static QuicServerConfigProtobuf* GenerateConfig( | 159 static QuicServerConfigProtobuf* GenerateConfig( |
| 159 QuicRandom* rand, | 160 QuicRandom* rand, |
| 160 const QuicClock* clock, | 161 const QuicClock* clock, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 bool BuildServerConfigUpdateMessage( | 273 bool BuildServerConfigUpdateMessage( |
| 273 const SourceAddressTokens& previous_source_address_tokens, | 274 const SourceAddressTokens& previous_source_address_tokens, |
| 274 const IPAddressNumber& server_ip, | 275 const IPAddressNumber& server_ip, |
| 275 const IPAddressNumber& client_ip, | 276 const IPAddressNumber& client_ip, |
| 276 const QuicClock* clock, | 277 const QuicClock* clock, |
| 277 QuicRandom* rand, | 278 QuicRandom* rand, |
| 278 const QuicCryptoNegotiatedParameters& params, | 279 const QuicCryptoNegotiatedParameters& params, |
| 279 const CachedNetworkParameters* cached_network_params, | 280 const CachedNetworkParameters* cached_network_params, |
| 280 CryptoHandshakeMessage* out) const; | 281 CryptoHandshakeMessage* out) const; |
| 281 | 282 |
| 282 // SetProofSource installs |proof_source| as the ProofSource for handshakes. | |
| 283 // This object takes ownership of |proof_source|. | |
| 284 void SetProofSource(ProofSource* proof_source); | |
| 285 | |
| 286 // SetEphemeralKeySource installs an object that can cache ephemeral keys for | 283 // SetEphemeralKeySource installs an object that can cache ephemeral keys for |
| 287 // a short period of time. This object takes ownership of | 284 // a short period of time. This object takes ownership of |
| 288 // |ephemeral_key_source|. If not set then ephemeral keys will be generated | 285 // |ephemeral_key_source|. If not set then ephemeral keys will be generated |
| 289 // per-connection. | 286 // per-connection. |
| 290 void SetEphemeralKeySource(EphemeralKeySource* ephemeral_key_source); | 287 void SetEphemeralKeySource(EphemeralKeySource* ephemeral_key_source); |
| 291 | 288 |
| 292 // Install an externall created StrikeRegisterClient for use to | 289 // Install an externall created StrikeRegisterClient for use to |
| 293 // interact with the strike register. This object takes ownership | 290 // interact with the strike register. This object takes ownership |
| 294 // of the |strike_register_client|. | 291 // of the |strike_register_client|. |
| 295 void SetStrikeRegisterClient(StrikeRegisterClient* strike_register_client); | 292 void SetStrikeRegisterClient(StrikeRegisterClient* strike_register_client); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // set_server_nonce_strike_register_window_secs sets the number of seconds | 334 // set_server_nonce_strike_register_window_secs sets the number of seconds |
| 338 // around the current time that the server-nonce strike-register will accept | 335 // around the current time that the server-nonce strike-register will accept |
| 339 // nonces from. Setting a larger value allows for clients to delay follow-up | 336 // nonces from. Setting a larger value allows for clients to delay follow-up |
| 340 // client hellos for longer and still use server nonces as proofs of | 337 // client hellos for longer and still use server nonces as proofs of |
| 341 // uniqueness. | 338 // uniqueness. |
| 342 void set_server_nonce_strike_register_window_secs(uint32 window_secs); | 339 void set_server_nonce_strike_register_window_secs(uint32 window_secs); |
| 343 | 340 |
| 344 // Set and take ownership of the callback to invoke on primary config changes. | 341 // Set and take ownership of the callback to invoke on primary config changes. |
| 345 void AcquirePrimaryConfigChangedCb(PrimaryConfigChangedCallback* cb); | 342 void AcquirePrimaryConfigChangedCb(PrimaryConfigChangedCallback* cb); |
| 346 | 343 |
| 347 // Returns true if this config has a |proof_source_|. | |
| 348 bool HasProofSource() const; | |
| 349 | |
| 350 // Returns the number of configs this object owns. | 344 // Returns the number of configs this object owns. |
| 351 int NumberOfConfigs() const; | 345 int NumberOfConfigs() const; |
| 352 | 346 |
| 353 private: | 347 private: |
| 354 friend class test::QuicCryptoServerConfigPeer; | 348 friend class test::QuicCryptoServerConfigPeer; |
| 355 | 349 |
| 356 // Config represents a server config: a collection of preferences and | 350 // Config represents a server config: a collection of preferences and |
| 357 // Diffie-Hellman public values. | 351 // Diffie-Hellman public values. |
| 358 class NET_EXPORT_PRIVATE Config : public QuicCryptoConfig, | 352 class NET_EXPORT_PRIVATE Config : public QuicCryptoConfig, |
| 359 public base::RefCounted<Config> { | 353 public base::RefCounted<Config> { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 uint32 source_address_token_lifetime_secs_; | 592 uint32 source_address_token_lifetime_secs_; |
| 599 uint32 server_nonce_strike_register_max_entries_; | 593 uint32 server_nonce_strike_register_max_entries_; |
| 600 uint32 server_nonce_strike_register_window_secs_; | 594 uint32 server_nonce_strike_register_window_secs_; |
| 601 | 595 |
| 602 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); | 596 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); |
| 603 }; | 597 }; |
| 604 | 598 |
| 605 } // namespace net | 599 } // namespace net |
| 606 | 600 |
| 607 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 601 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| OLD | NEW |