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

Unified Diff: net/quic/core/crypto/crypto_server_test.cc

Issue 2513113002: Remove strike-register code from QuicCryptoServerConfig (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/core/crypto/quic_crypto_server_config.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/crypto_server_test.cc
diff --git a/net/quic/core/crypto/crypto_server_test.cc b/net/quic/core/crypto/crypto_server_test.cc
index 282e08bd872813a9d0bec79e4218f87bb7e730b2..ef8a0ad8b4d03dbadfebb627a099f4296ee79037 100644
--- a/net/quic/core/crypto/crypto_server_test.cc
+++ b/net/quic/core/crypto/crypto_server_test.cc
@@ -205,15 +205,6 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> {
void Run(scoped_refptr<Result> result,
std::unique_ptr<ProofSource::Details> /* details */) override {
- {
- // Ensure that the strike register client lock is not held.
- QuicCryptoServerConfigPeer peer(&test_->config_);
- base::Lock* m = peer.GetStrikeRegisterClientLock();
- // In Chromium, we will dead lock if the lock is held by the current
- // thread. Chromium doesn't have AssertNotHeld API call.
- // m->AssertNotHeld();
- base::AutoLock lock(*m);
- }
ASSERT_FALSE(*called_);
test_->ProcessValidationResult(std::move(result), should_succeed_,
error_substr_);
@@ -1161,106 +1152,5 @@ TEST_P(CryptoServerTestOldVersion, XlctNotRequired) {
EXPECT_EQ(kSHLO, out_.tag());
}
-class AsyncStrikeServerVerificationTest : public CryptoServerTest {
- protected:
- AsyncStrikeServerVerificationTest() {}
-
- void SetUp() override {
- const string kOrbit = "12345678";
- config_options_.orbit = kOrbit;
- strike_register_client_ = new DelayedVerifyStrikeRegisterClient(
- 10000, // strike_register_max_entries
- static_cast<uint32_t>(clock_.WallNow().ToUNIXSeconds()),
- 60, // strike_register_window_secs
- reinterpret_cast<const uint8_t*>(kOrbit.c_str()),
- StrikeRegister::NO_STARTUP_PERIOD_NEEDED);
- config_.SetStrikeRegisterClient(strike_register_client_);
- ASSERT_NO_FATAL_FAILURE(CryptoServerTest::SetUp());
- strike_register_client_->StartDelayingVerification();
- }
-
- DelayedVerifyStrikeRegisterClient* strike_register_client_;
-};
-
-TEST_P(AsyncStrikeServerVerificationTest, AsyncReplayProtection) {
- // This tests async validation with a strike register works.
- // clang-format off
- CryptoHandshakeMessage msg = CryptoTestUtils::Message(
- "CHLO",
- "PDMD", "X509",
- "AEAD", "AESG",
- "KEXS", "C255",
- "SCID", scid_hex_.c_str(),
- "#004b5453", srct_hex_.c_str(),
- "PUBS", pub_hex_.c_str(),
- "NONC", nonce_hex_.c_str(),
- "VER\0", client_version_string_.c_str(),
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
- // clang-format on
-
- // Clear the message tag.
- out_.set_tag(0);
-
- bool called = false;
- IPAddress server_ip;
- config_.ValidateClientHello(
- msg, client_address_.address(), server_ip, client_version_, &clock_,
- signed_config_, std::unique_ptr<ValidateCallback>(
- new ValidateCallback(this, true, "", &called)));
- // The verification request was queued.
- ASSERT_FALSE(called);
- EXPECT_EQ(0u, out_.tag());
- EXPECT_EQ(1, strike_register_client_->PendingVerifications());
-
- // Continue processing the verification request.
- strike_register_client_->RunPendingVerifications();
- ASSERT_TRUE(called);
- EXPECT_EQ(0, strike_register_client_->PendingVerifications());
- // The message should be accepted now.
- EXPECT_EQ(kSHLO, out_.tag());
-
- // Rejected if replayed.
- config_.ValidateClientHello(
- msg, client_address_.address(), server_ip, client_version_, &clock_,
- signed_config_, std::unique_ptr<ValidateCallback>(
- new ValidateCallback(this, true, "", &called)));
- // The verification request was queued.
- ASSERT_FALSE(called);
- EXPECT_EQ(1, strike_register_client_->PendingVerifications());
-
- strike_register_client_->RunPendingVerifications();
- ASSERT_TRUE(called);
- EXPECT_EQ(0, strike_register_client_->PendingVerifications());
- // The message should be rejected now.
- CheckRejectTag();
-}
-
-TEST_P(AsyncStrikeServerVerificationTest, RequireHandshakeCofirmationPre33) {
- FLAGS_quic_require_handshake_confirmation = false;
- FLAGS_quic_require_handshake_confirmation_pre33 = true;
- // clang-format off
- CryptoHandshakeMessage msg = CryptoTestUtils::Message(
- "CHLO",
- "PDMD", "X509",
- "AEAD", "AESG",
- "KEXS", "C255",
- "SNI", "foobar1.example.com",
- "SCID", scid_hex_.c_str(),
- "#004b5453", srct_hex_.c_str(),
- "PUBS", pub_hex_.c_str(),
- "NONC", nonce_hex_.c_str(),
- "VER\0", client_version_string_.c_str(),
- "XLCT", XlctHexString().c_str(),
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
- // clang-format on
-
- ShouldSucceed(msg);
-
- ASSERT_EQ(kSHLO, out_.tag());
- CheckServerHello(out_);
-}
-
} // namespace test
} // namespace net
« no previous file with comments | « no previous file | net/quic/core/crypto/quic_crypto_server_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698