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 <ostream> | 5 #include <ostream> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "crypto/secure_hash.h" | 9 #include "crypto/secure_hash.h" |
10 #include "net/quic/crypto/cert_compressor.h" | 10 #include "net/quic/crypto/cert_compressor.h" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 "NONC", (string(1, 'X') + nonce_hex_).c_str(), | 738 "NONC", (string(1, 'X') + nonce_hex_).c_str(), |
739 "SNO\0", (string(1, 'X') + nonce_hex_).c_str(), | 739 "SNO\0", (string(1, 'X') + nonce_hex_).c_str(), |
740 "XLCT", XlctHexString().c_str(), | 740 "XLCT", XlctHexString().c_str(), |
741 "VER\0", client_version_string_.c_str(), | 741 "VER\0", client_version_string_.c_str(), |
742 "$padding", static_cast<int>(kClientHelloMinimumSize), | 742 "$padding", static_cast<int>(kClientHelloMinimumSize), |
743 nullptr); | 743 nullptr); |
744 // clang-format on | 744 // clang-format on |
745 ShouldSucceed(msg); | 745 ShouldSucceed(msg); |
746 CheckRejectTag(); | 746 CheckRejectTag(); |
747 | 747 |
748 if (client_version_ <= QUIC_VERSION_26) { | 748 if (client_version_ <= QUIC_VERSION_30) { |
749 const HandshakeFailureReason kRejectReasons[] = { | 749 const HandshakeFailureReason kRejectReasons[] = { |
750 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE, | 750 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE, |
751 SERVER_NONCE_DECRYPTION_FAILURE}; | 751 SERVER_NONCE_DECRYPTION_FAILURE}; |
752 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); | 752 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); |
753 } else { | 753 } else { |
754 const HandshakeFailureReason kRejectReasons[] = { | 754 const HandshakeFailureReason kRejectReasons[] = { |
755 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE}; | 755 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE}; |
756 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); | 756 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); |
757 }; | 757 }; |
758 } | 758 } |
759 | 759 |
760 TEST_P(CryptoServerTest, ReplayProtection) { | 760 TEST_P(CryptoServerTest, ReplayProtection) { |
761 if (client_version_ > QUIC_VERSION_26) { | 761 if (client_version_ > QUIC_VERSION_30) { |
762 return; | 762 return; |
763 } | 763 } |
764 // This tests that disabling replay protection works. | 764 // This tests that disabling replay protection works. |
765 // clang-format off | 765 // clang-format off |
766 CryptoHandshakeMessage msg = CryptoTestUtils::Message( | 766 CryptoHandshakeMessage msg = CryptoTestUtils::Message( |
767 "CHLO", | 767 "CHLO", |
768 "AEAD", "AESG", | 768 "AEAD", "AESG", |
769 "KEXS", "C255", | 769 "KEXS", "C255", |
770 "SCID", scid_hex_.c_str(), | 770 "SCID", scid_hex_.c_str(), |
771 "#004b5453", srct_hex_.c_str(), | 771 "#004b5453", srct_hex_.c_str(), |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 | 1164 |
1165 strike_register_client_->RunPendingVerifications(); | 1165 strike_register_client_->RunPendingVerifications(); |
1166 ASSERT_TRUE(called); | 1166 ASSERT_TRUE(called); |
1167 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); | 1167 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); |
1168 // The message should be rejected now. | 1168 // The message should be rejected now. |
1169 CheckRejectTag(); | 1169 CheckRejectTag(); |
1170 } | 1170 } |
1171 | 1171 |
1172 } // namespace test | 1172 } // namespace test |
1173 } // namespace net | 1173 } // namespace net |
OLD | NEW |