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 "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
20 #include "net/base/url_util.h" | 20 #include "net/base/url_util.h" |
21 #include "net/cert/cert_status_flags.h" | 21 #include "net/cert/cert_status_flags.h" |
22 #include "net/cert/cert_verifier.h" | 22 #include "net/cert/cert_verifier.h" |
23 #include "net/cert/cert_verify_proc_whitelist.h" | 23 #include "net/cert/cert_verify_proc_whitelist.h" |
24 #include "net/cert/cert_verify_result.h" | 24 #include "net/cert/cert_verify_result.h" |
25 #include "net/cert/crl_set.h" | 25 #include "net/cert/crl_set.h" |
26 #include "net/cert/x509_certificate.h" | 26 #include "net/cert/x509_certificate.h" |
27 #include "url/url_canon.h" | 27 #include "url/url_canon.h" |
28 | 28 |
| 29 #include "base/trace_event/trace_event.h" |
| 30 |
29 #if defined(USE_NSS_CERTS) || defined(OS_IOS) | 31 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
30 #include "net/cert/cert_verify_proc_nss.h" | 32 #include "net/cert/cert_verify_proc_nss.h" |
31 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) | 33 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) |
32 #include "net/cert/cert_verify_proc_openssl.h" | 34 #include "net/cert/cert_verify_proc_openssl.h" |
33 #elif defined(OS_ANDROID) | 35 #elif defined(OS_ANDROID) |
34 #include "net/cert/cert_verify_proc_android.h" | 36 #include "net/cert/cert_verify_proc_android.h" |
35 #elif defined(OS_MACOSX) | 37 #elif defined(OS_MACOSX) |
36 #include "net/cert/cert_verify_proc_mac.h" | 38 #include "net/cert/cert_verify_proc_mac.h" |
37 #elif defined(OS_WIN) | 39 #elif defined(OS_WIN) |
38 #include "net/cert/cert_verify_proc_win.h" | 40 #include "net/cert/cert_verify_proc_win.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 224 |
223 CertVerifyProc::~CertVerifyProc() {} | 225 CertVerifyProc::~CertVerifyProc() {} |
224 | 226 |
225 int CertVerifyProc::Verify(X509Certificate* cert, | 227 int CertVerifyProc::Verify(X509Certificate* cert, |
226 const std::string& hostname, | 228 const std::string& hostname, |
227 const std::string& ocsp_response, | 229 const std::string& ocsp_response, |
228 int flags, | 230 int flags, |
229 CRLSet* crl_set, | 231 CRLSet* crl_set, |
230 const CertificateList& additional_trust_anchors, | 232 const CertificateList& additional_trust_anchors, |
231 CertVerifyResult* verify_result) { | 233 CertVerifyResult* verify_result) { |
| 234 TRACE_EVENT0("net", "net::CertVerifyProc::Verify"); |
232 verify_result->Reset(); | 235 verify_result->Reset(); |
233 verify_result->verified_cert = cert; | 236 verify_result->verified_cert = cert; |
234 | 237 |
235 if (IsBlacklisted(cert)) { | 238 if (IsBlacklisted(cert)) { |
236 verify_result->cert_status |= CERT_STATUS_REVOKED; | 239 verify_result->cert_status |= CERT_STATUS_REVOKED; |
237 return ERR_CERT_REVOKED; | 240 return ERR_CERT_REVOKED; |
238 } | 241 } |
239 | 242 |
240 // We do online revocation checking for EV certificates that aren't covered | 243 // We do online revocation checking for EV certificates that aren't covered |
241 // by a fresh CRLSet. | 244 // by a fresh CRLSet. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 return true; | 575 return true; |
573 | 576 |
574 // For certificates issued after 1 April 2015: 39 months. | 577 // For certificates issued after 1 April 2015: 39 months. |
575 if (start >= time_2015_04_01 && month_diff > 39) | 578 if (start >= time_2015_04_01 && month_diff > 39) |
576 return true; | 579 return true; |
577 | 580 |
578 return false; | 581 return false; |
579 } | 582 } |
580 | 583 |
581 } // namespace net | 584 } // namespace net |
OLD | NEW |