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

Side by Side Diff: net/quic/crypto/quic_crypto_server_config.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « net/quic/crypto/p256_key_exchange_nss.cc ('k') | net/quic/crypto/quic_server_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/crypto/quic_crypto_server_config.h" 5 #include "net/quic/crypto/quic_crypto_server_config.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 CryptoHandshakeMessage msg; 244 CryptoHandshakeMessage msg;
245 245
246 const string curve25519_private_key = 246 const string curve25519_private_key =
247 Curve25519KeyExchange::NewPrivateKey(rand); 247 Curve25519KeyExchange::NewPrivateKey(rand);
248 scoped_ptr<Curve25519KeyExchange> curve25519( 248 scoped_ptr<Curve25519KeyExchange> curve25519(
249 Curve25519KeyExchange::New(curve25519_private_key)); 249 Curve25519KeyExchange::New(curve25519_private_key));
250 StringPiece curve25519_public_value = curve25519->public_value(); 250 StringPiece curve25519_public_value = curve25519->public_value();
251 251
252 string encoded_public_values; 252 string encoded_public_values;
253 // First three bytes encode the length of the public value. 253 // First three bytes encode the length of the public value.
254 encoded_public_values.push_back(curve25519_public_value.size()); 254 DCHECK_LT(curve25519_public_value.size(), (1U << 24));
255 encoded_public_values.push_back(curve25519_public_value.size() >> 8); 255 encoded_public_values.push_back(
256 encoded_public_values.push_back(curve25519_public_value.size() >> 16); 256 static_cast<char>(curve25519_public_value.size()));
257 encoded_public_values.push_back(
258 static_cast<char>(curve25519_public_value.size() >> 8));
259 encoded_public_values.push_back(
260 static_cast<char>(curve25519_public_value.size() >> 16));
257 encoded_public_values.append(curve25519_public_value.data(), 261 encoded_public_values.append(curve25519_public_value.data(),
258 curve25519_public_value.size()); 262 curve25519_public_value.size());
259 263
260 string p256_private_key; 264 string p256_private_key;
261 if (options.p256) { 265 if (options.p256) {
262 p256_private_key = P256KeyExchange::NewPrivateKey(); 266 p256_private_key = P256KeyExchange::NewPrivateKey();
263 scoped_ptr<P256KeyExchange> p256(P256KeyExchange::New(p256_private_key)); 267 scoped_ptr<P256KeyExchange> p256(P256KeyExchange::New(p256_private_key));
264 StringPiece p256_public_value = p256->public_value(); 268 StringPiece p256_public_value = p256->public_value();
265 269
266 encoded_public_values.push_back(p256_public_value.size()); 270 DCHECK_LT(p256_public_value.size(), (1U << 24));
267 encoded_public_values.push_back(p256_public_value.size() >> 8); 271 encoded_public_values.push_back(
268 encoded_public_values.push_back(p256_public_value.size() >> 16); 272 static_cast<char>(p256_public_value.size()));
273 encoded_public_values.push_back(
274 static_cast<char>(p256_public_value.size() >> 8));
275 encoded_public_values.push_back(
276 static_cast<char>(p256_public_value.size() >> 16));
269 encoded_public_values.append(p256_public_value.data(), 277 encoded_public_values.append(p256_public_value.data(),
270 p256_public_value.size()); 278 p256_public_value.size());
271 } 279 }
272 280
273 msg.set_tag(kSCFG); 281 msg.set_tag(kSCFG);
274 if (options.p256) { 282 if (options.p256) {
275 msg.SetTaglist(kKEXS, kC255, kP256, 0); 283 msg.SetTaglist(kKEXS, kC255, kP256, 0);
276 } else { 284 } else {
277 msg.SetTaglist(kKEXS, kC255, 0); 285 msg.SetTaglist(kKEXS, kC255, 0);
278 } 286 }
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 QuicCryptoServerConfig::Config::Config() 1566 QuicCryptoServerConfig::Config::Config()
1559 : channel_id_enabled(false), 1567 : channel_id_enabled(false),
1560 is_primary(false), 1568 is_primary(false),
1561 primary_time(QuicWallTime::Zero()), 1569 primary_time(QuicWallTime::Zero()),
1562 priority(0), 1570 priority(0),
1563 source_address_token_boxer(nullptr) {} 1571 source_address_token_boxer(nullptr) {}
1564 1572
1565 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); } 1573 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); }
1566 1574
1567 } // namespace net 1575 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/p256_key_exchange_nss.cc ('k') | net/quic/crypto/quic_server_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698