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_CERTS) || defined(OS_IOS) | 29 #if defined(USE_NSS_VERIFIER) |
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_MACOSX) | 35 #elif defined(OS_MACOSX) |
36 #include "net/cert/cert_verify_proc_mac.h" | 36 #include "net/cert/cert_verify_proc_mac.h" |
37 #elif defined(OS_WIN) | 37 #elif defined(OS_WIN) |
38 #include "net/cert/cert_verify_proc_win.h" | 38 #include "net/cert/cert_verify_proc_win.h" |
39 #else | 39 #else |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 static_assert(N == crypto::kSHA256Length, | 196 static_assert(N == crypto::kSHA256Length, |
197 "Only SHA-256 hashes are supported"); | 197 "Only SHA-256 hashes are supported"); |
198 return memcmp(lhs.data(), rhs, crypto::kSHA256Length) < 0; | 198 return memcmp(lhs.data(), rhs, crypto::kSHA256Length) < 0; |
199 } | 199 } |
200 }; | 200 }; |
201 | 201 |
202 } // namespace | 202 } // namespace |
203 | 203 |
204 // static | 204 // static |
205 CertVerifyProc* CertVerifyProc::CreateDefault() { | 205 CertVerifyProc* CertVerifyProc::CreateDefault() { |
206 #if defined(USE_NSS_CERTS) || defined(OS_IOS) | 206 #if defined(USE_NSS_VERIFIER) |
207 return new CertVerifyProcNSS(); | 207 return new CertVerifyProcNSS(); |
208 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) | 208 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) |
209 return new CertVerifyProcOpenSSL(); | 209 return new CertVerifyProcOpenSSL(); |
210 #elif defined(OS_ANDROID) | 210 #elif defined(OS_ANDROID) |
211 return new CertVerifyProcAndroid(); | 211 return new CertVerifyProcAndroid(); |
212 #elif defined(OS_MACOSX) | 212 #elif defined(OS_MACOSX) |
213 return new CertVerifyProcMac(); | 213 return new CertVerifyProcMac(); |
214 #elif defined(OS_WIN) | 214 #elif defined(OS_WIN) |
215 return new CertVerifyProcWin(); | 215 return new CertVerifyProcWin(); |
216 #else | 216 #else |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 return true; | 572 return true; |
573 | 573 |
574 // For certificates issued after 1 April 2015: 39 months. | 574 // For certificates issued after 1 April 2015: 39 months. |
575 if (start >= time_2015_04_01 && month_diff > 39) | 575 if (start >= time_2015_04_01 && month_diff > 39) |
576 return true; | 576 return true; |
577 | 577 |
578 return false; | 578 return false; |
579 } | 579 } |
580 | 580 |
581 } // namespace net | 581 } // namespace net |
OLD | NEW |