Index: net/quic/crypto/crypto_server_test.cc |
diff --git a/net/quic/crypto/crypto_server_test.cc b/net/quic/crypto/crypto_server_test.cc |
index 6c07ad7fe4db6a955d30c66b6c3271fa6e7d8943..b2fa3472e189961772a5c54787f79161a45af1c3 100644 |
--- a/net/quic/crypto/crypto_server_test.cc |
+++ b/net/quic/crypto/crypto_server_test.cc |
@@ -359,9 +359,9 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> { |
void CheckRejectTag() { |
if (RejectsAreStateless()) { |
- ASSERT_EQ(kSREJ, out_.tag()); |
+ ASSERT_EQ(kSREJ, out_.tag()) << QuicUtils::TagToString(out_.tag()); |
} else { |
- ASSERT_EQ(kREJ, out_.tag()); |
+ ASSERT_EQ(kREJ, out_.tag()) << QuicUtils::TagToString(out_.tag()); |
} |
} |
@@ -761,6 +761,7 @@ TEST_P(CryptoServerTest, ReplayProtection) { |
if (client_version_ > QUIC_VERSION_30) { |
return; |
} |
+ FLAGS_require_strike_register_or_server_nonce = false; |
// This tests that disabling replay protection works. |
// clang-format off |
CryptoHandshakeMessage msg = CryptoTestUtils::Message( |
@@ -798,6 +799,33 @@ TEST_P(CryptoServerTest, ReplayProtection) { |
CheckServerHello(out_); |
} |
+TEST_P(CryptoServerTest, NoServerNonce) { |
+ FLAGS_require_strike_register_or_server_nonce = true; |
+ // When no server nonce is present and no strike register is configured, |
+ // the CHLO should be rejected. |
+ // clang-format off |
+ CryptoHandshakeMessage msg = CryptoTestUtils::Message( |
+ "CHLO", |
+ "AEAD", "AESG", |
+ "KEXS", "C255", |
+ "SCID", scid_hex_.c_str(), |
+ "#004b5453", srct_hex_.c_str(), |
+ "PUBS", pub_hex_.c_str(), |
+ "NONC", nonce_hex_.c_str(), |
+ "XLCT", XlctHexString().c_str(), |
+ "VER\0", client_version_string_.c_str(), |
+ "$padding", static_cast<int>(kClientHelloMinimumSize), |
+ nullptr); |
+ // clang-format on |
+ |
+ ShouldSucceed(msg); |
+ |
+ CheckRejectTag(); |
+ const HandshakeFailureReason kRejectReasons[] = { |
+ SERVER_NONCE_REQUIRED_FAILURE}; |
+ CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); |
+} |
+ |
TEST_P(CryptoServerTest, ProofForSuppliedServerConfig) { |
ValueRestore<bool> old_flag(&FLAGS_quic_use_primary_config_for_proof, true); |
client_address_ = IPEndPoint(Loopback6(), 1234); |