Remove unused add_server_nonce(), has_server_nonce(), and GetNextServerNonce(). Remove add_server_nonce(), has_server_nonce(), and GetNextServerNonce() from QuicCryptoClientConfig::CachedState. PiperOrigin-RevId: 366327018 Change-Id: I748288b7d8b5604551fd61b1b4348897e09c39a4
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc index 1b463c5..7a72c5a 100644 --- a/quic/core/crypto/quic_crypto_client_config.cc +++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -134,15 +134,6 @@ return scfg_.get(); } -void QuicCryptoClientConfig::CachedState::add_server_nonce( - const std::string& server_nonce) { - server_nonces_.push(server_nonce); -} - -bool QuicCryptoClientConfig::CachedState::has_server_nonce() const { - return !server_nonces_.empty(); -} - QuicCryptoClientConfig::CachedState::ServerConfigState QuicCryptoClientConfig::CachedState::SetServerConfig( absl::string_view server_config, @@ -363,17 +354,6 @@ ++generation_counter_; } -std::string QuicCryptoClientConfig::CachedState::GetNextServerNonce() { - if (server_nonces_.empty()) { - QUIC_BUG(quic_bug_12943_1) - << "Attempting to consume a server nonce that was never designated."; - return ""; - } - const std::string server_nonce = server_nonces_.front(); - server_nonces_.pop(); - return server_nonce; -} - void QuicCryptoClientConfig::SetDefaults() { // Key exchange methods. kexs = {kC255, kP256};
diff --git a/quic/core/crypto/quic_crypto_client_config.h b/quic/core/crypto/quic_crypto_client_config.h index b02f621..bb06260 100644 --- a/quic/core/crypto/quic_crypto_client_config.h +++ b/quic/core/crypto/quic_crypto_client_config.h
@@ -175,18 +175,6 @@ void set_cert_sct(absl::string_view cert_sct); - // Adds the servernonce to the queue of server nonces. - void add_server_nonce(const std::string& server_nonce); - - // If true, the crypto config contains at least one server nonce, and the - // client should use one of these nonces. - bool has_server_nonce() const; - - // This function should only be called when has_server_nonce is true. - // Returns the next server_nonce specified by the server and removes it - // from the queue of nonces. - std::string GetNextServerNonce(); - // SetProofVerifyDetails takes ownership of |details|. void SetProofVerifyDetails(ProofVerifyDetails* details); @@ -227,8 +215,6 @@ // scfg contains the cached, parsed value of |server_config|. mutable std::unique_ptr<CryptoHandshakeMessage> scfg_; - - QuicQueue<std::string> server_nonces_; }; // Used to filter server ids for partial config deletion.
diff --git a/quic/core/crypto/quic_crypto_client_config_test.cc b/quic/core/crypto/quic_crypto_client_config_test.cc index 536083f..6dd0967 100644 --- a/quic/core/crypto/quic_crypto_client_config_test.cc +++ b/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -81,45 +81,6 @@ EXPECT_EQ(details, state.proof_verify_details()); } -TEST_F(QuicCryptoClientConfigTest, CachedState_ServerNonce) { - QuicCryptoClientConfig::CachedState state; - EXPECT_FALSE(state.has_server_nonce()); - - std::string server_nonce = "nonce_1"; - state.add_server_nonce(server_nonce); - EXPECT_TRUE(state.has_server_nonce()); - EXPECT_EQ(server_nonce, state.GetNextServerNonce()); - EXPECT_FALSE(state.has_server_nonce()); - - // Allow the ID to be set multiple times. It's unusual that this would - // happen, but not impossible. - server_nonce = "nonce_2"; - state.add_server_nonce(server_nonce); - EXPECT_TRUE(state.has_server_nonce()); - EXPECT_EQ(server_nonce, state.GetNextServerNonce()); - server_nonce = "nonce_3"; - state.add_server_nonce(server_nonce); - EXPECT_EQ(server_nonce, state.GetNextServerNonce()); - EXPECT_FALSE(state.has_server_nonce()); - - // Test FIFO behavior. - const std::string first_nonce = "first_nonce"; - const std::string second_nonce = "second_nonce"; - state.add_server_nonce(first_nonce); - state.add_server_nonce(second_nonce); - EXPECT_TRUE(state.has_server_nonce()); - EXPECT_EQ(first_nonce, state.GetNextServerNonce()); - EXPECT_EQ(second_nonce, state.GetNextServerNonce()); -} - -TEST_F(QuicCryptoClientConfigTest, CachedState_ServerNonceConsumedBeforeSet) { - QuicCryptoClientConfig::CachedState state; - EXPECT_FALSE(state.has_server_nonce()); - EXPECT_QUIC_BUG(state.GetNextServerNonce(), - "Attempting to consume a server nonce " - "that was never designated."); -} - TEST_F(QuicCryptoClientConfigTest, CachedState_InitializeFrom) { QuicCryptoClientConfig::CachedState state; QuicCryptoClientConfig::CachedState other; @@ -130,7 +91,6 @@ EXPECT_EQ(state.source_address_token(), other.source_address_token()); EXPECT_EQ(state.certs(), other.certs()); EXPECT_EQ(1u, other.generation_counter()); - EXPECT_FALSE(state.has_server_nonce()); } TEST_F(QuicCryptoClientConfigTest, InchoateChlo) { @@ -492,7 +452,6 @@ AllSupportedVersionsWithQuicCrypto().front().transport_version, "", &cached, out_params, &error), IsQuicNoError()); - EXPECT_FALSE(cached.has_server_nonce()); } TEST_F(QuicCryptoClientConfigTest, ProcessRejectWithLongTTL) {