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

Unified Diff: net/quic/crypto/quic_crypto_client_config.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_test.cc ('k') | net/quic/crypto/quic_crypto_server_config.cc » ('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..9ec19fd8f1b5d737cc2b5d958c14a717f4f32e1f 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -23,8 +23,6 @@
#include "net/quic/quic_utils.h"
using base::StringPiece;
-using std::find;
-using std::make_pair;
using std::map;
using std::string;
using std::vector;
@@ -324,7 +322,7 @@ QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
}
CachedState* cached = new CachedState;
- cached_states_.insert(make_pair(server_id, cached));
+ cached_states_.insert(std::make_pair(server_id, cached));
bool cache_populated = PopulateFromCanonicalConfig(server_id, cached);
UMA_HISTOGRAM_BOOLEAN(
"Net.QuicCryptoClientConfig.PopulatedFromCanonicalConfig",
@@ -545,16 +543,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);
@@ -837,7 +838,7 @@ void QuicCryptoClientConfig::PreferAesGcm() {
if (aead.size() <= 1) {
return;
}
- QuicTagVector::iterator pos = find(aead.begin(), aead.end(), kAESG);
+ QuicTagVector::iterator pos = std::find(aead.begin(), aead.end(), kAESG);
if (pos != aead.end()) {
aead.erase(pos);
aead.insert(aead.begin(), kAESG);
« no previous file with comments | « net/quic/crypto/null_encrypter_test.cc ('k') | net/quic/crypto/quic_crypto_server_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698