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

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

Issue 1652603002: Add information to SSLInfo about CT EV policy compliance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expand a comment Created 4 years, 10 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 server_cert_verify_result_.is_issued_by_known_root; 830 server_cert_verify_result_.is_issued_by_known_root;
831 ssl_info->public_key_hashes = 831 ssl_info->public_key_hashes =
832 server_cert_verify_result_.public_key_hashes; 832 server_cert_verify_result_.public_key_hashes;
833 ssl_info->client_cert_sent = 833 ssl_info->client_cert_sent =
834 ssl_config_.send_client_cert && ssl_config_.client_cert.get(); 834 ssl_config_.send_client_cert && ssl_config_.client_cert.get();
835 ssl_info->channel_id_sent = channel_id_sent_; 835 ssl_info->channel_id_sent = channel_id_sent_;
836 ssl_info->token_binding_negotiated = tb_was_negotiated_; 836 ssl_info->token_binding_negotiated = tb_was_negotiated_;
837 ssl_info->token_binding_key_param = tb_negotiated_param_; 837 ssl_info->token_binding_key_param = tb_negotiated_param_;
838 ssl_info->pinning_failure_log = pinning_failure_log_; 838 ssl_info->pinning_failure_log = pinning_failure_log_;
839 839
840 AddSCTInfoToSSLInfo(ssl_info); 840 AddCTInfoToSSLInfo(ssl_info);
841 841
842 const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl_); 842 const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl_);
843 CHECK(cipher); 843 CHECK(cipher);
844 ssl_info->security_bits = SSL_CIPHER_get_bits(cipher, NULL); 844 ssl_info->security_bits = SSL_CIPHER_get_bits(cipher, NULL);
845 ssl_info->key_exchange_info = 845 ssl_info->key_exchange_info =
846 SSL_SESSION_get_key_exchange_info(SSL_get_session(ssl_)); 846 SSL_SESSION_get_key_exchange_info(SSL_get_session(ssl_));
847 847
848 ssl_info->connection_status = EncodeSSLConnectionStatus( 848 ssl_info->connection_status = EncodeSSLConnectionStatus(
849 static_cast<uint16_t>(SSL_CIPHER_get_id(cipher)), 0 /* no compression */, 849 static_cast<uint16_t>(SSL_CIPHER_get_id(cipher)), 0 /* no compression */,
850 GetNetSSLVersion(ssl_)); 850 GetNetSSLVersion(ssl_));
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 if (sct_list_len > 0) 1438 if (sct_list_len > 0)
1439 sct_list.assign(reinterpret_cast<const char*>(sct_list_raw), sct_list_len); 1439 sct_list.assign(reinterpret_cast<const char*>(sct_list_raw), sct_list_len);
1440 1440
1441 // Note that this is a completely synchronous operation: The CT Log Verifier 1441 // Note that this is a completely synchronous operation: The CT Log Verifier
1442 // gets all the data it needs for SCT verification and does not do any 1442 // gets all the data it needs for SCT verification and does not do any
1443 // external communication. 1443 // external communication.
1444 cert_transparency_verifier_->Verify( 1444 cert_transparency_verifier_->Verify(
1445 server_cert_verify_result_.verified_cert.get(), ocsp_response, sct_list, 1445 server_cert_verify_result_.verified_cert.get(), ocsp_response, sct_list,
1446 &ct_verify_result_, net_log_); 1446 &ct_verify_result_, net_log_);
1447 1447
1448 ct_verify_result_.ct_policies_applied = (policy_enforcer_ != nullptr);
1449 ct_verify_result_.ev_policy_compliance =
1450 CTPolicyEnforcer::EV_POLICY_DOES_NOT_APPLY;
1448 if (policy_enforcer_ && 1451 if (policy_enforcer_ &&
1449 (server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV)) { 1452 (server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV)) {
1450 scoped_refptr<ct::EVCertsWhitelist> ev_whitelist = 1453 scoped_refptr<ct::EVCertsWhitelist> ev_whitelist =
1451 SSLConfigService::GetEVCertsWhitelist(); 1454 SSLConfigService::GetEVCertsWhitelist();
1452 if (!policy_enforcer_->DoesConformToCTEVPolicy( 1455 ct_verify_result_.ev_policy_compliance =
1456 policy_enforcer_->DoesConformToCTEVPolicy(
1453 server_cert_verify_result_.verified_cert.get(), ev_whitelist.get(), 1457 server_cert_verify_result_.verified_cert.get(), ev_whitelist.get(),
1454 ct_verify_result_, net_log_)) { 1458 ct_verify_result_.verified_scts, net_log_);
1459 if (ct_verify_result_.ev_policy_compliance !=
1460 CTPolicyEnforcer::EV_POLICY_COMPLIES_VIA_WHITELIST &&
1461 ct_verify_result_.ev_policy_compliance !=
1462 CTPolicyEnforcer::EV_POLICY_COMPLIES_VIA_SCTS) {
1455 // TODO(eranm): Log via the BoundNetLog, see crbug.com/437766 1463 // TODO(eranm): Log via the BoundNetLog, see crbug.com/437766
1456 VLOG(1) << "EV certificate for " 1464 VLOG(1) << "EV certificate for "
1457 << server_cert_verify_result_.verified_cert->subject() 1465 << server_cert_verify_result_.verified_cert->subject()
1458 .GetDisplayName() 1466 .GetDisplayName()
1459 << " does not conform to CT policy, removing EV status."; 1467 << " does not conform to CT policy, removing EV status.";
1460 server_cert_verify_result_.cert_status |= 1468 server_cert_verify_result_.cert_status |=
1461 CERT_STATUS_CT_COMPLIANCE_FAILED; 1469 CERT_STATUS_CT_COMPLIANCE_FAILED;
1462 server_cert_verify_result_.cert_status &= ~CERT_STATUS_IS_EV; 1470 server_cert_verify_result_.cert_status &= ~CERT_STATUS_IS_EV;
1463 } 1471 }
1464 } 1472 }
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 // be signaled on abbreviated handshakes if the ticket was renewed. 2114 // be signaled on abbreviated handshakes if the ticket was renewed.
2107 session_pending_ = true; 2115 session_pending_ = true;
2108 MaybeCacheSession(); 2116 MaybeCacheSession();
2109 2117
2110 // OpenSSL passes a reference to |session|, but the session cache does not 2118 // OpenSSL passes a reference to |session|, but the session cache does not
2111 // take this reference, so release it. 2119 // take this reference, so release it.
2112 SSL_SESSION_free(session); 2120 SSL_SESSION_free(session);
2113 return 1; 2121 return 1;
2114 } 2122 }
2115 2123
2116 void SSLClientSocketOpenSSL::AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const { 2124 void SSLClientSocketOpenSSL::AddCTInfoToSSLInfo(SSLInfo* ssl_info) const {
2117 ssl_info->UpdateSignedCertificateTimestamps(ct_verify_result_); 2125 ssl_info->UpdateCertificateTransparencyInfo(ct_verify_result_);
2118 } 2126 }
2119 2127
2120 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const { 2128 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const {
2121 std::string result = host_and_port_.ToString(); 2129 std::string result = host_and_port_.ToString();
2122 result.append("/"); 2130 result.append("/");
2123 result.append(ssl_session_cache_shard_); 2131 result.append(ssl_session_cache_shard_);
2124 2132
2125 // Shard the session cache based on maximum protocol version. This causes 2133 // Shard the session cache based on maximum protocol version. This causes
2126 // fallback connections to use a separate session cache. 2134 // fallback connections to use a separate session cache.
2127 result.append("/"); 2135 result.append("/");
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 tb_was_negotiated_ = true; 2338 tb_was_negotiated_ = true;
2331 return 1; 2339 return 1;
2332 } 2340 }
2333 } 2341 }
2334 2342
2335 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER; 2343 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER;
2336 return 0; 2344 return 0;
2337 } 2345 }
2338 2346
2339 } // namespace net 2347 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698