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

Unified Diff: net/quic/crypto/null_encrypter.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/null_encrypter.h ('k') | net/quic/crypto/null_encrypter_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/null_encrypter.cc
diff --git a/net/quic/crypto/null_encrypter.cc b/net/quic/crypto/null_encrypter.cc
index 5f1a85b114aa25d25bec69e929293af0752f0868..286694ad7b24885fdcb1865c03235ee28330786d 100644
--- a/net/quic/crypto/null_encrypter.cc
+++ b/net/quic/crypto/null_encrypter.cc
@@ -34,14 +34,20 @@ bool NullEncrypter::Encrypt(
return true;
}
-QuicData* NullEncrypter::EncryptPacket(
- QuicPacketSequenceNumber /*sequence_number*/,
- StringPiece associated_data,
- StringPiece plaintext) {
+bool NullEncrypter::EncryptPacket(QuicPacketSequenceNumber /*sequence_number*/,
+ StringPiece associated_data,
+ StringPiece plaintext,
+ char* output,
+ size_t* output_length,
+ size_t max_output_length) {
const size_t len = plaintext.size() + GetHashLength();
- 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 NullEncrypter::GetKeySize() const { return 0; }
« no previous file with comments | « net/quic/crypto/null_encrypter.h ('k') | net/quic/crypto/null_encrypter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698