Add support for accepting 0-RTT in TlsServerHandshaker
This adds support at the crypto handshake layer for supporting 0-RTT TLS
handshakes on the server. Part of this support includes receiving a signal
from the application layer, via a new method
QuicCryptoStream::SetServerApplicationStateForResumption. This method
replaces the previously client-only
QuicCryptoClientStream::OnApplicationState.
Introduce quic 0-rtt tls support, protected by quic_enable_zero_rtt_for_tls
PiperOrigin-RevId: 315331343
Change-Id: Ife83cf526be38bd4f5c8a3de0e6cd4c40be6f7ae
diff --git a/quic/core/quic_crypto_stream.h b/quic/core/quic_crypto_stream.h
index 49d3704..54d1b25 100644
--- a/quic/core/quic_crypto_stream.h
+++ b/quic/core/quic_crypto_stream.h
@@ -100,6 +100,21 @@
// Returns current handshake state.
virtual HandshakeState GetHandshakeState() const = 0;
+ // Called to provide the server-side application state that must be checked
+ // when performing a 0-RTT TLS resumption.
+ //
+ // On a client, this may be called at any time; 0-RTT tickets will not be
+ // cached until this function is called. When a 0-RTT resumption is attempted,
+ // QuicSession::SetApplicationState will be called with the state provided by
+ // a call to this function on a previous connection.
+ //
+ // On a server, this function must be called before commencing the handshake,
+ // otherwise 0-RTT tickets will not be issued. On subsequent connections,
+ // 0-RTT will be rejected if the data passed into this function does not match
+ // the data passed in on the connection where the 0-RTT ticket was issued.
+ virtual void SetServerApplicationStateForResumption(
+ std::unique_ptr<ApplicationState> state) = 0;
+
// Returns the maximum number of bytes that can be buffered at a particular
// encryption level |level|.
virtual size_t BufferSizeLimitForLevel(EncryptionLevel level) const;