gfe-relnote: Neuter handshake data when 1-RTT packet gets decrypted in quic_loas_server_stream. Affecting QBONE, not protected.

PiperOrigin-RevId: 305301408
Change-Id: I4e52895d86e096c54678036aefa1b1198603c1a4
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc
index 73584b5..35f33c2 100644
--- a/quic/core/quic_crypto_stream.cc
+++ b/quic/core/quic_crypto_stream.cc
@@ -199,16 +199,20 @@
 }
 
 void QuicCryptoStream::NeuterUnencryptedStreamData() {
+  NeuterStreamDataOfEncryptionLevel(ENCRYPTION_INITIAL);
+}
+
+void QuicCryptoStream::NeuterStreamDataOfEncryptionLevel(
+    EncryptionLevel level) {
   if (!QuicVersionUsesCryptoFrames(session()->transport_version())) {
-    for (const auto& interval : bytes_consumed_[ENCRYPTION_INITIAL]) {
+    for (const auto& interval : bytes_consumed_[level]) {
       QuicByteCount newly_acked_length = 0;
       send_buffer().OnStreamDataAcked(
           interval.min(), interval.max() - interval.min(), &newly_acked_length);
     }
     return;
   }
-  QuicStreamSendBuffer* send_buffer =
-      &substreams_[ENCRYPTION_INITIAL].send_buffer;
+  QuicStreamSendBuffer* send_buffer = &substreams_[level].send_buffer;
   // TODO(nharper): Consider adding a Clear() method to QuicStreamSendBuffer to
   // replace the following code.
   QuicIntervalSet<QuicStreamOffset> to_ack = send_buffer->bytes_acked();
diff --git a/quic/core/quic_crypto_stream.h b/quic/core/quic_crypto_stream.h
index 23f7dfc..94e4730 100644
--- a/quic/core/quic_crypto_stream.h
+++ b/quic/core/quic_crypto_stream.h
@@ -104,6 +104,9 @@
   // Called to cancel retransmission of unencrypted crypto stream data.
   void NeuterUnencryptedStreamData();
 
+  // Called to cancel retransmission of data of encryption |level|.
+  void NeuterStreamDataOfEncryptionLevel(EncryptionLevel level);
+
   // Override to record the encryption level of consumed data.
   void OnStreamDataConsumed(size_t bytes_consumed) override;
 
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 62a1ae3..d190b6c 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -2260,5 +2260,9 @@
                   << "ALPN selected: " << alpn;
 }
 
+void QuicSession::NeuterCryptoDataOfEncryptionLevel(EncryptionLevel level) {
+  GetMutableCryptoStream()->NeuterStreamDataOfEncryptionLevel(level);
+}
+
 #undef ENDPOINT  // undef for jumbo builds
 }  // namespace quic
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index c1986e2..4c4626b 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -462,6 +462,9 @@
         max_stream + num_expected_unidirectional_static_streams_);
   }
 
+  // Called to neuter crypto data of encryption |level|.
+  void NeuterCryptoDataOfEncryptionLevel(EncryptionLevel level);
+
   // Returns the ALPN values to negotiate on this session.
   virtual std::vector<std::string> GetAlpnsToOffer() const {
     // TODO(vasilvv): this currently sets HTTP/3 by default.  Switch all