| OLD | NEW |
| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <cstdint> | 6 #include <cstdint> |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string_number_conversions.h" | |
| 12 #include "crypto/secure_hash.h" | 11 #include "crypto/secure_hash.h" |
| 13 #include "net/quic/core/crypto/cert_compressor.h" | 12 #include "net/quic/core/crypto/cert_compressor.h" |
| 14 #include "net/quic/core/crypto/common_cert_set.h" | 13 #include "net/quic/core/crypto/common_cert_set.h" |
| 15 #include "net/quic/core/crypto/crypto_handshake.h" | 14 #include "net/quic/core/crypto/crypto_handshake.h" |
| 16 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" | 15 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" |
| 17 #include "net/quic/core/crypto/crypto_utils.h" | 16 #include "net/quic/core/crypto/crypto_utils.h" |
| 18 #include "net/quic/core/crypto/proof_source.h" | 17 #include "net/quic/core/crypto/proof_source.h" |
| 19 #include "net/quic/core/crypto/quic_crypto_server_config.h" | 18 #include "net/quic/core/crypto/quic_crypto_server_config.h" |
| 20 #include "net/quic/core/crypto/quic_random.h" | 19 #include "net/quic/core/crypto/quic_random.h" |
| 21 #include "net/quic/core/quic_flags.h" | 20 #include "net/quic/core/quic_flags.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 namespace { | 37 namespace { |
| 39 | 38 |
| 40 class DummyProofVerifierCallback : public ProofVerifierCallback { | 39 class DummyProofVerifierCallback : public ProofVerifierCallback { |
| 41 public: | 40 public: |
| 42 DummyProofVerifierCallback() {} | 41 DummyProofVerifierCallback() {} |
| 43 ~DummyProofVerifierCallback() override {} | 42 ~DummyProofVerifierCallback() override {} |
| 44 | 43 |
| 45 void Run(bool ok, | 44 void Run(bool ok, |
| 46 const std::string& error_details, | 45 const std::string& error_details, |
| 47 std::unique_ptr<ProofVerifyDetails>* details) override { | 46 std::unique_ptr<ProofVerifyDetails>* details) override { |
| 48 // Do nothing | 47 DCHECK(false); |
| 49 } | 48 } |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 const char kOldConfigId[] = "old-config-id"; | 51 const char kOldConfigId[] = "old-config-id"; |
| 53 | 52 |
| 54 } // namespace | 53 } // namespace |
| 55 | 54 |
| 56 struct TestParams { | 55 struct TestParams { |
| 57 TestParams(bool enable_stateless_rejects, | 56 TestParams(bool enable_stateless_rejects, |
| 58 bool use_stateless_rejects, | 57 bool use_stateless_rejects, |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 // clang-format off | 854 // clang-format off |
| 856 CryptoHandshakeMessage msg = CryptoTestUtils::Message( | 855 CryptoHandshakeMessage msg = CryptoTestUtils::Message( |
| 857 "CHLO", | 856 "CHLO", |
| 858 "AEAD", "AESG", | 857 "AEAD", "AESG", |
| 859 "KEXS", "C255", | 858 "KEXS", "C255", |
| 860 "PDMD", "X509", | 859 "PDMD", "X509", |
| 861 "SCID", kOldConfigId, | 860 "SCID", kOldConfigId, |
| 862 "#004b5453", srct_hex_.c_str(), | 861 "#004b5453", srct_hex_.c_str(), |
| 863 "PUBS", pub_hex_.c_str(), | 862 "PUBS", pub_hex_.c_str(), |
| 864 "NONC", nonce_hex_.c_str(), | 863 "NONC", nonce_hex_.c_str(), |
| 864 "NONP", "123456789012345678901234567890", |
| 865 "VER\0", client_version_string_.c_str(), | 865 "VER\0", client_version_string_.c_str(), |
| 866 "XLCT", XlctHexString().c_str(), | 866 "XLCT", XlctHexString().c_str(), |
| 867 "$padding", static_cast<int>(kClientHelloMinimumSize), | 867 "$padding", static_cast<int>(kClientHelloMinimumSize), |
| 868 nullptr); | 868 nullptr); |
| 869 // clang-format on | 869 // clang-format on |
| 870 ShouldSucceed(msg); | 870 ShouldSucceed(msg); |
| 871 // The message should be rejected because the source-address token is no | 871 // The message should be rejected because the source-address token is no |
| 872 // longer valid. | 872 // longer valid. |
| 873 CheckRejectTag(); | 873 CheckRejectTag(); |
| 874 const HandshakeFailureReason kRejectReasons[] = { | 874 const HandshakeFailureReason kRejectReasons[] = { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 // clang-format off | 945 // clang-format off |
| 946 CryptoHandshakeMessage msg = CryptoTestUtils::Message( | 946 CryptoHandshakeMessage msg = CryptoTestUtils::Message( |
| 947 "CHLO", | 947 "CHLO", |
| 948 "PDMD", "X509", | 948 "PDMD", "X509", |
| 949 "AEAD", "AESG", | 949 "AEAD", "AESG", |
| 950 "KEXS", "C255", | 950 "KEXS", "C255", |
| 951 "SCID", scid_hex_.c_str(), | 951 "SCID", scid_hex_.c_str(), |
| 952 "#004b5453", srct_hex_.c_str(), | 952 "#004b5453", srct_hex_.c_str(), |
| 953 "PUBS", pub_hex_.c_str(), | 953 "PUBS", pub_hex_.c_str(), |
| 954 "NONC", nonce_hex_.c_str(), | 954 "NONC", nonce_hex_.c_str(), |
| 955 "NONP", "123456789012345678901234567890", | |
| 956 "VER\0", client_version_string_.c_str(), | 955 "VER\0", client_version_string_.c_str(), |
| 957 "XLCT", XlctHexString().c_str(), | 956 "XLCT", XlctHexString().c_str(), |
| 958 "$padding", static_cast<int>(kClientHelloMinimumSize), | 957 "$padding", static_cast<int>(kClientHelloMinimumSize), |
| 959 nullptr); | 958 nullptr); |
| 960 // clang-format on | 959 // clang-format on |
| 961 // If replay protection isn't disabled, then | 960 // If replay protection isn't disabled, then |
| 962 // QuicCryptoServerConfig::EvaluateClientHello will leave info.unique as false | 961 // QuicCryptoServerConfig::EvaluateClientHello will leave info.unique as false |
| 963 // and cause ProcessClientHello to exit early (and generate a REJ message). | 962 // and cause ProcessClientHello to exit early (and generate a REJ message). |
| 964 config_.set_replay_protection(false); | 963 config_.set_replay_protection(false); |
| 965 | 964 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 // QuicCryptoServerConfig::EvaluateClientHello will leave info.unique as false | 1145 // QuicCryptoServerConfig::EvaluateClientHello will leave info.unique as false |
| 1147 // and cause ProcessClientHello to exit early (and generate a REJ message). | 1146 // and cause ProcessClientHello to exit early (and generate a REJ message). |
| 1148 config_.set_replay_protection(false); | 1147 config_.set_replay_protection(false); |
| 1149 | 1148 |
| 1150 ShouldSucceed(msg); | 1149 ShouldSucceed(msg); |
| 1151 EXPECT_EQ(kSHLO, out_.tag()); | 1150 EXPECT_EQ(kSHLO, out_.tag()); |
| 1152 } | 1151 } |
| 1153 | 1152 |
| 1154 } // namespace test | 1153 } // namespace test |
| 1155 } // namespace net | 1154 } // namespace net |
| OLD | NEW |