| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/quic/core/quic_crypto_server_stream.h" | 5 #include "net/quic/core/quic_crypto_server_stream.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" | 12 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" |
| 13 #include "net/quic/core/crypto/crypto_framer.h" | 13 #include "net/quic/core/crypto/crypto_framer.h" |
| 14 #include "net/quic/core/crypto/crypto_handshake.h" | 14 #include "net/quic/core/crypto/crypto_handshake.h" |
| 15 #include "net/quic/core/crypto/crypto_protocol.h" | 15 #include "net/quic/core/crypto/crypto_protocol.h" |
| 16 #include "net/quic/core/crypto/crypto_utils.h" | 16 #include "net/quic/core/crypto/crypto_utils.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_decrypter.h" | 18 #include "net/quic/core/crypto/quic_decrypter.h" |
| 19 #include "net/quic/core/crypto/quic_encrypter.h" | 19 #include "net/quic/core/crypto/quic_encrypter.h" |
| 20 #include "net/quic/core/crypto/quic_random.h" | 20 #include "net/quic/core/crypto/quic_random.h" |
| 21 #include "net/quic/core/quic_crypto_client_stream.h" | 21 #include "net/quic/core/quic_crypto_client_stream.h" |
| 22 #include "net/quic/core/quic_flags.h" | 22 #include "net/quic/core/quic_flags.h" |
| 23 #include "net/quic/core/quic_packets.h" | 23 #include "net/quic/core/quic_packets.h" |
| 24 #include "net/quic/core/quic_session.h" | 24 #include "net/quic/core/quic_session.h" |
| 25 #include "net/quic/platform/api/quic_logging.h" |
| 25 #include "net/quic/platform/api/quic_socket_address.h" | 26 #include "net/quic/platform/api/quic_socket_address.h" |
| 26 #include "net/quic/test_tools/crypto_test_utils.h" | 27 #include "net/quic/test_tools/crypto_test_utils.h" |
| 27 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 28 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
| 28 #include "net/quic/test_tools/quic_test_utils.h" | 29 #include "net/quic/test_tools/quic_test_utils.h" |
| 29 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 31 | 32 |
| 32 namespace net { | 33 namespace net { |
| 33 class QuicConnection; | 34 class QuicConnection; |
| 34 class QuicStream; | 35 class QuicStream; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 328 |
| 328 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { | 329 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { |
| 329 Initialize(); | 330 Initialize(); |
| 330 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 331 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 331 | 332 |
| 332 // Do a first handshake in order to prime the client config with the server's | 333 // Do a first handshake in order to prime the client config with the server's |
| 333 // information. | 334 // information. |
| 334 AdvanceHandshakeWithFakeClient(); | 335 AdvanceHandshakeWithFakeClient(); |
| 335 | 336 |
| 336 // Now do another handshake, hopefully in 0-RTT. | 337 // Now do another handshake, hopefully in 0-RTT. |
| 337 DVLOG(1) << "Resetting for 0-RTT handshake attempt"; | 338 QUIC_LOG(INFO) << "Resetting for 0-RTT handshake attempt"; |
| 338 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 339 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 339 InitializeServer(); | 340 InitializeServer(); |
| 340 | 341 |
| 341 client_stream()->CryptoConnect(); | 342 client_stream()->CryptoConnect(); |
| 342 | 343 |
| 343 CryptoTestUtils::CommunicateHandshakeMessages( | 344 CryptoTestUtils::CommunicateHandshakeMessages( |
| 344 client_connection_, client_stream(), server_connection_, server_stream()); | 345 client_connection_, client_stream(), server_connection_, server_stream()); |
| 345 | 346 |
| 346 EXPECT_EQ(1, client_stream()->num_sent_client_hellos()); | 347 EXPECT_EQ(1, client_stream()->num_sent_client_hellos()); |
| 347 } | 348 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // Regression test for b/31521252, in which a crash would happen here. | 527 // Regression test for b/31521252, in which a crash would happen here. |
| 527 AdvanceHandshakeWithFakeClient(); | 528 AdvanceHandshakeWithFakeClient(); |
| 528 EXPECT_FALSE(server_stream()->encryption_established()); | 529 EXPECT_FALSE(server_stream()->encryption_established()); |
| 529 EXPECT_FALSE(server_stream()->handshake_confirmed()); | 530 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
| 530 } | 531 } |
| 531 | 532 |
| 532 } // namespace | 533 } // namespace |
| 533 | 534 |
| 534 } // namespace test | 535 } // namespace test |
| 535 } // namespace net | 536 } // namespace net |
| OLD | NEW |