Internal change PiperOrigin-RevId: 546338842
diff --git a/quiche/quic/core/quic_crypto_client_handshaker.cc b/quiche/quic/core/quic_crypto_client_handshaker.cc index 0f980cb..830f9f7 100644 --- a/quiche/quic/core/quic_crypto_client_handshaker.cc +++ b/quiche/quic/core/quic_crypto_client_handshaker.cc
@@ -115,6 +115,11 @@ return num_client_hellos_; } +bool QuicCryptoClientHandshaker::ResumptionAttempted() const { + QUICHE_DCHECK(false); + return false; +} + bool QuicCryptoClientHandshaker::IsResumption() const { QUIC_BUG_IF(quic_bug_12522_1, !one_rtt_keys_available_); // While 0-RTT handshakes could be considered to be like resumption, QUIC
diff --git a/quiche/quic/core/quic_crypto_client_handshaker.h b/quiche/quic/core/quic_crypto_client_handshaker.h index dbbd942..b046405 100644 --- a/quiche/quic/core/quic_crypto_client_handshaker.h +++ b/quiche/quic/core/quic_crypto_client_handshaker.h
@@ -37,6 +37,7 @@ // From QuicCryptoClientStream::HandshakerInterface bool CryptoConnect() override; int num_sent_client_hellos() const override; + bool ResumptionAttempted() const override; bool IsResumption() const override; bool EarlyDataAccepted() const override; ssl_early_data_reason_t EarlyDataReason() const override;
diff --git a/quiche/quic/core/quic_crypto_client_stream.cc b/quiche/quic/core/quic_crypto_client_stream.cc index 3c6dbe7..84eb9ae 100644 --- a/quiche/quic/core/quic_crypto_client_stream.cc +++ b/quiche/quic/core/quic_crypto_client_stream.cc
@@ -66,6 +66,10 @@ return handshaker_->num_sent_client_hellos(); } +bool QuicCryptoClientStream::ResumptionAttempted() const { + return handshaker_->ResumptionAttempted(); +} + bool QuicCryptoClientStream::IsResumption() const { return handshaker_->IsResumption(); }
diff --git a/quiche/quic/core/quic_crypto_client_stream.h b/quiche/quic/core/quic_crypto_client_stream.h index 0a3e5e4..ab62b35 100644 --- a/quiche/quic/core/quic_crypto_client_stream.h +++ b/quiche/quic/core/quic_crypto_client_stream.h
@@ -47,6 +47,9 @@ // than the number of round-trips needed for the handshake. virtual int num_sent_client_hellos() const = 0; + // Whether TLS resumption was attempted by this client. IETF QUIC only. + virtual bool ResumptionAttempted() const = 0; + // Returns true if the handshake performed was a resumption instead of a full // handshake. Resumption only makes sense for TLS handshakes - there is no // concept of resumption for QUIC crypto even though it supports a 0-RTT @@ -139,6 +142,9 @@ // than the number of round-trips needed for the handshake. virtual int num_sent_client_hellos() const = 0; + // Whether TLS resumption was attempted by this client. IETF QUIC only. + virtual bool ResumptionAttempted() const = 0; + // Returns true if the handshake performed was a resumption instead of a // full handshake. Resumption only makes sense for TLS handshakes - there is // no concept of resumption for QUIC crypto even though it supports a 0-RTT @@ -264,6 +270,7 @@ // From QuicCryptoClientStreamBase bool CryptoConnect() override; int num_sent_client_hellos() const override; + bool ResumptionAttempted() const override; bool IsResumption() const override; bool EarlyDataAccepted() const override; ssl_early_data_reason_t EarlyDataReason() const override;
diff --git a/quiche/quic/core/tls_client_handshaker.cc b/quiche/quic/core/tls_client_handshaker.cc index 8ae63cc..f15e932 100644 --- a/quiche/quic/core/tls_client_handshaker.cc +++ b/quiche/quic/core/tls_client_handshaker.cc
@@ -333,6 +333,11 @@ int TlsClientHandshaker::num_sent_client_hellos() const { return 0; } +bool TlsClientHandshaker::ResumptionAttempted() const { + QUIC_BUG_IF(quic_tls_client_resumption_attempted, !encryption_established_); + return cached_state_ != nullptr; +} + bool TlsClientHandshaker::IsResumption() const { QUIC_BUG_IF(quic_bug_12736_1, !one_rtt_keys_available()); return SSL_session_reused(ssl()) == 1;
diff --git a/quiche/quic/core/tls_client_handshaker.h b/quiche/quic/core/tls_client_handshaker.h index 06581b5..dd7e393 100644 --- a/quiche/quic/core/tls_client_handshaker.h +++ b/quiche/quic/core/tls_client_handshaker.h
@@ -43,6 +43,7 @@ // From QuicCryptoClientStream::HandshakerInterface bool CryptoConnect() override; int num_sent_client_hellos() const override; + bool ResumptionAttempted() const override; bool IsResumption() const override; bool EarlyDataAccepted() const override; ssl_early_data_reason_t EarlyDataReason() const override;
diff --git a/quiche/quic/core/tls_client_handshaker_test.cc b/quiche/quic/core/tls_client_handshaker_test.cc index b11dd0c..414ecf2 100644 --- a/quiche/quic/core/tls_client_handshaker_test.cc +++ b/quiche/quic/core/tls_client_handshaker_test.cc
@@ -368,6 +368,7 @@ EXPECT_EQ(PROTOCOL_TLS1_3, stream()->handshake_protocol()); EXPECT_TRUE(stream()->encryption_established()); EXPECT_TRUE(stream()->one_rtt_keys_available()); + EXPECT_FALSE(stream()->ResumptionAttempted()); EXPECT_FALSE(stream()->IsResumption()); // Create a second connection @@ -377,6 +378,7 @@ EXPECT_EQ(PROTOCOL_TLS1_3, stream()->handshake_protocol()); EXPECT_TRUE(stream()->encryption_established()); EXPECT_TRUE(stream()->one_rtt_keys_available()); + EXPECT_TRUE(stream()->ResumptionAttempted()); EXPECT_TRUE(stream()->IsResumption()); } @@ -390,6 +392,7 @@ EXPECT_EQ(PROTOCOL_TLS1_3, stream()->handshake_protocol()); EXPECT_TRUE(stream()->encryption_established()); EXPECT_TRUE(stream()->one_rtt_keys_available()); + EXPECT_FALSE(stream()->ResumptionAttempted()); EXPECT_FALSE(stream()->IsResumption()); // Create a second connection, but disable resumption on the server. @@ -400,6 +403,7 @@ EXPECT_EQ(PROTOCOL_TLS1_3, stream()->handshake_protocol()); EXPECT_TRUE(stream()->encryption_established()); EXPECT_TRUE(stream()->one_rtt_keys_available()); + EXPECT_TRUE(stream()->ResumptionAttempted()); EXPECT_FALSE(stream()->IsResumption()); EXPECT_FALSE(stream()->EarlyDataAccepted()); EXPECT_EQ(stream()->EarlyDataReason(),