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

Unified Diff: net/quic/quic_connection_test.cc

Issue 912163002: Change the QuicEncrypter to accept a pre-allocated buffer instead of (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Change_QuicPacketCreator_85897935
Patch Set: Reverting logging changes Created 5 years, 10 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/crypto/quic_encrypter.h ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 5a76ec4730660a743ca7ba5e37ac4da541c5fb18..a25065eb8463ad5b5eb06d5d631e116ac51c0f06 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -87,13 +87,20 @@ class TaggingEncrypter : public QuicEncrypter {
return true;
}
- QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number,
- StringPiece associated_data,
- StringPiece plaintext) override {
+ bool EncryptPacket(QuicPacketSequenceNumber sequence_number,
+ StringPiece associated_data,
+ StringPiece plaintext,
+ char* output,
+ size_t* output_length,
+ size_t max_output_length) override {
const size_t len = plaintext.size() + kTagSize;
- uint8* buffer = new uint8[len];
- Encrypt(StringPiece(), associated_data, plaintext, buffer);
- return new QuicData(reinterpret_cast<char*>(buffer), len, true);
+ if (max_output_length < len) {
+ return false;
+ }
+ Encrypt(StringPiece(), associated_data, plaintext,
+ reinterpret_cast<unsigned char*>(output));
+ *output_length = len;
+ return true;
}
size_t GetKeySize() const override { return 0; }
« no previous file with comments | « net/quic/crypto/quic_encrypter.h ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698