Improve QuicCryptoServerStreamBase functions for querying resumption status
QuicCryptoServerStreamBase::ZeroRttAttempted is currently only used in one
place, which is to query whether or not the client attempted to resume the
crypto connection. In QUIC Crypto, the only way to resume a connection is if
it's a 0-RTT connection, but in TLS, a resumption can occur without 0-RTT.
Given this difference, it makes sense to change the semantics (and name) of
ZeroRttAttempted to match its use (and simplify its implementation for the
TLS handshake). This CL also implements the previously unimplemented
TlsServerHandshaker::ResumptionAttempted.
QuicCryptoServerStreamBase is also missing a function to query whether the
connection was actually a resumption, so this CL adds the unused
IsResumption function.
No behavior changes: renames a method, adds new unused method, not flag protected
PiperOrigin-RevId: 314368205
Change-Id: I985fbc278493f6f104db9b509d83103e37bca48f
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc
index 555bc66..cdc89d8 100644
--- a/quic/core/tls_server_handshaker.cc
+++ b/quic/core/tls_server_handshaker.cc
@@ -137,6 +137,14 @@
return false;
}
+bool TlsServerHandshaker::IsResumption() const {
+ return SSL_session_reused(ssl());
+}
+
+bool TlsServerHandshaker::ResumptionAttempted() const {
+ return ticket_received_;
+}
+
int TlsServerHandshaker::NumServerConfigUpdateMessagesSent() const {
// SCUP messages aren't supported when using the TLS handshake.
return 0;
@@ -147,11 +155,6 @@
return nullptr;
}
-bool TlsServerHandshaker::ZeroRttAttempted() const {
- // TODO(nharper): Support 0-RTT with TLS 1.3 in QUIC.
- return false;
-}
-
void TlsServerHandshaker::SetPreviousCachedNetworkParams(
CachedNetworkParameters /*cached_network_params*/) {}
@@ -470,6 +473,7 @@
DCHECK(proof_source_->GetTicketCrypter());
if (!ticket_decryption_callback_) {
+ ticket_received_ = true;
ticket_decryption_callback_ = new DecryptCallback(this);
proof_source_->GetTicketCrypter()->Decrypt(
in, std::unique_ptr<DecryptCallback>(ticket_decryption_callback_));