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

Unified Diff: net/quic/crypto/quic_crypto_client_config.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/null_encrypter_test.cc ('k') | net/quic/crypto/quic_encrypter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/quic_crypto_client_config.cc
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index 1e12424b111065ed5fdca7a144d5b542c5d79196..18e9e60a1fa4e0b866252dc37fede620f8b59bba 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -545,16 +545,19 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
}
const QuicData& cetv_plaintext = cetv.GetSerialized();
- scoped_ptr<QuicData> cetv_ciphertext(crypters.encrypter->EncryptPacket(
- 0 /* sequence number */,
- StringPiece() /* associated data */,
- cetv_plaintext.AsStringPiece()));
- if (!cetv_ciphertext.get()) {
+ const size_t encrypted_len =
+ crypters.encrypter->GetCiphertextSize(cetv_plaintext.length());
+ scoped_ptr<char[]> output(new char[encrypted_len]);
+ size_t output_size = 0;
+ if (!crypters.encrypter->EncryptPacket(
+ 0 /* sequence number */, StringPiece() /* associated data */,
+ cetv_plaintext.AsStringPiece(), output.get(), &output_size,
+ encrypted_len)) {
*error_details = "Packet encryption failed";
return QUIC_ENCRYPTION_FAILURE;
}
- out->SetStringPiece(kCETV, cetv_ciphertext->AsStringPiece());
+ out->SetStringPiece(kCETV, StringPiece(output.get(), output_size));
out->MarkDirty();
out->set_minimum_size(orig_min_size);
« no previous file with comments | « net/quic/crypto/null_encrypter_test.cc ('k') | net/quic/crypto/quic_encrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698