OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
8 | 8 |
9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // | 700 // |
701 // Any calls to NSS are executed on the |nss_task_runner|, while any calls | 701 // Any calls to NSS are executed on the |nss_task_runner|, while any calls |
702 // that need to operate on the underlying transport, net log, or server | 702 // that need to operate on the underlying transport, net log, or server |
703 // bound certificate fetching will happen on the |network_task_runner|, so | 703 // bound certificate fetching will happen on the |network_task_runner|, so |
704 // that their lifetimes match that of the owning SSLClientSocketNSS. | 704 // that their lifetimes match that of the owning SSLClientSocketNSS. |
705 // | 705 // |
706 // The caller retains ownership of |transport|, |net_log|, and | 706 // The caller retains ownership of |transport|, |net_log|, and |
707 // |server_bound_cert_service|, and they will not be accessed once Detach() | 707 // |server_bound_cert_service|, and they will not be accessed once Detach() |
708 // has been called. | 708 // has been called. |
709 Core(base::SequencedTaskRunner* network_task_runner, | 709 Core(base::SequencedTaskRunner* network_task_runner, |
710 base::SingleThreadTaskRunner* nss_task_runner, | 710 base::SequencedTaskRunner* nss_task_runner, |
711 ClientSocketHandle* transport, | 711 ClientSocketHandle* transport, |
712 const HostPortPair& host_and_port, | 712 const HostPortPair& host_and_port, |
713 const SSLConfig& ssl_config, | 713 const SSLConfig& ssl_config, |
714 BoundNetLog* net_log, | 714 BoundNetLog* net_log, |
715 ServerBoundCertService* server_bound_cert_service); | 715 ServerBoundCertService* server_bound_cert_service); |
716 | 716 |
717 // Called on the network task runner. | 717 // Called on the network task runner. |
718 // Transfers ownership of |socket|, an NSS SSL socket, and |buffers|, the | 718 // Transfers ownership of |socket|, an NSS SSL socket, and |buffers|, the |
719 // underlying memio implementation, to the Core. Returns true if the Core | 719 // underlying memio implementation, to the Core. Returns true if the Core |
720 // was successfully registered with the socket. | 720 // was successfully registered with the socket. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 970 |
971 CompletionCallback user_connect_callback_; | 971 CompletionCallback user_connect_callback_; |
972 CompletionCallback user_read_callback_; | 972 CompletionCallback user_read_callback_; |
973 CompletionCallback user_write_callback_; | 973 CompletionCallback user_write_callback_; |
974 | 974 |
975 //////////////////////////////////////////////////////////////////////////// | 975 //////////////////////////////////////////////////////////////////////////// |
976 // Members that are accessed on both the network task runner and the NSS | 976 // Members that are accessed on both the network task runner and the NSS |
977 // task runner. | 977 // task runner. |
978 //////////////////////////////////////////////////////////////////////////// | 978 //////////////////////////////////////////////////////////////////////////// |
979 scoped_refptr<base::SequencedTaskRunner> network_task_runner_; | 979 scoped_refptr<base::SequencedTaskRunner> network_task_runner_; |
980 scoped_refptr<base::SingleThreadTaskRunner> nss_task_runner_; | 980 scoped_refptr<base::SequencedTaskRunner> nss_task_runner_; |
981 | 981 |
982 // Dereferenced only on the network task runner, but bound to tasks destined | 982 // Dereferenced only on the network task runner, but bound to tasks destined |
983 // for the network task runner from the NSS task runner. | 983 // for the network task runner from the NSS task runner. |
984 base::WeakPtr<BoundNetLog> weak_net_log_; | 984 base::WeakPtr<BoundNetLog> weak_net_log_; |
985 | 985 |
986 // Written on the network task runner by the |server_bound_cert_service_|, | 986 // Written on the network task runner by the |server_bound_cert_service_|, |
987 // prior to invoking OnHandshakeIOComplete. | 987 // prior to invoking OnHandshakeIOComplete. |
988 // Read on the NSS task runner when once OnHandshakeIOComplete is invoked | 988 // Read on the NSS task runner when once OnHandshakeIOComplete is invoked |
989 // on the NSS task runner. | 989 // on the NSS task runner. |
990 SSLClientCertType domain_bound_cert_type_; | 990 SSLClientCertType domain_bound_cert_type_; |
991 std::string domain_bound_private_key_; | 991 std::string domain_bound_private_key_; |
992 std::string domain_bound_cert_; | 992 std::string domain_bound_cert_; |
993 | 993 |
994 DISALLOW_COPY_AND_ASSIGN(Core); | 994 DISALLOW_COPY_AND_ASSIGN(Core); |
995 }; | 995 }; |
996 | 996 |
997 SSLClientSocketNSS::Core::Core( | 997 SSLClientSocketNSS::Core::Core( |
998 base::SequencedTaskRunner* network_task_runner, | 998 base::SequencedTaskRunner* network_task_runner, |
999 base::SingleThreadTaskRunner* nss_task_runner, | 999 base::SequencedTaskRunner* nss_task_runner, |
1000 ClientSocketHandle* transport, | 1000 ClientSocketHandle* transport, |
1001 const HostPortPair& host_and_port, | 1001 const HostPortPair& host_and_port, |
1002 const SSLConfig& ssl_config, | 1002 const SSLConfig& ssl_config, |
1003 BoundNetLog* net_log, | 1003 BoundNetLog* net_log, |
1004 ServerBoundCertService* server_bound_cert_service) | 1004 ServerBoundCertService* server_bound_cert_service) |
1005 : detached_(false), | 1005 : detached_(false), |
1006 transport_(transport), | 1006 transport_(transport), |
1007 weak_net_log_factory_(net_log), | 1007 weak_net_log_factory_(net_log), |
1008 server_bound_cert_service_(server_bound_cert_service), | 1008 server_bound_cert_service_(server_bound_cert_service), |
1009 domain_bound_cert_request_handle_(NULL), | 1009 domain_bound_cert_request_handle_(NULL), |
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2709 NetLog::TYPE_SSL_CHANNEL_ID_PROVIDED)); | 2709 NetLog::TYPE_SSL_CHANNEL_ID_PROVIDED)); |
2710 nss_handshake_state_.channel_id_sent = true; | 2710 nss_handshake_state_.channel_id_sent = true; |
2711 // Update the network task runner's view of the handshake state now that | 2711 // Update the network task runner's view of the handshake state now that |
2712 // channel id has been sent. | 2712 // channel id has been sent. |
2713 PostOrRunCallback( | 2713 PostOrRunCallback( |
2714 FROM_HERE, base::Bind(&Core::OnHandshakeStateUpdated, this, | 2714 FROM_HERE, base::Bind(&Core::OnHandshakeStateUpdated, this, |
2715 nss_handshake_state_)); | 2715 nss_handshake_state_)); |
2716 } | 2716 } |
2717 | 2717 |
2718 SSLClientSocketNSS::SSLClientSocketNSS( | 2718 SSLClientSocketNSS::SSLClientSocketNSS( |
2719 base::SingleThreadTaskRunner* nss_task_runner, | 2719 base::SequencedTaskRunner* nss_task_runner, |
2720 ClientSocketHandle* transport_socket, | 2720 ClientSocketHandle* transport_socket, |
2721 const HostPortPair& host_and_port, | 2721 const HostPortPair& host_and_port, |
2722 const SSLConfig& ssl_config, | 2722 const SSLConfig& ssl_config, |
2723 const SSLClientSocketContext& context) | 2723 const SSLClientSocketContext& context) |
2724 : nss_task_runner_(nss_task_runner), | 2724 : nss_task_runner_(nss_task_runner), |
2725 transport_(transport_socket), | 2725 transport_(transport_socket), |
2726 host_and_port_(host_and_port), | 2726 host_and_port_(host_and_port), |
2727 ssl_config_(ssl_config), | 2727 ssl_config_(ssl_config), |
2728 cert_verifier_(context.cert_verifier), | 2728 cert_verifier_(context.cert_verifier), |
2729 server_bound_cert_service_(context.server_bound_cert_service), | 2729 server_bound_cert_service_(context.server_bound_cert_service), |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 EnsureThreadIdAssigned(); | 3507 EnsureThreadIdAssigned(); |
3508 base::AutoLock auto_lock(lock_); | 3508 base::AutoLock auto_lock(lock_); |
3509 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 3509 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
3510 } | 3510 } |
3511 | 3511 |
3512 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { | 3512 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { |
3513 return server_bound_cert_service_; | 3513 return server_bound_cert_service_; |
3514 } | 3514 } |
3515 | 3515 |
3516 } // namespace net | 3516 } // namespace net |
OLD | NEW |