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

Side by Side Diff: net/quic/core/crypto/quic_crypto_server_config.h

Issue 2453113002: Fix object-lifetime issues in async GetProof callpaths (Closed)
Patch Set: Updated patchset dependency Created 4 years, 1 month 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 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ 5 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_
6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // ValidatedClientHelloMsg token that holds information about 274 // ValidatedClientHelloMsg token that holds information about
275 // the client hello. The callback will always be called exactly 275 // the client hello. The callback will always be called exactly
276 // once, either under the current call stack, or after the 276 // once, either under the current call stack, or after the
277 // completion of an asynchronous operation. 277 // completion of an asynchronous operation.
278 void ValidateClientHello( 278 void ValidateClientHello(
279 const CryptoHandshakeMessage& client_hello, 279 const CryptoHandshakeMessage& client_hello,
280 const IPAddress& client_ip, 280 const IPAddress& client_ip,
281 const IPAddress& server_ip, 281 const IPAddress& server_ip,
282 QuicVersion version, 282 QuicVersion version,
283 const QuicClock* clock, 283 const QuicClock* clock,
284 QuicCryptoProof* crypto_proof, 284 scoped_refptr<QuicCryptoProof> crypto_proof,
285 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const; 285 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const;
286 286
287 // ProcessClientHello processes |client_hello| and decides whether to accept 287 // ProcessClientHello processes |client_hello| and decides whether to accept
288 // or reject the connection. If the connection is to be accepted, |done_cb| is 288 // or reject the connection. If the connection is to be accepted, |done_cb| is
289 // invoked with the contents of the ServerHello and QUIC_NO_ERROR. Otherwise 289 // invoked with the contents of the ServerHello and QUIC_NO_ERROR. Otherwise
290 // |done_cb| is called with a REJ or SREJ message and QUIC_NO_ERROR. 290 // |done_cb| is called with a REJ or SREJ message and QUIC_NO_ERROR.
291 // 291 //
292 // validate_chlo_result: Output from the asynchronous call to 292 // validate_chlo_result: Output from the asynchronous call to
293 // ValidateClientHello. Contains the client hello message and 293 // ValidateClientHello. Contains the client hello message and
294 // information about it. 294 // information about it.
(...skipping 25 matching lines...) Expand all
320 QuicConnectionId connection_id, 320 QuicConnectionId connection_id,
321 const IPAddress& server_ip, 321 const IPAddress& server_ip,
322 const IPEndPoint& client_address, 322 const IPEndPoint& client_address,
323 QuicVersion version, 323 QuicVersion version,
324 const QuicVersionVector& supported_versions, 324 const QuicVersionVector& supported_versions,
325 bool use_stateless_rejects, 325 bool use_stateless_rejects,
326 QuicConnectionId server_designated_connection_id, 326 QuicConnectionId server_designated_connection_id,
327 const QuicClock* clock, 327 const QuicClock* clock,
328 QuicRandom* rand, 328 QuicRandom* rand,
329 QuicCompressedCertsCache* compressed_certs_cache, 329 QuicCompressedCertsCache* compressed_certs_cache,
330 QuicCryptoNegotiatedParameters* params, 330 scoped_refptr<QuicCryptoNegotiatedParameters> params,
331 QuicCryptoProof* crypto_proof, 331 scoped_refptr<QuicCryptoProof> crypto_proof,
332 QuicByteCount total_framing_overhead, 332 QuicByteCount total_framing_overhead,
333 QuicByteCount chlo_packet_size, 333 QuicByteCount chlo_packet_size,
334 std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const; 334 std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const;
335 335
336 // BuildServerConfigUpdateMessage sets |out| to be a SCUP message containing 336 // BuildServerConfigUpdateMessage sets |out| to be a SCUP message containing
337 // the current primary config, an up to date source-address token, and cert 337 // the current primary config, an up to date source-address token, and cert
338 // chain and proof in the case of secure QUIC. Returns true if successfully 338 // chain and proof in the case of secure QUIC. Returns true if successfully
339 // filled |out|. 339 // filled |out|.
340 // 340 //
341 // |cached_network_params| is optional, and can be nullptr. 341 // |cached_network_params| is optional, and can be nullptr.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 void SelectNewPrimaryConfig(QuicWallTime now) const; 543 void SelectNewPrimaryConfig(QuicWallTime now) const;
544 544
545 // EvaluateClientHello checks |client_hello| for gross errors and determines 545 // EvaluateClientHello checks |client_hello| for gross errors and determines
546 // whether it can be shown to be fresh (i.e. not a replay). The results are 546 // whether it can be shown to be fresh (i.e. not a replay). The results are
547 // written to |info|. 547 // written to |info|.
548 void EvaluateClientHello( 548 void EvaluateClientHello(
549 const IPAddress& server_ip, 549 const IPAddress& server_ip,
550 QuicVersion version, 550 QuicVersion version,
551 scoped_refptr<Config> requested_config, 551 scoped_refptr<Config> requested_config,
552 scoped_refptr<Config> primary_config, 552 scoped_refptr<Config> primary_config,
553 QuicCryptoProof* crypto_proof, 553 scoped_refptr<QuicCryptoProof> crypto_proof,
554 scoped_refptr<ValidateClientHelloResultCallback::Result> 554 scoped_refptr<ValidateClientHelloResultCallback::Result>
555 client_hello_state, 555 client_hello_state,
556 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const; 556 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const;
557 557
558 // Callback class for bridging between EvaluateClientHello and 558 // Callback class for bridging between EvaluateClientHello and
559 // EvaluateClientHelloAfterGetProof. 559 // EvaluateClientHelloAfterGetProof.
560 class EvaluateClientHelloCallback; 560 class EvaluateClientHelloCallback;
561 friend class EvaluateClientHelloCallback; 561 friend class EvaluateClientHelloCallback;
562 562
563 // Continuation of EvaluateClientHello after the call to 563 // Continuation of EvaluateClientHello after the call to
564 // ProofSource::GetProof. |found_error| indicates whether an error was 564 // ProofSource::GetProof. |found_error| indicates whether an error was
565 // detected in EvaluateClientHello, and |get_proof_failed| indicates whether 565 // detected in EvaluateClientHello, and |get_proof_failed| indicates whether
566 // GetProof failed. If GetProof was not run, then |get_proof_failed| will be 566 // GetProof failed. If GetProof was not run, then |get_proof_failed| will be
567 // set to false. 567 // set to false.
568 void EvaluateClientHelloAfterGetProof( 568 void EvaluateClientHelloAfterGetProof(
569 bool found_error, 569 bool found_error,
570 const IPAddress& server_ip, 570 const IPAddress& server_ip,
571 QuicVersion version, 571 QuicVersion version,
572 scoped_refptr<Config> requested_config, 572 scoped_refptr<Config> requested_config,
573 scoped_refptr<Config> primary_config, 573 scoped_refptr<Config> primary_config,
574 QuicCryptoProof* crypto_proof, 574 scoped_refptr<QuicCryptoProof> crypto_proof,
575 std::unique_ptr<ProofSource::Details> proof_source_details, 575 std::unique_ptr<ProofSource::Details> proof_source_details,
576 bool get_proof_failed, 576 bool get_proof_failed,
577 scoped_refptr<ValidateClientHelloResultCallback::Result> 577 scoped_refptr<ValidateClientHelloResultCallback::Result>
578 client_hello_state, 578 client_hello_state,
579 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const; 579 std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const;
580 580
581 // Callback class for bridging between ProcessClientHello and 581 // Callback class for bridging between ProcessClientHello and
582 // ProcessClientHelloAfterGetProof. 582 // ProcessClientHelloAfterGetProof.
583 class ProcessClientHelloCallback; 583 class ProcessClientHelloCallback;
584 friend class ProcessClientHelloCallback; 584 friend class ProcessClientHelloCallback;
585 585
586 // Portion of ProcessClientHello which executes after GetProof. 586 // Portion of ProcessClientHello which executes after GetProof.
587 void ProcessClientHelloAfterGetProof( 587 void ProcessClientHelloAfterGetProof(
588 bool found_error, 588 bool found_error,
589 const ValidateClientHelloResultCallback::Result& validate_chlo_result, 589 const ValidateClientHelloResultCallback::Result& validate_chlo_result,
590 bool reject_only, 590 bool reject_only,
591 QuicConnectionId connection_id, 591 QuicConnectionId connection_id,
592 const IPEndPoint& client_address, 592 const IPEndPoint& client_address,
593 QuicVersion version, 593 QuicVersion version,
594 const QuicVersionVector& supported_versions, 594 const QuicVersionVector& supported_versions,
595 bool use_stateless_rejects, 595 bool use_stateless_rejects,
596 QuicConnectionId server_designated_connection_id, 596 QuicConnectionId server_designated_connection_id,
597 const QuicClock* clock, 597 const QuicClock* clock,
598 QuicRandom* rand, 598 QuicRandom* rand,
599 QuicCompressedCertsCache* compressed_certs_cache, 599 QuicCompressedCertsCache* compressed_certs_cache,
600 QuicCryptoNegotiatedParameters* params, 600 scoped_refptr<QuicCryptoNegotiatedParameters> params,
601 QuicCryptoProof* crypto_proof, 601 scoped_refptr<QuicCryptoProof> crypto_proof,
602 QuicByteCount total_framing_overhead, 602 QuicByteCount total_framing_overhead,
603 QuicByteCount chlo_packet_size, 603 QuicByteCount chlo_packet_size,
604 const scoped_refptr<Config>& requested_config, 604 const scoped_refptr<Config>& requested_config,
605 const scoped_refptr<Config>& primary_config, 605 const scoped_refptr<Config>& primary_config,
606 std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const; 606 std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const;
607 607
608 // BuildRejection sets |out| to be a REJ message in reply to |client_hello|. 608 // BuildRejection sets |out| to be a REJ message in reply to |client_hello|.
609 void BuildRejection(QuicVersion version, 609 void BuildRejection(QuicVersion version,
610 QuicWallTime now, 610 QuicWallTime now,
611 const Config& config, 611 const Config& config,
612 const CryptoHandshakeMessage& client_hello, 612 const CryptoHandshakeMessage& client_hello,
613 const ClientHelloInfo& info, 613 const ClientHelloInfo& info,
614 const CachedNetworkParameters& cached_network_params, 614 const CachedNetworkParameters& cached_network_params,
615 bool use_stateless_rejects, 615 bool use_stateless_rejects,
616 QuicConnectionId server_designated_connection_id, 616 QuicConnectionId server_designated_connection_id,
617 QuicRandom* rand, 617 QuicRandom* rand,
618 QuicCompressedCertsCache* compressed_certs_cache, 618 QuicCompressedCertsCache* compressed_certs_cache,
619 QuicCryptoNegotiatedParameters* params, 619 scoped_refptr<QuicCryptoNegotiatedParameters> params,
620 const QuicCryptoProof& crypto_proof, 620 const QuicCryptoProof& crypto_proof,
621 QuicByteCount total_framing_overhead, 621 QuicByteCount total_framing_overhead,
622 QuicByteCount chlo_packet_size, 622 QuicByteCount chlo_packet_size,
623 CryptoHandshakeMessage* out) const; 623 CryptoHandshakeMessage* out) const;
624 624
625 // CompressChain compresses the certificates in |chain->certs| and returns a 625 // CompressChain compresses the certificates in |chain->certs| and returns a
626 // compressed representation. |common_sets| contains the common certificate 626 // compressed representation. |common_sets| contains the common certificate
627 // sets known locally and |client_common_set_hashes| contains the hashes of 627 // sets known locally and |client_common_set_hashes| contains the hashes of
628 // the common sets known to the peer. |client_cached_cert_hashes| contains 628 // the common sets known to the peer. |client_cached_cert_hashes| contains
629 // 64-bit, FNV-1a hashes of certificates that the peer already possesses. 629 // 64-bit, FNV-1a hashes of certificates that the peer already possesses.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 839
840 // Enable serving SCT or not. 840 // Enable serving SCT or not.
841 bool enable_serving_sct_; 841 bool enable_serving_sct_;
842 842
843 // Does not own this observer. 843 // Does not own this observer.
844 RejectionObserver* rejection_observer_; 844 RejectionObserver* rejection_observer_;
845 845
846 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); 846 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig);
847 }; 847 };
848 848
849 struct NET_EXPORT_PRIVATE QuicCryptoProof { 849 struct NET_EXPORT_PRIVATE QuicCryptoProof
850 : public base::RefCounted<QuicCryptoProof> {
850 QuicCryptoProof(); 851 QuicCryptoProof();
851 ~QuicCryptoProof();
852 852
853 std::string signature; 853 std::string signature;
854 scoped_refptr<ProofSource::Chain> chain; 854 scoped_refptr<ProofSource::Chain> chain;
855 std::string cert_sct; 855 std::string cert_sct;
856 // The server config that is used for this proof (and the rest of the 856 // The server config that is used for this proof (and the rest of the
857 // request). 857 // request).
858 scoped_refptr<QuicCryptoServerConfig::Config> config; 858 scoped_refptr<QuicCryptoServerConfig::Config> config;
859 std::string primary_scid; 859 std::string primary_scid;
860
861 private:
862 friend class base::RefCounted<QuicCryptoProof>;
863 virtual ~QuicCryptoProof();
860 }; 864 };
861 865
862 } // namespace net 866 } // namespace net
863 867
864 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ 868 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_
OLDNEW
« no previous file with comments | « net/quic/core/crypto/quic_crypto_client_config_test.cc ('k') | net/quic/core/crypto/quic_crypto_server_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698