| 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/failing_proof_source.h" | 28 #include "net/quic/test_tools/failing_proof_source.h" |
| 28 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 29 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
| 29 #include "net/quic/test_tools/quic_test_utils.h" | 30 #include "net/quic/test_tools/quic_test_utils.h" |
| 30 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 33 |
| 33 namespace net { | 34 namespace net { |
| 34 class QuicConnection; | 35 class QuicConnection; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 329 |
| 329 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { | 330 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { |
| 330 Initialize(); | 331 Initialize(); |
| 331 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 332 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 332 | 333 |
| 333 // Do a first handshake in order to prime the client config with the server's | 334 // Do a first handshake in order to prime the client config with the server's |
| 334 // information. | 335 // information. |
| 335 AdvanceHandshakeWithFakeClient(); | 336 AdvanceHandshakeWithFakeClient(); |
| 336 | 337 |
| 337 // Now do another handshake, hopefully in 0-RTT. | 338 // Now do another handshake, hopefully in 0-RTT. |
| 338 DVLOG(1) << "Resetting for 0-RTT handshake attempt"; | 339 QUIC_LOG(INFO) << "Resetting for 0-RTT handshake attempt"; |
| 339 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 340 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 340 InitializeServer(); | 341 InitializeServer(); |
| 341 | 342 |
| 342 client_stream()->CryptoConnect(); | 343 client_stream()->CryptoConnect(); |
| 343 | 344 |
| 344 CryptoTestUtils::CommunicateHandshakeMessages( | 345 CryptoTestUtils::CommunicateHandshakeMessages( |
| 345 client_connection_, client_stream(), server_connection_, server_stream()); | 346 client_connection_, client_stream(), server_connection_, server_stream()); |
| 346 | 347 |
| 347 EXPECT_EQ(1, client_stream()->num_sent_client_hellos()); | 348 EXPECT_EQ(1, client_stream()->num_sent_client_hellos()); |
| 348 } | 349 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Regression test for b/31521252, in which a crash would happen here. | 504 // Regression test for b/31521252, in which a crash would happen here. |
| 504 AdvanceHandshakeWithFakeClient(); | 505 AdvanceHandshakeWithFakeClient(); |
| 505 EXPECT_FALSE(server_stream()->encryption_established()); | 506 EXPECT_FALSE(server_stream()->encryption_established()); |
| 506 EXPECT_FALSE(server_stream()->handshake_confirmed()); | 507 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
| 507 } | 508 } |
| 508 | 509 |
| 509 } // namespace | 510 } // namespace |
| 510 | 511 |
| 511 } // namespace test | 512 } // namespace test |
| 512 } // namespace net | 513 } // namespace net |
| OLD | NEW |