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 #if defined(USE_NSS_VERIFIER) | 29 #if defined(USE_NSS_CERTS) |
30 #include "net/cert/cert_verify_proc_nss.h" | 30 #include "net/cert/cert_verify_proc_nss.h" |
31 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) | 31 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) |
32 #include "net/cert/cert_verify_proc_openssl.h" | 32 #include "net/cert/cert_verify_proc_openssl.h" |
33 #elif defined(OS_ANDROID) | 33 #elif defined(OS_ANDROID) |
34 #include "net/cert/cert_verify_proc_android.h" | 34 #include "net/cert/cert_verify_proc_android.h" |
35 #elif defined(OS_IOS) | 35 #elif defined(OS_IOS) |
36 #include "net/cert/cert_verify_proc_ios.h" | 36 #include "net/cert/cert_verify_proc_ios.h" |
37 #elif defined(OS_MACOSX) | 37 #elif defined(OS_MACOSX) |
38 #include "net/cert/cert_verify_proc_mac.h" | 38 #include "net/cert/cert_verify_proc_mac.h" |
39 #elif defined(OS_WIN) | 39 #elif defined(OS_WIN) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 static_assert(N == crypto::kSHA256Length, | 198 static_assert(N == crypto::kSHA256Length, |
199 "Only SHA-256 hashes are supported"); | 199 "Only SHA-256 hashes are supported"); |
200 return memcmp(lhs.data(), rhs, crypto::kSHA256Length) < 0; | 200 return memcmp(lhs.data(), rhs, crypto::kSHA256Length) < 0; |
201 } | 201 } |
202 }; | 202 }; |
203 | 203 |
204 } // namespace | 204 } // namespace |
205 | 205 |
206 // static | 206 // static |
207 CertVerifyProc* CertVerifyProc::CreateDefault() { | 207 CertVerifyProc* CertVerifyProc::CreateDefault() { |
208 #if defined(USE_NSS_VERIFIER) | 208 #if defined(USE_NSS_CERTS) |
209 return new CertVerifyProcNSS(); | 209 return new CertVerifyProcNSS(); |
210 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) | 210 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) |
211 return new CertVerifyProcOpenSSL(); | 211 return new CertVerifyProcOpenSSL(); |
212 #elif defined(OS_ANDROID) | 212 #elif defined(OS_ANDROID) |
213 return new CertVerifyProcAndroid(); | 213 return new CertVerifyProcAndroid(); |
214 #elif defined(OS_IOS) | 214 #elif defined(OS_IOS) |
215 return new CertVerifyProcIOS(); | 215 return new CertVerifyProcIOS(); |
216 #elif defined(OS_MACOSX) | 216 #elif defined(OS_MACOSX) |
217 return new CertVerifyProcMac(); | 217 return new CertVerifyProcMac(); |
218 #elif defined(OS_WIN) | 218 #elif defined(OS_WIN) |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 return true; | 576 return true; |
577 | 577 |
578 // For certificates issued after 1 April 2015: 39 months. | 578 // For certificates issued after 1 April 2015: 39 months. |
579 if (start >= time_2015_04_01 && month_diff > 39) | 579 if (start >= time_2015_04_01 && month_diff > 39) |
580 return true; | 580 return true; |
581 | 581 |
582 return false; | 582 return false; |
583 } | 583 } |
584 | 584 |
585 } // namespace net | 585 } // namespace net |
OLD | NEW |