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

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

Issue 2589983002: Create a QUIC wrapper around scoped_refptr. (Closed)
Patch Set: rm = nullptr Created 4 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
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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 it->second->Clear(); 411 it->second->Clear();
412 } 412 }
413 } 413 }
414 414
415 void QuicCryptoClientConfig::FillInchoateClientHello( 415 void QuicCryptoClientConfig::FillInchoateClientHello(
416 const QuicServerId& server_id, 416 const QuicServerId& server_id,
417 const QuicVersion preferred_version, 417 const QuicVersion preferred_version,
418 const CachedState* cached, 418 const CachedState* cached,
419 QuicRandom* rand, 419 QuicRandom* rand,
420 bool demand_x509_proof, 420 bool demand_x509_proof,
421 scoped_refptr<QuicCryptoNegotiatedParameters> out_params, 421 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
422 CryptoHandshakeMessage* out) const { 422 CryptoHandshakeMessage* out) const {
423 out->set_tag(kCHLO); 423 out->set_tag(kCHLO);
424 // TODO(rch): Remove this when we remove: 424 // TODO(rch): Remove this when we remove:
425 // FLAGS_quic_use_chlo_packet_size 425 // FLAGS_quic_use_chlo_packet_size
426 out->set_minimum_size(kClientHelloMinimumSize); 426 out->set_minimum_size(kClientHelloMinimumSize);
427 427
428 // Server name indication. We only send SNI if it's a valid domain name, as 428 // Server name indication. We only send SNI if it's a valid domain name, as
429 // per the spec. 429 // per the spec.
430 if (CryptoUtils::IsValidSNI(server_id.host())) { 430 if (CryptoUtils::IsValidSNI(server_id.host())) {
431 out->SetStringPiece(kSNI, server_id.host()); 431 out->SetStringPiece(kSNI, server_id.host());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 485
486 QuicErrorCode QuicCryptoClientConfig::FillClientHello( 486 QuicErrorCode QuicCryptoClientConfig::FillClientHello(
487 const QuicServerId& server_id, 487 const QuicServerId& server_id,
488 QuicConnectionId connection_id, 488 QuicConnectionId connection_id,
489 const QuicVersion preferred_version, 489 const QuicVersion preferred_version,
490 const CachedState* cached, 490 const CachedState* cached,
491 QuicWallTime now, 491 QuicWallTime now,
492 QuicRandom* rand, 492 QuicRandom* rand,
493 const ChannelIDKey* channel_id_key, 493 const ChannelIDKey* channel_id_key,
494 scoped_refptr<QuicCryptoNegotiatedParameters> out_params, 494 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
495 CryptoHandshakeMessage* out, 495 CryptoHandshakeMessage* out,
496 string* error_details) const { 496 string* error_details) const {
497 DCHECK(error_details != nullptr); 497 DCHECK(error_details != nullptr);
498 498
499 FillInchoateClientHello(server_id, preferred_version, cached, rand, 499 FillInchoateClientHello(server_id, preferred_version, cached, rand,
500 /* demand_x509_proof= */ true, out_params, out); 500 /* demand_x509_proof= */ true, out_params, out);
501 501
502 const CryptoHandshakeMessage* scfg = cached->GetServerConfig(); 502 const CryptoHandshakeMessage* scfg = cached->GetServerConfig();
503 if (!scfg) { 503 if (!scfg) {
504 // This should never happen as our caller should have checked 504 // This should never happen as our caller should have checked
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 778
779 return QUIC_NO_ERROR; 779 return QUIC_NO_ERROR;
780 } 780 }
781 781
782 QuicErrorCode QuicCryptoClientConfig::ProcessRejection( 782 QuicErrorCode QuicCryptoClientConfig::ProcessRejection(
783 const CryptoHandshakeMessage& rej, 783 const CryptoHandshakeMessage& rej,
784 QuicWallTime now, 784 QuicWallTime now,
785 const QuicVersion version, 785 const QuicVersion version,
786 StringPiece chlo_hash, 786 StringPiece chlo_hash,
787 CachedState* cached, 787 CachedState* cached,
788 scoped_refptr<QuicCryptoNegotiatedParameters> out_params, 788 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
789 string* error_details) { 789 string* error_details) {
790 DCHECK(error_details != nullptr); 790 DCHECK(error_details != nullptr);
791 791
792 if ((rej.tag() != kREJ) && (rej.tag() != kSREJ)) { 792 if ((rej.tag() != kREJ) && (rej.tag() != kSREJ)) {
793 *error_details = "Message is not REJ or SREJ"; 793 *error_details = "Message is not REJ or SREJ";
794 return QUIC_CRYPTO_INTERNAL_ERROR; 794 return QUIC_CRYPTO_INTERNAL_ERROR;
795 } 795 }
796 796
797 QuicErrorCode error = 797 QuicErrorCode error =
798 CacheNewServerConfig(rej, now, version, chlo_hash, 798 CacheNewServerConfig(rej, now, version, chlo_hash,
(...skipping 22 matching lines...) Expand all
821 821
822 return QUIC_NO_ERROR; 822 return QUIC_NO_ERROR;
823 } 823 }
824 824
825 QuicErrorCode QuicCryptoClientConfig::ProcessServerHello( 825 QuicErrorCode QuicCryptoClientConfig::ProcessServerHello(
826 const CryptoHandshakeMessage& server_hello, 826 const CryptoHandshakeMessage& server_hello,
827 QuicConnectionId connection_id, 827 QuicConnectionId connection_id,
828 QuicVersion version, 828 QuicVersion version,
829 const QuicVersionVector& negotiated_versions, 829 const QuicVersionVector& negotiated_versions,
830 CachedState* cached, 830 CachedState* cached,
831 scoped_refptr<QuicCryptoNegotiatedParameters> out_params, 831 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
832 string* error_details) { 832 string* error_details) {
833 DCHECK(error_details != nullptr); 833 DCHECK(error_details != nullptr);
834 834
835 QuicErrorCode valid = CryptoUtils::ValidateServerHello( 835 QuicErrorCode valid = CryptoUtils::ValidateServerHello(
836 server_hello, negotiated_versions, error_details); 836 server_hello, negotiated_versions, error_details);
837 if (valid != QUIC_NO_ERROR) { 837 if (valid != QUIC_NO_ERROR) {
838 return valid; 838 return valid;
839 } 839 }
840 840
841 // Learn about updated source address tokens. 841 // Learn about updated source address tokens.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 884
885 return QUIC_NO_ERROR; 885 return QUIC_NO_ERROR;
886 } 886 }
887 887
888 QuicErrorCode QuicCryptoClientConfig::ProcessServerConfigUpdate( 888 QuicErrorCode QuicCryptoClientConfig::ProcessServerConfigUpdate(
889 const CryptoHandshakeMessage& server_config_update, 889 const CryptoHandshakeMessage& server_config_update,
890 QuicWallTime now, 890 QuicWallTime now,
891 const QuicVersion version, 891 const QuicVersion version,
892 StringPiece chlo_hash, 892 StringPiece chlo_hash,
893 CachedState* cached, 893 CachedState* cached,
894 scoped_refptr<QuicCryptoNegotiatedParameters> out_params, 894 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
895 string* error_details) { 895 string* error_details) {
896 DCHECK(error_details != nullptr); 896 DCHECK(error_details != nullptr);
897 897
898 if (server_config_update.tag() != kSCUP) { 898 if (server_config_update.tag() != kSCUP) {
899 *error_details = "ServerConfigUpdate must have kSCUP tag."; 899 *error_details = "ServerConfigUpdate must have kSCUP tag.";
900 return QUIC_INVALID_CRYPTO_MESSAGE_TYPE; 900 return QUIC_INVALID_CRYPTO_MESSAGE_TYPE;
901 } 901 }
902 return CacheNewServerConfig(server_config_update, now, version, chlo_hash, 902 return CacheNewServerConfig(server_config_update, now, version, chlo_hash,
903 out_params->cached_certs, cached, error_details); 903 out_params->cached_certs, cached, error_details);
904 } 904 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 } 976 }
977 977
978 // Update canonical version to point at the "most recent" entry. 978 // Update canonical version to point at the "most recent" entry.
979 canonical_server_map_[suffix_server_id] = server_id; 979 canonical_server_map_[suffix_server_id] = server_id;
980 980
981 server_state->InitializeFrom(*canonical_state); 981 server_state->InitializeFrom(*canonical_state);
982 return true; 982 return true;
983 } 983 }
984 984
985 } // namespace net 985 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/quic_crypto_client_config.h ('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