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

Side by Side Diff: net/quic/core/crypto/quic_crypto_client_config.cc

Issue 2808893003: Replace quic_restart_flag_quic_big_endian_connection_id with quic_restart_flag_quic_big_endian_conn… (Closed)
Patch Set: Created 3 years, 8 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
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/core/crypto/quic_crypto_client_config.h" 5 #include "net/quic/core/crypto/quic_crypto_client_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "net/quic/core/crypto/cert_compressor.h" 11 #include "net/quic/core/crypto/cert_compressor.h"
12 #include "net/quic/core/crypto/chacha20_poly1305_encrypter.h" 12 #include "net/quic/core/crypto/chacha20_poly1305_encrypter.h"
13 #include "net/quic/core/crypto/channel_id.h" 13 #include "net/quic/core/crypto/channel_id.h"
14 #include "net/quic/core/crypto/common_cert_set.h" 14 #include "net/quic/core/crypto/common_cert_set.h"
15 #include "net/quic/core/crypto/crypto_framer.h" 15 #include "net/quic/core/crypto/crypto_framer.h"
16 #include "net/quic/core/crypto/crypto_utils.h" 16 #include "net/quic/core/crypto/crypto_utils.h"
17 #include "net/quic/core/crypto/curve25519_key_exchange.h" 17 #include "net/quic/core/crypto/curve25519_key_exchange.h"
18 #include "net/quic/core/crypto/key_exchange.h" 18 #include "net/quic/core/crypto/key_exchange.h"
19 #include "net/quic/core/crypto/p256_key_exchange.h" 19 #include "net/quic/core/crypto/p256_key_exchange.h"
20 #include "net/quic/core/crypto/proof_verifier.h" 20 #include "net/quic/core/crypto/proof_verifier.h"
21 #include "net/quic/core/crypto/quic_encrypter.h" 21 #include "net/quic/core/crypto/quic_encrypter.h"
22 #include "net/quic/core/crypto/quic_random.h" 22 #include "net/quic/core/crypto/quic_random.h"
23 #include "net/quic/core/quic_utils.h" 23 #include "net/quic/core/quic_utils.h"
24 #include "net/quic/platform/api/quic_bug_tracker.h" 24 #include "net/quic/platform/api/quic_bug_tracker.h"
25 #include "net/quic/platform/api/quic_endian.h"
25 #include "net/quic/platform/api/quic_hostname_utils.h" 26 #include "net/quic/platform/api/quic_hostname_utils.h"
26 #include "net/quic/platform/api/quic_logging.h" 27 #include "net/quic/platform/api/quic_logging.h"
27 #include "net/quic/platform/api/quic_map_util.h" 28 #include "net/quic/platform/api/quic_map_util.h"
28 #include "net/quic/platform/api/quic_ptr_util.h" 29 #include "net/quic/platform/api/quic_ptr_util.h"
29 #include "net/quic/platform/api/quic_text_utils.h" 30 #include "net/quic/platform/api/quic_text_utils.h"
30 31
31 using std::string; 32 using std::string;
32 33
33 namespace net { 34 namespace net {
34 35
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 QuicConnectionId connection_id, 493 QuicConnectionId connection_id,
493 const QuicVersion preferred_version, 494 const QuicVersion preferred_version,
494 const CachedState* cached, 495 const CachedState* cached,
495 QuicWallTime now, 496 QuicWallTime now,
496 QuicRandom* rand, 497 QuicRandom* rand,
497 const ChannelIDKey* channel_id_key, 498 const ChannelIDKey* channel_id_key,
498 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, 499 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
499 CryptoHandshakeMessage* out, 500 CryptoHandshakeMessage* out,
500 string* error_details) const { 501 string* error_details) const {
501 DCHECK(error_details != nullptr); 502 DCHECK(error_details != nullptr);
503 if (QuicUtils::IsConnectionIdWireFormatBigEndian(Perspective::IS_CLIENT)) {
504 connection_id = QuicEndian::HostToNet64(connection_id);
505 }
502 506
503 FillInchoateClientHello(server_id, preferred_version, cached, rand, 507 FillInchoateClientHello(server_id, preferred_version, cached, rand,
504 /* demand_x509_proof= */ true, out_params, out); 508 /* demand_x509_proof= */ true, out_params, out);
505 509
506 const CryptoHandshakeMessage* scfg = cached->GetServerConfig(); 510 const CryptoHandshakeMessage* scfg = cached->GetServerConfig();
507 if (!scfg) { 511 if (!scfg) {
508 // This should never happen as our caller should have checked 512 // This should never happen as our caller should have checked
509 // cached->IsComplete() before calling this function. 513 // cached->IsComplete() before calling this function.
510 *error_details = "Handshake not ready"; 514 *error_details = "Handshake not ready";
511 return QUIC_CRYPTO_INTERNAL_ERROR; 515 return QUIC_CRYPTO_INTERNAL_ERROR;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if (rej.GetStringPiece(kServerNonceTag, &nonce)) { 816 if (rej.GetStringPiece(kServerNonceTag, &nonce)) {
813 out_params->server_nonce = nonce.as_string(); 817 out_params->server_nonce = nonce.as_string();
814 } 818 }
815 819
816 if (rej.tag() == kSREJ) { 820 if (rej.tag() == kSREJ) {
817 QuicConnectionId connection_id; 821 QuicConnectionId connection_id;
818 if (rej.GetUint64(kRCID, &connection_id) != QUIC_NO_ERROR) { 822 if (rej.GetUint64(kRCID, &connection_id) != QUIC_NO_ERROR) {
819 *error_details = "Missing kRCID"; 823 *error_details = "Missing kRCID";
820 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; 824 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND;
821 } 825 }
826 if (QuicUtils::IsConnectionIdWireFormatBigEndian(Perspective::IS_CLIENT)) {
827 connection_id = QuicEndian::NetToHost64(connection_id);
828 }
822 cached->add_server_designated_connection_id(connection_id); 829 cached->add_server_designated_connection_id(connection_id);
823 if (!nonce.empty()) { 830 if (!nonce.empty()) {
824 cached->add_server_nonce(nonce.as_string()); 831 cached->add_server_nonce(nonce.as_string());
825 } 832 }
826 return QUIC_NO_ERROR; 833 return QUIC_NO_ERROR;
827 } 834 }
828 835
829 return QUIC_NO_ERROR; 836 return QUIC_NO_ERROR;
830 } 837 }
831 838
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 } 990 }
984 991
985 // Update canonical version to point at the "most recent" entry. 992 // Update canonical version to point at the "most recent" entry.
986 canonical_server_map_[suffix_server_id] = server_id; 993 canonical_server_map_[suffix_server_id] = server_id;
987 994
988 server_state->InitializeFrom(*canonical_state); 995 server_state->InitializeFrom(*canonical_state);
989 return true; 996 return true;
990 } 997 }
991 998
992 } // namespace net 999 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/crypto_server_test.cc ('k') | net/quic/core/crypto/quic_crypto_client_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698