| 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 "net/quic/core/crypto/cert_compressor.h" | 11 #include "net/quic/core/crypto/cert_compressor.h" |
| 12 #include "net/quic/core/crypto/common_cert_set.h" | 12 #include "net/quic/core/crypto/common_cert_set.h" |
| 13 #include "net/quic/core/crypto/crypto_handshake.h" | 13 #include "net/quic/core/crypto/crypto_handshake.h" |
| 14 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" | 14 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" |
| 15 #include "net/quic/core/crypto/crypto_utils.h" | 15 #include "net/quic/core/crypto/crypto_utils.h" |
| 16 #include "net/quic/core/crypto/proof_source.h" | 16 #include "net/quic/core/crypto/proof_source.h" |
| 17 #include "net/quic/core/crypto/quic_crypto_server_config.h" | 17 #include "net/quic/core/crypto/quic_crypto_server_config.h" |
| 18 #include "net/quic/core/crypto/quic_random.h" | 18 #include "net/quic/core/crypto/quic_random.h" |
| 19 #include "net/quic/core/quic_flags.h" | 19 #include "net/quic/core/quic_flags.h" |
| 20 #include "net/quic/core/quic_socket_address_coder.h" | 20 #include "net/quic/core/quic_socket_address_coder.h" |
| 21 #include "net/quic/core/quic_utils.h" | 21 #include "net/quic/core/quic_utils.h" |
| 22 #include "net/quic/platform/api/quic_endian.h" |
| 22 #include "net/quic/platform/api/quic_string_piece.h" | 23 #include "net/quic/platform/api/quic_string_piece.h" |
| 23 #include "net/quic/platform/api/quic_text_utils.h" | 24 #include "net/quic/platform/api/quic_text_utils.h" |
| 24 #include "net/quic/test_tools/crypto_test_utils.h" | 25 #include "net/quic/test_tools/crypto_test_utils.h" |
| 25 #include "net/quic/test_tools/delayed_verify_strike_register_client.h" | 26 #include "net/quic/test_tools/delayed_verify_strike_register_client.h" |
| 26 #include "net/quic/test_tools/failing_proof_source.h" | 27 #include "net/quic/test_tools/failing_proof_source.h" |
| 27 #include "net/quic/test_tools/mock_clock.h" | 28 #include "net/quic/test_tools/mock_clock.h" |
| 28 #include "net/quic/test_tools/mock_random.h" | 29 #include "net/quic/test_tools/mock_random.h" |
| 29 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 30 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
| 30 #include "net/quic/test_tools/quic_test_utils.h" | 31 #include "net/quic/test_tools/quic_test_utils.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // server-designated connection id. Once the check is complete, | 357 // server-designated connection id. Once the check is complete, |
| 357 // allow the random id-generator to move to the next value. | 358 // allow the random id-generator to move to the next value. |
| 358 void CheckForServerDesignatedConnectionId() { | 359 void CheckForServerDesignatedConnectionId() { |
| 359 QuicConnectionId server_designated_connection_id; | 360 QuicConnectionId server_designated_connection_id; |
| 360 if (!RejectsAreStateless()) { | 361 if (!RejectsAreStateless()) { |
| 361 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, | 362 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, |
| 362 out_.GetUint64(kRCID, &server_designated_connection_id)); | 363 out_.GetUint64(kRCID, &server_designated_connection_id)); |
| 363 } else { | 364 } else { |
| 364 ASSERT_EQ(QUIC_NO_ERROR, | 365 ASSERT_EQ(QUIC_NO_ERROR, |
| 365 out_.GetUint64(kRCID, &server_designated_connection_id)); | 366 out_.GetUint64(kRCID, &server_designated_connection_id)); |
| 367 if (QuicUtils::IsConnectionIdWireFormatBigEndian( |
| 368 Perspective::IS_SERVER)) { |
| 369 server_designated_connection_id = |
| 370 QuicEndian::NetToHost64(server_designated_connection_id); |
| 371 } |
| 366 EXPECT_EQ(rand_for_id_generation_.RandUint64(), | 372 EXPECT_EQ(rand_for_id_generation_.RandUint64(), |
| 367 server_designated_connection_id); | 373 server_designated_connection_id); |
| 368 } | 374 } |
| 369 rand_for_id_generation_.ChangeValue(); | 375 rand_for_id_generation_.ChangeValue(); |
| 370 } | 376 } |
| 371 | 377 |
| 372 void CheckRejectTag() { | 378 void CheckRejectTag() { |
| 373 if (RejectsAreStateless()) { | 379 if (RejectsAreStateless()) { |
| 374 ASSERT_EQ(kSREJ, out_.tag()) << QuicTagToString(out_.tag()); | 380 ASSERT_EQ(kSREJ, out_.tag()) << QuicTagToString(out_.tag()); |
| 375 } else { | 381 } else { |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 // QuicCryptoServerConfig::EvaluateClientHello will leave info.unique as false | 1089 // QuicCryptoServerConfig::EvaluateClientHello will leave info.unique as false |
| 1084 // and cause ProcessClientHello to exit early (and generate a REJ message). | 1090 // and cause ProcessClientHello to exit early (and generate a REJ message). |
| 1085 config_.set_replay_protection(false); | 1091 config_.set_replay_protection(false); |
| 1086 | 1092 |
| 1087 ShouldSucceed(msg); | 1093 ShouldSucceed(msg); |
| 1088 EXPECT_EQ(kSHLO, out_.tag()); | 1094 EXPECT_EQ(kSHLO, out_.tag()); |
| 1089 } | 1095 } |
| 1090 | 1096 |
| 1091 } // namespace test | 1097 } // namespace test |
| 1092 } // namespace net | 1098 } // namespace net |
| OLD | NEW |