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

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

Issue 2100303002: Add OCSPVerifyResult for tracking stapled OCSP responses cross-platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocsp-date-check
Patch Set: Add tests for REVOKED status Created 4 years, 5 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 #include "net/socket/ssl_client_socket_impl.h" 5 #include "net/socket/ssl_client_socket_impl.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <openssl/bio.h> 8 #include <openssl/bio.h>
9 #include <openssl/bytestring.h> 9 #include <openssl/bytestring.h>
10 #include <openssl/err.h> 10 #include <openssl/err.h>
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 774 }
775 775
776 bool SSLClientSocketImpl::WasEverUsed() const { 776 bool SSLClientSocketImpl::WasEverUsed() const {
777 return was_ever_used_; 777 return was_ever_used_;
778 } 778 }
779 779
780 bool SSLClientSocketImpl::GetSSLInfo(SSLInfo* ssl_info) { 780 bool SSLClientSocketImpl::GetSSLInfo(SSLInfo* ssl_info) {
781 ssl_info->Reset(); 781 ssl_info->Reset();
782 if (server_cert_chain_->empty()) 782 if (server_cert_chain_->empty())
783 return false; 783 return false;
784
svaldez 2016/06/29 14:41:22 Typically keep the space after conditionals?
dadrian 2016/06/30 21:52:43 Done.
785 ssl_info->cert = server_cert_verify_result_.verified_cert; 784 ssl_info->cert = server_cert_verify_result_.verified_cert;
786 ssl_info->unverified_cert = server_cert_; 785 ssl_info->unverified_cert = server_cert_;
787 ssl_info->cert_status = server_cert_verify_result_.cert_status; 786 ssl_info->cert_status = server_cert_verify_result_.cert_status;
788 ssl_info->is_issued_by_known_root = 787 ssl_info->is_issued_by_known_root =
789 server_cert_verify_result_.is_issued_by_known_root; 788 server_cert_verify_result_.is_issued_by_known_root;
790 ssl_info->pkp_bypassed = pkp_bypassed_; 789 ssl_info->pkp_bypassed = pkp_bypassed_;
791 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes; 790 ssl_info->public_key_hashes = server_cert_verify_result_.public_key_hashes;
792 ssl_info->client_cert_sent = 791 ssl_info->client_cert_sent =
793 ssl_config_.send_client_cert && ssl_config_.client_cert.get(); 792 ssl_config_.send_client_cert && ssl_config_.client_cert.get();
794 ssl_info->channel_id_sent = channel_id_sent_; 793 ssl_info->channel_id_sent = channel_id_sent_;
795 ssl_info->token_binding_negotiated = tb_was_negotiated_; 794 ssl_info->token_binding_negotiated = tb_was_negotiated_;
796 ssl_info->token_binding_key_param = tb_negotiated_param_; 795 ssl_info->token_binding_key_param = tb_negotiated_param_;
797 ssl_info->pinning_failure_log = pinning_failure_log_; 796 ssl_info->pinning_failure_log = pinning_failure_log_;
797 ssl_info->ocsp = server_cert_verify_result_.ocsp;
798 798
799 AddCTInfoToSSLInfo(ssl_info); 799 AddCTInfoToSSLInfo(ssl_info);
800 800
801 const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl_); 801 const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl_);
802 CHECK(cipher); 802 CHECK(cipher);
803 ssl_info->security_bits = SSL_CIPHER_get_bits(cipher, NULL); 803 ssl_info->security_bits = SSL_CIPHER_get_bits(cipher, NULL);
804 ssl_info->key_exchange_info = 804 ssl_info->key_exchange_info =
805 SSL_SESSION_get_key_exchange_info(SSL_get_session(ssl_)); 805 SSL_SESSION_get_key_exchange_info(SSL_get_session(ssl_));
806 806
807 SSLConnectionStatusSetCipherSuite( 807 SSLConnectionStatusSetCipherSuite(
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 std::string ocsp_response; 1294 std::string ocsp_response;
1295 if (cert_verifier_->SupportsOCSPStapling()) { 1295 if (cert_verifier_->SupportsOCSPStapling()) {
1296 const uint8_t* ocsp_response_raw; 1296 const uint8_t* ocsp_response_raw;
1297 size_t ocsp_response_len; 1297 size_t ocsp_response_len;
1298 SSL_get0_ocsp_response(ssl_, &ocsp_response_raw, &ocsp_response_len); 1298 SSL_get0_ocsp_response(ssl_, &ocsp_response_raw, &ocsp_response_len);
1299 ocsp_response.assign(reinterpret_cast<const char*>(ocsp_response_raw), 1299 ocsp_response.assign(reinterpret_cast<const char*>(ocsp_response_raw),
1300 ocsp_response_len); 1300 ocsp_response_len);
1301 } 1301 }
1302 1302
1303 start_cert_verification_time_ = base::TimeTicks::Now(); 1303 start_cert_verification_time_ = base::TimeTicks::Now();
1304
svaldez 2016/06/29 14:41:22 stray format?
dadrian 2016/06/30 21:52:43 Done.
1305 return cert_verifier_->Verify( 1304 return cert_verifier_->Verify(
1306 CertVerifier::RequestParams(server_cert_, host_and_port_.host(), 1305 CertVerifier::RequestParams(server_cert_, host_and_port_.host(),
1307 ssl_config_.GetCertVerifyFlags(), 1306 ssl_config_.GetCertVerifyFlags(),
1308 ocsp_response, CertificateList()), 1307 ocsp_response, CertificateList()),
1309 // TODO(davidben): Route the CRLSet through SSLConfig so 1308 // TODO(davidben): Route the CRLSet through SSLConfig so
1310 // SSLClientSocket doesn't depend on SSLConfigService. 1309 // SSLClientSocket doesn't depend on SSLConfigService.
1311 SSLConfigService::GetCRLSet().get(), &server_cert_verify_result_, 1310 SSLConfigService::GetCRLSet().get(), &server_cert_verify_result_,
1312 base::Bind(&SSLClientSocketImpl::OnHandshakeIOComplete, 1311 base::Bind(&SSLClientSocketImpl::OnHandshakeIOComplete,
1313 base::Unretained(this)), 1312 base::Unretained(this)),
1314 &cert_verifier_request_, net_log_); 1313 &cert_verifier_request_, net_log_);
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 if (rv != OK) { 2312 if (rv != OK) {
2314 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); 2313 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv);
2315 return; 2314 return;
2316 } 2315 }
2317 2316
2318 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, 2317 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT,
2319 base::Bind(&NetLogSSLInfoCallback, base::Unretained(this))); 2318 base::Bind(&NetLogSSLInfoCallback, base::Unretained(this)));
2320 } 2319 }
2321 2320
2322 } // namespace net 2321 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698