| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Flag certificates using weak signature algorithms. | 235 // Flag certificates using weak signature algorithms. |
| 236 if (verify_result->has_md5) { | 236 if (verify_result->has_md5) { |
| 237 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; | 237 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; |
| 238 // Avoid replacing a more serious error, such as an OS/library failure, | 238 // Avoid replacing a more serious error, such as an OS/library failure, |
| 239 // by ensuring that if verification failed, it failed with a certificate | 239 // by ensuring that if verification failed, it failed with a certificate |
| 240 // error. | 240 // error. |
| 241 if (rv == OK || IsCertificateError(rv)) | 241 if (rv == OK || IsCertificateError(rv)) |
| 242 rv = MapCertStatusToNetError(verify_result->cert_status); | 242 rv = MapCertStatusToNetError(verify_result->cert_status); |
| 243 } | 243 } |
| 244 | 244 |
| 245 #if !defined(OS_ANDROID) |
| 245 // Flag certificates from publicly-trusted CAs that are issued to intranet | 246 // Flag certificates from publicly-trusted CAs that are issued to intranet |
| 246 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit | 247 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit |
| 247 // these to be issued until 1 November 2015, they represent a real risk for | 248 // these to be issued until 1 November 2015, they represent a real risk for |
| 248 // the deployment of gTLDs and are being phased out ahead of the hard | 249 // the deployment of gTLDs and are being phased out ahead of the hard |
| 249 // deadline. | 250 // deadline. |
| 250 // TODO(rsleevi): http://crbug.com/119212 - Also match internal IP address | 251 // |
| 251 // ranges. | 252 // TODO(ppi): is_issued_by_known_root is incorrect on Android. Once this is |
| 253 // fixed, re-enable this check for Android. crbug.com/116838 |
| 252 if (verify_result->is_issued_by_known_root && IsHostnameNonUnique(hostname)) { | 254 if (verify_result->is_issued_by_known_root && IsHostnameNonUnique(hostname)) { |
| 253 verify_result->cert_status |= CERT_STATUS_NON_UNIQUE_NAME; | 255 verify_result->cert_status |= CERT_STATUS_NON_UNIQUE_NAME; |
| 254 } | 256 } |
| 257 #endif |
| 255 | 258 |
| 256 return rv; | 259 return rv; |
| 257 } | 260 } |
| 258 | 261 |
| 259 // static | 262 // static |
| 260 bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { | 263 bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { |
| 261 static const unsigned kComodoSerialBytes = 16; | 264 static const unsigned kComodoSerialBytes = 16; |
| 262 static const uint8 kComodoSerials[][kComodoSerialBytes] = { | 265 static const uint8 kComodoSerials[][kComodoSerialBytes] = { |
| 263 // Not a real certificate. For testing only. | 266 // Not a real certificate. For testing only. |
| 264 {0x07,0x7a,0x59,0xbc,0xd5,0x34,0x59,0x60,0x1c,0xa6,0x90,0x72,0x67,0xa6,0xdd,
0x1c}, | 267 {0x07,0x7a,0x59,0xbc,0xd5,0x34,0x59,0x60,0x1c,0xa6,0x90,0x72,0x67,0xa6,0xdd,
0x1c}, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 memcmp(j->data(), kHashes[i], base::kSHA1Length) == 0) { | 386 memcmp(j->data(), kHashes[i], base::kSHA1Length) == 0) { |
| 384 return true; | 387 return true; |
| 385 } | 388 } |
| 386 } | 389 } |
| 387 } | 390 } |
| 388 | 391 |
| 389 return false; | 392 return false; |
| 390 } | 393 } |
| 391 | 394 |
| 392 } // namespace net | 395 } // namespace net |
| OLD | NEW |