| 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_CORE_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| 6 #define NET_QUIC_CORE_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 6 #define NET_QUIC_CORE_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 19 #include "base/synchronization/lock.h" | |
| 20 #include "net/base/ip_address.h" | 19 #include "net/base/ip_address.h" |
| 21 #include "net/base/ip_endpoint.h" | 20 #include "net/base/ip_endpoint.h" |
| 22 #include "net/quic/core/crypto/crypto_handshake.h" | 21 #include "net/quic/core/crypto/crypto_handshake.h" |
| 23 #include "net/quic/core/crypto/crypto_handshake_message.h" | 22 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| 24 #include "net/quic/core/crypto/crypto_protocol.h" | 23 #include "net/quic/core/crypto/crypto_protocol.h" |
| 25 #include "net/quic/core/crypto/crypto_secret_boxer.h" | 24 #include "net/quic/core/crypto/crypto_secret_boxer.h" |
| 26 #include "net/quic/core/crypto/proof_source.h" | 25 #include "net/quic/core/crypto/proof_source.h" |
| 27 #include "net/quic/core/crypto/quic_compressed_certs_cache.h" | 26 #include "net/quic/core/crypto/quic_compressed_certs_cache.h" |
| 28 #include "net/quic/core/crypto/quic_crypto_proof.h" | 27 #include "net/quic/core/crypto/quic_crypto_proof.h" |
| 29 #include "net/quic/core/proto/cached_network_parameters.pb.h" | 28 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
| 30 #include "net/quic/core/proto/source_address_token.pb.h" | 29 #include "net/quic/core/proto/source_address_token.pb.h" |
| 31 #include "net/quic/core/quic_time.h" | 30 #include "net/quic/core/quic_time.h" |
| 32 #include "net/quic/platform/api/quic_export.h" | 31 #include "net/quic/platform/api/quic_export.h" |
| 32 #include "net/quic/platform/api/quic_mutex.h" |
| 33 #include "net/quic/platform/api/quic_socket_address.h" | 33 #include "net/quic/platform/api/quic_socket_address.h" |
| 34 | 34 |
| 35 namespace net { | 35 namespace net { |
| 36 | 36 |
| 37 class CryptoHandshakeMessage; | 37 class CryptoHandshakeMessage; |
| 38 class EphemeralKeySource; | 38 class EphemeralKeySource; |
| 39 class KeyExchange; | 39 class KeyExchange; |
| 40 class ProofSource; | 40 class ProofSource; |
| 41 class QuicClock; | 41 class QuicClock; |
| 42 class QuicRandom; | 42 class QuicRandom; |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 732 |
| 733 // The multiple of the CHLO message size that a REJ message must stay under | 733 // The multiple of the CHLO message size that a REJ message must stay under |
| 734 // when the client doesn't present a valid source-address token. This is | 734 // when the client doesn't present a valid source-address token. This is |
| 735 // used to protect QUIC from amplification attacks. | 735 // used to protect QUIC from amplification attacks. |
| 736 size_t chlo_multiplier_; | 736 size_t chlo_multiplier_; |
| 737 | 737 |
| 738 // configs_ satisfies the following invariants: | 738 // configs_ satisfies the following invariants: |
| 739 // 1) configs_.empty() <-> primary_config_ == nullptr | 739 // 1) configs_.empty() <-> primary_config_ == nullptr |
| 740 // 2) primary_config_ != nullptr -> primary_config_->is_primary | 740 // 2) primary_config_ != nullptr -> primary_config_->is_primary |
| 741 // 3) ∀ c∈configs_, c->is_primary <-> c == primary_config_ | 741 // 3) ∀ c∈configs_, c->is_primary <-> c == primary_config_ |
| 742 mutable base::Lock configs_lock_; | 742 mutable QuicMutex configs_lock_; |
| 743 // configs_ contains all active server configs. It's expected that there are | 743 // configs_ contains all active server configs. It's expected that there are |
| 744 // about half-a-dozen configs active at any one time. | 744 // about half-a-dozen configs active at any one time. |
| 745 ConfigMap configs_; | 745 ConfigMap configs_ GUARDED_BY(configs_lock_); |
| 746 // primary_config_ points to a Config (which is also in |configs_|) which is | 746 // primary_config_ points to a Config (which is also in |configs_|) which is |
| 747 // the primary config - i.e. the one that we'll give out to new clients. | 747 // the primary config - i.e. the one that we'll give out to new clients. |
| 748 mutable scoped_refptr<Config> primary_config_; | 748 mutable scoped_refptr<Config> primary_config_ GUARDED_BY(configs_lock_); |
| 749 // next_config_promotion_time_ contains the nearest, future time when an | 749 // next_config_promotion_time_ contains the nearest, future time when an |
| 750 // active config will be promoted to primary. | 750 // active config will be promoted to primary. |
| 751 mutable QuicWallTime next_config_promotion_time_; | 751 mutable QuicWallTime next_config_promotion_time_ GUARDED_BY(configs_lock_); |
| 752 // Callback to invoke when the primary config changes. | 752 // Callback to invoke when the primary config changes. |
| 753 std::unique_ptr<PrimaryConfigChangedCallback> primary_config_changed_cb_; | 753 std::unique_ptr<PrimaryConfigChangedCallback> primary_config_changed_cb_ |
| 754 GUARDED_BY(configs_lock_); |
| 754 | 755 |
| 755 // Used to protect the source-address tokens that are given to clients. | 756 // Used to protect the source-address tokens that are given to clients. |
| 756 CryptoSecretBoxer source_address_token_boxer_; | 757 CryptoSecretBoxer source_address_token_boxer_; |
| 757 | 758 |
| 758 // server_nonce_boxer_ is used to encrypt and validate suggested server | 759 // server_nonce_boxer_ is used to encrypt and validate suggested server |
| 759 // nonces. | 760 // nonces. |
| 760 CryptoSecretBoxer server_nonce_boxer_; | 761 CryptoSecretBoxer server_nonce_boxer_; |
| 761 | 762 |
| 762 // server_nonce_orbit_ contains the random, per-server orbit values that this | 763 // server_nonce_orbit_ contains the random, per-server orbit values that this |
| 763 // server will use to generate server nonces (the moral equivalent of a SYN | 764 // server will use to generate server nonces (the moral equivalent of a SYN |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 std::string primary_scid; | 799 std::string primary_scid; |
| 799 | 800 |
| 800 private: | 801 private: |
| 801 friend class base::RefCounted<QuicSignedServerConfig>; | 802 friend class base::RefCounted<QuicSignedServerConfig>; |
| 802 virtual ~QuicSignedServerConfig(); | 803 virtual ~QuicSignedServerConfig(); |
| 803 }; | 804 }; |
| 804 | 805 |
| 805 } // namespace net | 806 } // namespace net |
| 806 | 807 |
| 807 #endif // NET_QUIC_CORE_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 808 #endif // NET_QUIC_CORE_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| OLD | NEW |