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 #include "net/cert/cert_verify_proc.h" | 5 #include "net/cert/cert_verify_proc.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "base/sha1.h" | 13 #include "base/sha1.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "base/trace_event/trace_event.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 20 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
20 #include "net/base/url_util.h" | 21 #include "net/base/url_util.h" |
21 #include "net/cert/cert_status_flags.h" | 22 #include "net/cert/cert_status_flags.h" |
22 #include "net/cert/cert_verifier.h" | 23 #include "net/cert/cert_verifier.h" |
23 #include "net/cert/cert_verify_proc_whitelist.h" | 24 #include "net/cert/cert_verify_proc_whitelist.h" |
24 #include "net/cert/cert_verify_result.h" | 25 #include "net/cert/cert_verify_result.h" |
25 #include "net/cert/crl_set.h" | 26 #include "net/cert/crl_set.h" |
26 #include "net/cert/x509_certificate.h" | 27 #include "net/cert/x509_certificate.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 223 |
223 CertVerifyProc::~CertVerifyProc() {} | 224 CertVerifyProc::~CertVerifyProc() {} |
224 | 225 |
225 int CertVerifyProc::Verify(X509Certificate* cert, | 226 int CertVerifyProc::Verify(X509Certificate* cert, |
226 const std::string& hostname, | 227 const std::string& hostname, |
227 const std::string& ocsp_response, | 228 const std::string& ocsp_response, |
228 int flags, | 229 int flags, |
229 CRLSet* crl_set, | 230 CRLSet* crl_set, |
230 const CertificateList& additional_trust_anchors, | 231 const CertificateList& additional_trust_anchors, |
231 CertVerifyResult* verify_result) { | 232 CertVerifyResult* verify_result) { |
| 233 TRACE_EVENT0("net", "CertVerifyProc::Verify"); |
232 verify_result->Reset(); | 234 verify_result->Reset(); |
233 verify_result->verified_cert = cert; | 235 verify_result->verified_cert = cert; |
234 | 236 |
235 if (IsBlacklisted(cert)) { | 237 if (IsBlacklisted(cert)) { |
236 verify_result->cert_status |= CERT_STATUS_REVOKED; | 238 verify_result->cert_status |= CERT_STATUS_REVOKED; |
237 return ERR_CERT_REVOKED; | 239 return ERR_CERT_REVOKED; |
238 } | 240 } |
239 | 241 |
240 // We do online revocation checking for EV certificates that aren't covered | 242 // We do online revocation checking for EV certificates that aren't covered |
241 // by a fresh CRLSet. | 243 // by a fresh CRLSet. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 return true; | 574 return true; |
573 | 575 |
574 // For certificates issued after 1 April 2015: 39 months. | 576 // For certificates issued after 1 April 2015: 39 months. |
575 if (start >= time_2015_04_01 && month_diff > 39) | 577 if (start >= time_2015_04_01 && month_diff > 39) |
576 return true; | 578 return true; |
577 | 579 |
578 return false; | 580 return false; |
579 } | 581 } |
580 | 582 |
581 } // namespace net | 583 } // namespace net |
OLD | NEW |