Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: net/quic/core/crypto/crypto_server_test.cc

Issue 2515613002: deprecate FLAGS_quic_disable_pre_34 (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 "NONP", (string(1, 'X') + nonce_hex_).c_str(), 820 "NONP", (string(1, 'X') + nonce_hex_).c_str(),
821 "SNO\0", (string(1, 'X') + nonce_hex_).c_str(), 821 "SNO\0", (string(1, 'X') + nonce_hex_).c_str(),
822 "XLCT", XlctHexString().c_str(), 822 "XLCT", XlctHexString().c_str(),
823 "VER\0", client_version_string_.c_str(), 823 "VER\0", client_version_string_.c_str(),
824 "$padding", static_cast<int>(kClientHelloMinimumSize), 824 "$padding", static_cast<int>(kClientHelloMinimumSize),
825 nullptr); 825 nullptr);
826 // clang-format on 826 // clang-format on
827 ShouldSucceed(msg); 827 ShouldSucceed(msg);
828 CheckRejectTag(); 828 CheckRejectTag();
829 829
830 if (client_version_ <= QUIC_VERSION_32) { 830 const HandshakeFailureReason kRejectReasons[] = {
831 const HandshakeFailureReason kRejectReasons[] = { 831 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE};
832 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE, 832 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
833 SERVER_NONCE_DECRYPTION_FAILURE};
834 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
835 } else {
836 const HandshakeFailureReason kRejectReasons[] = {
837 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE};
838 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
839 };
840 } 833 }
841 834
842 TEST_P(CryptoServerTest, NoServerNonce) { 835 TEST_P(CryptoServerTest, NoServerNonce) {
843 // When no server nonce is present and no strike register is configured, 836 // When no server nonce is present and no strike register is configured,
844 // the CHLO should be rejected. 837 // the CHLO should be rejected.
845 // clang-format off 838 // clang-format off
846 CryptoHandshakeMessage msg = CryptoTestUtils::Message( 839 CryptoHandshakeMessage msg = CryptoTestUtils::Message(
847 "CHLO", 840 "CHLO",
848 "PDMD", "X509", 841 "PDMD", "X509",
849 "AEAD", "AESG", 842 "AEAD", "AESG",
850 "KEXS", "C255", 843 "KEXS", "C255",
851 "SCID", scid_hex_.c_str(), 844 "SCID", scid_hex_.c_str(),
852 "#004b5453", srct_hex_.c_str(), 845 "#004b5453", srct_hex_.c_str(),
853 "PUBS", pub_hex_.c_str(), 846 "PUBS", pub_hex_.c_str(),
854 "NONC", nonce_hex_.c_str(), 847 "NONC", nonce_hex_.c_str(),
855 "NONP", nonce_hex_.c_str(), 848 "NONP", nonce_hex_.c_str(),
856 "XLCT", XlctHexString().c_str(), 849 "XLCT", XlctHexString().c_str(),
857 "VER\0", client_version_string_.c_str(), 850 "VER\0", client_version_string_.c_str(),
858 "$padding", static_cast<int>(kClientHelloMinimumSize), 851 "$padding", static_cast<int>(kClientHelloMinimumSize),
859 nullptr); 852 nullptr);
860 // clang-format on 853 // clang-format on
861 854
862 ShouldSucceed(msg); 855 ShouldSucceed(msg);
863 856
864 if (client_version_ <= QUIC_VERSION_32) { 857 // Even without a server nonce, this ClientHello should be accepted in
865 CheckRejectTag(); 858 // version 33.
866 const HandshakeFailureReason kRejectReasons[] = { 859 ASSERT_EQ(kSHLO, out_.tag());
867 SERVER_NONCE_REQUIRED_FAILURE}; 860 CheckServerHello(out_);
868 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
869 } else {
870 // Even without a server nonce, this ClientHello should be accepted in
871 // version 33.
872 ASSERT_EQ(kSHLO, out_.tag());
873 CheckServerHello(out_);
874 }
875 } 861 }
876 862
877 TEST_P(CryptoServerTest, ProofForSuppliedServerConfig) { 863 TEST_P(CryptoServerTest, ProofForSuppliedServerConfig) {
878 client_address_ = IPEndPoint(Loopback6(), 1234); 864 client_address_ = IPEndPoint(Loopback6(), 1234);
879 // clang-format off 865 // clang-format off
880 CryptoHandshakeMessage msg = CryptoTestUtils::Message( 866 CryptoHandshakeMessage msg = CryptoTestUtils::Message(
881 "CHLO", 867 "CHLO",
882 "AEAD", "AESG", 868 "AEAD", "AESG",
883 "KEXS", "C255", 869 "KEXS", "C255",
884 "PDMD", "X509", 870 "PDMD", "X509",
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 "PUBS", pub_hex_.c_str(), 1251 "PUBS", pub_hex_.c_str(),
1266 "NONC", nonce_hex_.c_str(), 1252 "NONC", nonce_hex_.c_str(),
1267 "VER\0", client_version_string_.c_str(), 1253 "VER\0", client_version_string_.c_str(),
1268 "XLCT", XlctHexString().c_str(), 1254 "XLCT", XlctHexString().c_str(),
1269 "$padding", static_cast<int>(kClientHelloMinimumSize), 1255 "$padding", static_cast<int>(kClientHelloMinimumSize),
1270 nullptr); 1256 nullptr);
1271 // clang-format on 1257 // clang-format on
1272 1258
1273 ShouldSucceed(msg); 1259 ShouldSucceed(msg);
1274 1260
1275 if (client_version_ <= QUIC_VERSION_32) { 1261 ASSERT_EQ(kSHLO, out_.tag());
1276 // clang-format off 1262 CheckServerHello(out_);
1277 const HandshakeFailureReason kRejectReasons[] = {
1278 SERVER_NONCE_REQUIRED_FAILURE
1279 };
1280 // clang-format on
1281 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
1282 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1283 } else {
1284 // version 33.
1285 ASSERT_EQ(kSHLO, out_.tag());
1286 CheckServerHello(out_);
1287 }
1288 } 1263 }
1289 1264
1290 } // namespace test 1265 } // namespace test
1291 } // namespace net 1266 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/general_loss_algorithm_test.cc ('k') | net/quic/core/crypto/quic_crypto_client_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698