Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2186)

Unified Diff: net/quic/quic_framer.cc

Issue 1785513003: Simplify QUIC's encryption path now that FEC is gone. Protected by FLAG_quic_inplace_encryption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116261116
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_framer.cc
diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc
index 3100a85fe56bc31f4df455eba9c2b46df0baa7ca..042acdc8a82a3ae6adc53cc06d17c1e829c3f6f8 100644
--- a/net/quic/quic_framer.cc
+++ b/net/quic/quic_framer.cc
@@ -1632,6 +1632,27 @@ void QuicFramer::SetEncrypter(EncryptionLevel level, QuicEncrypter* encrypter) {
encrypter_[level].reset(encrypter);
}
+size_t QuicFramer::EncryptInPlace(EncryptionLevel level,
+ QuicPathId path_id,
+ QuicPacketNumber packet_number,
+ size_t ad_len,
+ size_t total_len,
+ size_t buffer_len,
+ char* buffer) {
+ size_t output_length = 0;
+ if (!encrypter_[level]->EncryptPacket(
+ path_id, packet_number,
+ StringPiece(buffer, ad_len), // Associated data
+ StringPiece(buffer + ad_len, total_len - ad_len), // Plaintext
+ buffer + ad_len, // Destination buffer
+ &output_length, buffer_len - ad_len)) {
+ RaiseError(QUIC_ENCRYPTION_FAILURE);
+ return 0;
+ }
+
+ return ad_len + output_length;
+}
+
size_t QuicFramer::EncryptPayload(EncryptionLevel level,
QuicPathId path_id,
QuicPacketNumber packet_number,
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698