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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Flag certificates using weak signature algorithms. | 254 // Flag certificates using weak signature algorithms. |
255 if (verify_result->has_md5) { | 255 if (verify_result->has_md5) { |
256 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; | 256 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; |
257 // Avoid replacing a more serious error, such as an OS/library failure, | 257 // Avoid replacing a more serious error, such as an OS/library failure, |
258 // by ensuring that if verification failed, it failed with a certificate | 258 // by ensuring that if verification failed, it failed with a certificate |
259 // error. | 259 // error. |
260 if (rv == OK || IsCertificateError(rv)) | 260 if (rv == OK || IsCertificateError(rv)) |
261 rv = MapCertStatusToNetError(verify_result->cert_status); | 261 rv = MapCertStatusToNetError(verify_result->cert_status); |
262 } | 262 } |
263 | 263 |
264 #if !defined(OS_ANDROID) | |
265 // Flag certificates from publicly-trusted CAs that are issued to intranet | 264 // Flag certificates from publicly-trusted CAs that are issued to intranet |
266 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit | 265 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit |
267 // these to be issued until 1 November 2015, they represent a real risk for | 266 // these to be issued until 1 November 2015, they represent a real risk for |
268 // the deployment of gTLDs and are being phased out ahead of the hard | 267 // the deployment of gTLDs and are being phased out ahead of the hard |
269 // deadline. | 268 // deadline. |
270 // | |
271 // TODO(ppi): is_issued_by_known_root is incorrect on Android. Once this is | |
272 // fixed, re-enable this check for Android. crbug.com/116838 | |
273 if (verify_result->is_issued_by_known_root && IsHostnameNonUnique(hostname)) { | 269 if (verify_result->is_issued_by_known_root && IsHostnameNonUnique(hostname)) { |
274 verify_result->cert_status |= CERT_STATUS_NON_UNIQUE_NAME; | 270 verify_result->cert_status |= CERT_STATUS_NON_UNIQUE_NAME; |
275 // CERT_STATUS_NON_UNIQUE_NAME will eventually become a hard error. For | 271 // CERT_STATUS_NON_UNIQUE_NAME will eventually become a hard error. For |
276 // now treat it as a warning and do not map it to an error return value. | 272 // now treat it as a warning and do not map it to an error return value. |
277 } | 273 } |
278 #endif | |
279 | 274 |
280 return rv; | 275 return rv; |
281 } | 276 } |
282 | 277 |
283 // static | 278 // static |
284 bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { | 279 bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { |
285 static const unsigned kComodoSerialBytes = 16; | 280 static const unsigned kComodoSerialBytes = 16; |
286 static const uint8 kComodoSerials[][kComodoSerialBytes] = { | 281 static const uint8 kComodoSerials[][kComodoSerialBytes] = { |
287 // Not a real certificate. For testing only. | 282 // Not a real certificate. For testing only. |
288 {0x07,0x7a,0x59,0xbc,0xd5,0x34,0x59,0x60,0x1c,0xa6,0x90,0x72,0x67,0xa6,0xdd,
0x1c}, | 283 {0x07,0x7a,0x59,0xbc,0xd5,0x34,0x59,0x60,0x1c,0xa6,0x90,0x72,0x67,0xa6,0xdd,
0x1c}, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return true; | 526 return true; |
532 } | 527 } |
533 } | 528 } |
534 } | 529 } |
535 } | 530 } |
536 | 531 |
537 return false; | 532 return false; |
538 } | 533 } |
539 | 534 |
540 } // namespace net | 535 } // namespace net |
OLD | NEW |