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

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

Issue 1578993003: Add Expect CT policy that gets checked on all certs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix (netlog SetString instead of SetBoolean) 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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 // Note that this is a completely synchronous operation: The CT Log Verifier 1476 // Note that this is a completely synchronous operation: The CT Log Verifier
1477 // gets all the data it needs for SCT verification and does not do any 1477 // gets all the data it needs for SCT verification and does not do any
1478 // external communication. 1478 // external communication.
1479 cert_transparency_verifier_->Verify( 1479 cert_transparency_verifier_->Verify(
1480 server_cert_verify_result_.verified_cert.get(), ocsp_response, sct_list, 1480 server_cert_verify_result_.verified_cert.get(), ocsp_response, sct_list,
1481 &ct_verify_result_, net_log_); 1481 &ct_verify_result_, net_log_);
1482 1482
1483 ct_verify_result_.ct_policies_applied = (policy_enforcer_ != nullptr); 1483 ct_verify_result_.ct_policies_applied = (policy_enforcer_ != nullptr);
1484 ct_verify_result_.ev_policy_compliance = 1484 ct_verify_result_.ev_policy_compliance =
1485 ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY; 1485 ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY;
1486 if (policy_enforcer_ && 1486 if (policy_enforcer_) {
1487 (server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV)) { 1487 if ((server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV)) {
1488 scoped_refptr<ct::EVCertsWhitelist> ev_whitelist = 1488 scoped_refptr<ct::EVCertsWhitelist> ev_whitelist =
1489 SSLConfigService::GetEVCertsWhitelist(); 1489 SSLConfigService::GetEVCertsWhitelist();
1490 ct::EVPolicyCompliance ev_policy_compliance = 1490 ct::EVPolicyCompliance ev_policy_compliance =
1491 policy_enforcer_->DoesConformToCTEVPolicy( 1491 policy_enforcer_->DoesConformToCTEVPolicy(
1492 server_cert_verify_result_.verified_cert.get(), ev_whitelist.get(), 1492 server_cert_verify_result_.verified_cert.get(),
1493 ev_whitelist.get(), ct_verify_result_.verified_scts, net_log_);
1494 ct_verify_result_.ev_policy_compliance = ev_policy_compliance;
1495 if (ev_policy_compliance !=
1496 ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY &&
1497 ev_policy_compliance !=
1498 ct::EVPolicyCompliance::EV_POLICY_COMPLIES_VIA_WHITELIST &&
1499 ev_policy_compliance !=
1500 ct::EVPolicyCompliance::EV_POLICY_COMPLIES_VIA_SCTS) {
1501 // TODO(eranm): Log via the BoundNetLog, see crbug.com/437766
1502 VLOG(1) << "EV certificate for "
1503 << server_cert_verify_result_.verified_cert->subject()
1504 .GetDisplayName()
1505 << " does not conform to CT policy, removing EV status.";
1506 server_cert_verify_result_.cert_status |=
1507 CERT_STATUS_CT_COMPLIANCE_FAILED;
1508 server_cert_verify_result_.cert_status &= ~CERT_STATUS_IS_EV;
1509 }
1510 }
1511 ct_verify_result_.cert_policy_compliance =
1512 policy_enforcer_->DoesConformToCertPolicy(
1513 server_cert_verify_result_.verified_cert.get(),
1493 ct_verify_result_.verified_scts, net_log_); 1514 ct_verify_result_.verified_scts, net_log_);
1494 ct_verify_result_.ev_policy_compliance = ev_policy_compliance;
1495 if (ev_policy_compliance !=
1496 ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY &&
1497 ev_policy_compliance !=
1498 ct::EVPolicyCompliance::EV_POLICY_COMPLIES_VIA_WHITELIST &&
1499 ev_policy_compliance !=
1500 ct::EVPolicyCompliance::EV_POLICY_COMPLIES_VIA_SCTS) {
1501 // TODO(eranm): Log via the BoundNetLog, see crbug.com/437766
1502 VLOG(1) << "EV certificate for "
1503 << server_cert_verify_result_.verified_cert->subject()
1504 .GetDisplayName()
1505 << " does not conform to CT policy, removing EV status.";
1506 server_cert_verify_result_.cert_status |=
1507 CERT_STATUS_CT_COMPLIANCE_FAILED;
1508 server_cert_verify_result_.cert_status &= ~CERT_STATUS_IS_EV;
1509 }
1510 } 1515 }
1511 } 1516 }
1512 1517
1513 void SSLClientSocketOpenSSL::OnHandshakeIOComplete(int result) { 1518 void SSLClientSocketOpenSSL::OnHandshakeIOComplete(int result) {
1514 int rv = DoHandshakeLoop(result); 1519 int rv = DoHandshakeLoop(result);
1515 if (rv != ERR_IO_PENDING) { 1520 if (rv != ERR_IO_PENDING) {
1516 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); 1521 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv);
1517 DoConnectCallback(rv); 1522 DoConnectCallback(rv);
1518 } 1523 }
1519 } 1524 }
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 tb_was_negotiated_ = true; 2381 tb_was_negotiated_ = true;
2377 return 1; 2382 return 1;
2378 } 2383 }
2379 } 2384 }
2380 2385
2381 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER; 2386 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER;
2382 return 0; 2387 return 0;
2383 } 2388 }
2384 2389
2385 } // namespace net 2390 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698