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 // OpenSSL binding for SSLClientSocket. The class layout and general principle | 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle |
6 // of operation is derived from SSLClientSocketNSS. | 6 // of operation is derived from SSLClientSocketNSS. |
7 | 7 |
8 #include "net/socket/ssl_client_socket_openssl.h" | 8 #include "net/socket/ssl_client_socket_openssl.h" |
9 | 9 |
10 #include <openssl/err.h> | 10 #include <openssl/err.h> |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 const base::Closure& callback) { | 387 const base::Closure& callback) { |
388 error_callback_ = callback; | 388 error_callback_ = callback; |
389 } | 389 } |
390 | 390 |
391 void SSLClientSocketOpenSSL::SetIsLeader() { | 391 void SSLClientSocketOpenSSL::SetIsLeader() { |
392 is_leader_ = true; | 392 is_leader_ = true; |
393 } | 393 } |
394 | 394 |
395 void SSLClientSocketOpenSSL::OnSocketFailure() { | 395 void SSLClientSocketOpenSSL::OnSocketFailure() { |
396 if (is_leader_) { | 396 if (is_leader_) { |
397 error_callback_.Run(); | 397 // error_callback_ should be run regardless of the validity of this |
398 // SSLClientSocketOpenSSL at the callback's runtime. | |
Ryan Sleevi
2014/07/10 02:34:25
Note: The request for documentation was meant for
mshelley
2014/07/10 16:35:32
Done.
| |
399 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, error_callback_); | |
398 error_callback_ = base::Closure(); | 400 error_callback_ = base::Closure(); |
399 is_leader_ = false; | 401 is_leader_ = false; |
400 } | 402 } |
401 } | 403 } |
402 | 404 |
403 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( | 405 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( |
404 SSLCertRequestInfo* cert_request_info) { | 406 SSLCertRequestInfo* cert_request_info) { |
405 cert_request_info->host_and_port = host_and_port_; | 407 cert_request_info->host_and_port = host_and_port_; |
406 cert_request_info->cert_authorities = cert_authorities_; | 408 cert_request_info->cert_authorities = cert_authorities_; |
407 cert_request_info->cert_key_types = cert_key_types_; | 409 cert_request_info->cert_key_types = cert_key_types_; |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1390 std::vector<uint8> encrypted_private_key_info; | 1392 std::vector<uint8> encrypted_private_key_info; |
1391 std::vector<uint8> subject_public_key_info; | 1393 std::vector<uint8> subject_public_key_info; |
1392 encrypted_private_key_info.assign( | 1394 encrypted_private_key_info.assign( |
1393 channel_id_private_key_.data(), | 1395 channel_id_private_key_.data(), |
1394 channel_id_private_key_.data() + channel_id_private_key_.size()); | 1396 channel_id_private_key_.data() + channel_id_private_key_.size()); |
1395 subject_public_key_info.assign( | 1397 subject_public_key_info.assign( |
1396 channel_id_cert_.data(), | 1398 channel_id_cert_.data(), |
1397 channel_id_cert_.data() + channel_id_cert_.size()); | 1399 channel_id_cert_.data() + channel_id_cert_.size()); |
1398 scoped_ptr<crypto::ECPrivateKey> ec_private_key( | 1400 scoped_ptr<crypto::ECPrivateKey> ec_private_key( |
1399 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( | 1401 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( |
1400 ServerBoundCertService::kEPKIPassword, | 1402 SperverBoundCertService::kEPKIPassword, |
1401 encrypted_private_key_info, | 1403 encrypted_private_key_info, |
1402 subject_public_key_info)); | 1404 subject_public_key_info)); |
1403 if (!ec_private_key) | 1405 if (!ec_private_key) |
1404 return; | 1406 return; |
1405 set_channel_id_sent(true); | 1407 set_channel_id_sent(true); |
1406 *pkey = EVP_PKEY_dup(ec_private_key->key()); | 1408 *pkey = EVP_PKEY_dup(ec_private_key->key()); |
1407 } | 1409 } |
1408 | 1410 |
1409 int SSLClientSocketOpenSSL::CertVerifyCallback(X509_STORE_CTX* store_ctx) { | 1411 int SSLClientSocketOpenSSL::CertVerifyCallback(X509_STORE_CTX* store_ctx) { |
1410 if (!completed_handshake_) { | 1412 if (!completed_handshake_) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1475 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; | 1477 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; |
1476 return SSL_TLSEXT_ERR_OK; | 1478 return SSL_TLSEXT_ERR_OK; |
1477 } | 1479 } |
1478 | 1480 |
1479 scoped_refptr<X509Certificate> | 1481 scoped_refptr<X509Certificate> |
1480 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1482 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
1481 return server_cert_; | 1483 return server_cert_; |
1482 } | 1484 } |
1483 | 1485 |
1484 } // namespace net | 1486 } // namespace net |
OLD | NEW |