Limit the amount of incoming crypto data that will be buffered.

gfe-relnote: protected by disabled flag-protected QUIC_VERSION_48
PiperOrigin-RevId: 266019141
Change-Id: Ife996bdf80a28b3bcce4b02cda49bff0fd23a071
diff --git a/quic/core/tls_handshaker.cc b/quic/core/tls_handshaker.cc
index db50f5a..e6e59fd 100644
--- a/quic/core/tls_handshaker.cc
+++ b/quic/core/tls_handshaker.cc
@@ -54,6 +54,11 @@
   return true;
 }
 
+size_t TlsHandshaker::BufferSizeLimitForLevel(EncryptionLevel level) const {
+  return SSL_quic_max_handshake_flight_len(
+      ssl(), TlsConnection::BoringEncryptionLevel(level));
+}
+
 const EVP_MD* TlsHandshaker::Prf() {
   return EVP_get_digestbynid(
       SSL_CIPHER_get_prf_nid(SSL_get_pending_cipher(ssl())));