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

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

Issue 2187463004: Add a new flag to require QUIC handshake confirmation, but only for versions before 33 FLAGS_quic_r… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@128425078
Patch Set: Created 4 years, 4 months 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
« no previous file with comments | « no previous file | net/quic/crypto/quic_crypto_server_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 CryptoTestUtils::ProofSourceForTesting()), 112 CryptoTestUtils::ProofSourceForTesting()),
113 compressed_certs_cache_( 113 compressed_certs_cache_(
114 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { 114 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {
115 supported_versions_ = GetParam().supported_versions; 115 supported_versions_ = GetParam().supported_versions;
116 config_.set_enable_serving_sct(true); 116 config_.set_enable_serving_sct(true);
117 117
118 client_version_ = supported_versions_.front(); 118 client_version_ = supported_versions_.front();
119 client_version_string_ = 119 client_version_string_ =
120 QuicUtils::TagToString(QuicVersionToQuicTag(client_version_)); 120 QuicUtils::TagToString(QuicVersionToQuicTag(client_version_));
121 121
122 FLAGS_quic_require_handshake_confirmation_pre33 =
123 false;
122 FLAGS_enable_quic_stateless_reject_support = 124 FLAGS_enable_quic_stateless_reject_support =
123 GetParam().enable_stateless_rejects; 125 GetParam().enable_stateless_rejects;
124 use_stateless_rejects_ = GetParam().use_stateless_rejects; 126 use_stateless_rejects_ = GetParam().use_stateless_rejects;
125 } 127 }
126 128
127 void SetUp() override { 129 void SetUp() override {
128 QuicCryptoServerConfig::ConfigOptions old_config_options; 130 QuicCryptoServerConfig::ConfigOptions old_config_options;
129 old_config_options.id = kOldConfigId; 131 old_config_options.id = kOldConfigId;
130 delete config_.AddDefaultConfig(rand_, &clock_, old_config_options); 132 delete config_.AddDefaultConfig(rand_, &clock_, old_config_options);
131 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); 133 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000));
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 ASSERT_FALSE(called); 1169 ASSERT_FALSE(called);
1168 EXPECT_EQ(1, strike_register_client_->PendingVerifications()); 1170 EXPECT_EQ(1, strike_register_client_->PendingVerifications());
1169 1171
1170 strike_register_client_->RunPendingVerifications(); 1172 strike_register_client_->RunPendingVerifications();
1171 ASSERT_TRUE(called); 1173 ASSERT_TRUE(called);
1172 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); 1174 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1173 // The message should be rejected now. 1175 // The message should be rejected now.
1174 CheckRejectTag(); 1176 CheckRejectTag();
1175 } 1177 }
1176 1178
1179 TEST_P(AsyncStrikeServerVerificationTest, RequireHandshakeCofirmationPre33) {
1180 FLAGS_quic_require_handshake_confirmation = false;
1181 FLAGS_quic_require_handshake_confirmation_pre33 = true;
1182 // clang-format off
1183 CryptoHandshakeMessage msg = CryptoTestUtils::Message(
1184 "CHLO",
1185 "PDMD", "X509",
1186 "AEAD", "AESG",
1187 "KEXS", "C255",
1188 "SNI", "foobar1.example.com",
1189 "SCID", scid_hex_.c_str(),
1190 "#004b5453", srct_hex_.c_str(),
1191 "PUBS", pub_hex_.c_str(),
1192 "NONC", nonce_hex_.c_str(),
1193 "VER\0", client_version_string_.c_str(),
1194 "XLCT", XlctHexString().c_str(),
1195 "$padding", static_cast<int>(kClientHelloMinimumSize),
1196 nullptr);
1197 // clang-format on
1198
1199 ShouldSucceed(msg);
1200
1201 if (client_version_ <= QUIC_VERSION_32) {
1202 // clang-format off
1203 const HandshakeFailureReason kRejectReasons[] = {
1204 SERVER_NONCE_REQUIRED_FAILURE
1205 };
1206 // clang-format on
1207 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
1208 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1209 } else {
1210 // version 33.
1211 ASSERT_EQ(kSHLO, out_.tag());
1212 CheckServerHello(out_);
1213 }
1214 }
1215
1177 } // namespace test 1216 } // namespace test
1178 } // namespace net 1217 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/quic_crypto_server_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698