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

Side by Side Diff: net/socket/ssl_client_socket_openssl.cc

Issue 1115903002: Refactor the API for CertVerifier::Verify() and the implementation of MultiThreadedCertVerifier::Ver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 5 years, 7 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 (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 <errno.h> 10 #include <errno.h>
(...skipping 13 matching lines...) Expand all
24 #include "base/synchronization/lock.h" 24 #include "base/synchronization/lock.h"
25 #include "base/threading/thread_local.h" 25 #include "base/threading/thread_local.h"
26 #include "crypto/ec_private_key.h" 26 #include "crypto/ec_private_key.h"
27 #include "crypto/openssl_util.h" 27 #include "crypto/openssl_util.h"
28 #include "crypto/scoped_openssl_types.h" 28 #include "crypto/scoped_openssl_types.h"
29 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
30 #include "net/cert/cert_policy_enforcer.h" 30 #include "net/cert/cert_policy_enforcer.h"
31 #include "net/cert/cert_verifier.h" 31 #include "net/cert/cert_verifier.h"
32 #include "net/cert/ct_ev_whitelist.h" 32 #include "net/cert/ct_ev_whitelist.h"
33 #include "net/cert/ct_verifier.h" 33 #include "net/cert/ct_verifier.h"
34 #include "net/cert/single_request_cert_verifier.h"
35 #include "net/cert/x509_certificate_net_log_param.h" 34 #include "net/cert/x509_certificate_net_log_param.h"
36 #include "net/cert/x509_util_openssl.h" 35 #include "net/cert/x509_util_openssl.h"
37 #include "net/http/transport_security_state.h" 36 #include "net/http/transport_security_state.h"
38 #include "net/ssl/scoped_openssl_types.h" 37 #include "net/ssl/scoped_openssl_types.h"
39 #include "net/ssl/ssl_cert_request_info.h" 38 #include "net/ssl/ssl_cert_request_info.h"
40 #include "net/ssl/ssl_client_session_cache_openssl.h" 39 #include "net/ssl/ssl_client_session_cache_openssl.h"
41 #include "net/ssl/ssl_connection_status_flags.h" 40 #include "net/ssl/ssl_connection_status_flags.h"
42 #include "net/ssl/ssl_info.h" 41 #include "net/ssl/ssl_info.h"
43 42
44 #if defined(OS_WIN) 43 #if defined(OS_WIN)
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 SSL_shutdown(ssl_); 465 SSL_shutdown(ssl_);
467 SSL_free(ssl_); 466 SSL_free(ssl_);
468 ssl_ = NULL; 467 ssl_ = NULL;
469 } 468 }
470 if (transport_bio_) { 469 if (transport_bio_) {
471 BIO_free_all(transport_bio_); 470 BIO_free_all(transport_bio_);
472 transport_bio_ = NULL; 471 transport_bio_ = NULL;
473 } 472 }
474 473
475 // Shut down anything that may call us back. 474 // Shut down anything that may call us back.
476 verifier_.reset(); 475 cert_verifier_request_.reset();
477 transport_->socket()->Disconnect(); 476 transport_->socket()->Disconnect();
478 477
479 // Null all callbacks, delete all buffers. 478 // Null all callbacks, delete all buffers.
480 transport_send_busy_ = false; 479 transport_send_busy_ = false;
481 send_buffer_ = NULL; 480 send_buffer_ = NULL;
482 transport_recv_busy_ = false; 481 transport_recv_busy_ = false;
483 recv_buffer_ = NULL; 482 recv_buffer_ = NULL;
484 483
485 user_connect_callback_.Reset(); 484 user_connect_callback_.Reset();
486 user_read_callback_.Reset(); 485 user_read_callback_.Reset();
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 1082
1084 int flags = 0; 1083 int flags = 0;
1085 if (ssl_config_.rev_checking_enabled) 1084 if (ssl_config_.rev_checking_enabled)
1086 flags |= CertVerifier::VERIFY_REV_CHECKING_ENABLED; 1085 flags |= CertVerifier::VERIFY_REV_CHECKING_ENABLED;
1087 if (ssl_config_.verify_ev_cert) 1086 if (ssl_config_.verify_ev_cert)
1088 flags |= CertVerifier::VERIFY_EV_CERT; 1087 flags |= CertVerifier::VERIFY_EV_CERT;
1089 if (ssl_config_.cert_io_enabled) 1088 if (ssl_config_.cert_io_enabled)
1090 flags |= CertVerifier::VERIFY_CERT_IO_ENABLED; 1089 flags |= CertVerifier::VERIFY_CERT_IO_ENABLED;
1091 if (ssl_config_.rev_checking_required_local_anchors) 1090 if (ssl_config_.rev_checking_required_local_anchors)
1092 flags |= CertVerifier::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; 1091 flags |= CertVerifier::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS;
1093 verifier_.reset(new SingleRequestCertVerifier(cert_verifier_)); 1092 return cert_verifier_->Verify(
1094 return verifier_->Verify(
1095 server_cert_.get(), host_and_port_.host(), ocsp_response, flags, 1093 server_cert_.get(), host_and_port_.host(), ocsp_response, flags,
1096 // TODO(davidben): Route the CRLSet through SSLConfig so 1094 // TODO(davidben): Route the CRLSet through SSLConfig so
1097 // SSLClientSocket doesn't depend on SSLConfigService. 1095 // SSLClientSocket doesn't depend on SSLConfigService.
1098 SSLConfigService::GetCRLSet().get(), &server_cert_verify_result_, 1096 SSLConfigService::GetCRLSet().get(), &server_cert_verify_result_,
1099 base::Bind(&SSLClientSocketOpenSSL::OnHandshakeIOComplete, 1097 base::Bind(&SSLClientSocketOpenSSL::OnHandshakeIOComplete,
1100 base::Unretained(this)), 1098 base::Unretained(this)),
1101 net_log_); 1099 &cert_verifier_request_, net_log_);
1102 } 1100 }
1103 1101
1104 int SSLClientSocketOpenSSL::DoVerifyCertComplete(int result) { 1102 int SSLClientSocketOpenSSL::DoVerifyCertComplete(int result) {
1105 verifier_.reset(); 1103 cert_verifier_request_.reset();
1106 1104
1107 if (!start_cert_verification_time_.is_null()) { 1105 if (!start_cert_verification_time_.is_null()) {
1108 base::TimeDelta verify_time = 1106 base::TimeDelta verify_time =
1109 base::TimeTicks::Now() - start_cert_verification_time_; 1107 base::TimeTicks::Now() - start_cert_verification_time_;
1110 if (result == OK) { 1108 if (result == OK) {
1111 UMA_HISTOGRAM_TIMES("Net.SSLCertVerificationTime", verify_time); 1109 UMA_HISTOGRAM_TIMES("Net.SSLCertVerificationTime", verify_time);
1112 } else { 1110 } else {
1113 UMA_HISTOGRAM_TIMES("Net.SSLCertVerificationTimeError", verify_time); 1111 UMA_HISTOGRAM_TIMES("Net.SSLCertVerificationTimeError", verify_time);
1114 } 1112 }
1115 } 1113 }
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 1886
1889 return result; 1887 return result;
1890 } 1888 }
1891 1889
1892 scoped_refptr<X509Certificate> 1890 scoped_refptr<X509Certificate>
1893 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { 1891 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const {
1894 return server_cert_; 1892 return server_cert_;
1895 } 1893 }
1896 1894
1897 } // namespace net 1895 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698