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

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

Issue 181483006: PACKET_NBYTE_GUID -> PACKET_NBYTE_CONNECTION_ID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small comment fix Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.h ('k') | net/quic/quic_client_session.cc » ('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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 if (result->error_code == QUIC_NO_ERROR) { 462 if (result->error_code == QUIC_NO_ERROR) {
463 EvaluateClientHello(primary_orbit, result, done_cb); 463 EvaluateClientHello(primary_orbit, result, done_cb);
464 } else { 464 } else {
465 done_cb->Run(result); 465 done_cb->Run(result);
466 } 466 }
467 } 467 }
468 468
469 QuicErrorCode QuicCryptoServerConfig::ProcessClientHello( 469 QuicErrorCode QuicCryptoServerConfig::ProcessClientHello(
470 const ValidateClientHelloResultCallback::Result& validate_chlo_result, 470 const ValidateClientHelloResultCallback::Result& validate_chlo_result,
471 QuicGuid guid, 471 QuicConnectionId connection_id,
472 IPEndPoint client_address, 472 IPEndPoint client_address,
473 QuicVersion version, 473 QuicVersion version,
474 const QuicVersionVector& supported_versions, 474 const QuicVersionVector& supported_versions,
475 const QuicClock* clock, 475 const QuicClock* clock,
476 QuicRandom* rand, 476 QuicRandom* rand,
477 QuicCryptoNegotiatedParameters *params, 477 QuicCryptoNegotiatedParameters *params,
478 CryptoHandshakeMessage* out, 478 CryptoHandshakeMessage* out,
479 string* error_details) const { 479 string* error_details) const {
480 DCHECK(error_details); 480 DCHECK(error_details);
481 481
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 if (!info.sni.empty()) { 595 if (!info.sni.empty()) {
596 scoped_ptr<char[]> sni_tmp(new char[info.sni.length() + 1]); 596 scoped_ptr<char[]> sni_tmp(new char[info.sni.length() + 1]);
597 memcpy(sni_tmp.get(), info.sni.data(), info.sni.length()); 597 memcpy(sni_tmp.get(), info.sni.data(), info.sni.length());
598 sni_tmp[info.sni.length()] = 0; 598 sni_tmp[info.sni.length()] = 0;
599 params->sni = CryptoUtils::NormalizeHostname(sni_tmp.get()); 599 params->sni = CryptoUtils::NormalizeHostname(sni_tmp.get());
600 } 600 }
601 601
602 string hkdf_suffix; 602 string hkdf_suffix;
603 const QuicData& client_hello_serialized = client_hello.GetSerialized(); 603 const QuicData& client_hello_serialized = client_hello.GetSerialized();
604 hkdf_suffix.reserve(sizeof(guid) + client_hello_serialized.length() + 604 hkdf_suffix.reserve(sizeof(connection_id) + client_hello_serialized.length() +
605 requested_config->serialized.size()); 605 requested_config->serialized.size());
606 hkdf_suffix.append(reinterpret_cast<char*>(&guid), sizeof(guid)); 606 hkdf_suffix.append(reinterpret_cast<char*>(&connection_id),
607 sizeof(connection_id));
607 hkdf_suffix.append(client_hello_serialized.data(), 608 hkdf_suffix.append(client_hello_serialized.data(),
608 client_hello_serialized.length()); 609 client_hello_serialized.length());
609 hkdf_suffix.append(requested_config->serialized); 610 hkdf_suffix.append(requested_config->serialized);
610 611
611 StringPiece cetv_ciphertext; 612 StringPiece cetv_ciphertext;
612 if (requested_config->channel_id_enabled && 613 if (requested_config->channel_id_enabled &&
613 client_hello.GetStringPiece(kCETV, &cetv_ciphertext)) { 614 client_hello.GetStringPiece(kCETV, &cetv_ciphertext)) {
614 CryptoHandshakeMessage client_hello_copy(client_hello); 615 CryptoHandshakeMessage client_hello_copy(client_hello);
615 client_hello_copy.Erase(kCETV); 616 client_hello_copy.Erase(kCETV);
616 client_hello_copy.Erase(kPAD); 617 client_hello_copy.Erase(kPAD);
617 618
618 const QuicData& client_hello_serialized = client_hello_copy.GetSerialized(); 619 const QuicData& client_hello_serialized = client_hello_copy.GetSerialized();
619 string hkdf_input; 620 string hkdf_input;
620 hkdf_input.append(QuicCryptoConfig::kCETVLabel, 621 hkdf_input.append(QuicCryptoConfig::kCETVLabel,
621 strlen(QuicCryptoConfig::kCETVLabel) + 1); 622 strlen(QuicCryptoConfig::kCETVLabel) + 1);
622 hkdf_input.append(reinterpret_cast<char*>(&guid), sizeof(guid)); 623 hkdf_input.append(reinterpret_cast<char*>(&connection_id),
624 sizeof(connection_id));
623 hkdf_input.append(client_hello_serialized.data(), 625 hkdf_input.append(client_hello_serialized.data(),
624 client_hello_serialized.length()); 626 client_hello_serialized.length());
625 hkdf_input.append(requested_config->serialized); 627 hkdf_input.append(requested_config->serialized);
626 628
627 CrypterPair crypters; 629 CrypterPair crypters;
628 if (!CryptoUtils::DeriveKeys(params->initial_premaster_secret, params->aead, 630 if (!CryptoUtils::DeriveKeys(params->initial_premaster_secret, params->aead,
629 info.client_nonce, info.server_nonce, 631 info.client_nonce, info.server_nonce,
630 hkdf_input, CryptoUtils::SERVER, &crypters)) { 632 hkdf_input, CryptoUtils::SERVER, &crypters)) {
631 *error_details = "Symmetric key setup failed"; 633 *error_details = "Symmetric key setup failed";
632 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED; 634 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1329
1328 QuicCryptoServerConfig::Config::Config() 1330 QuicCryptoServerConfig::Config::Config()
1329 : channel_id_enabled(false), 1331 : channel_id_enabled(false),
1330 is_primary(false), 1332 is_primary(false),
1331 primary_time(QuicWallTime::Zero()), 1333 primary_time(QuicWallTime::Zero()),
1332 priority(0) {} 1334 priority(0) {}
1333 1335
1334 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); } 1336 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); }
1335 1337
1336 } // namespace net 1338 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.h ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698