Chromium Code Reviews| 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 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 rv = MapCertStatusToNetError(verify_result->cert_status); | 472 rv = MapCertStatusToNetError(verify_result->cert_status); |
| 473 } | 473 } |
| 474 | 474 |
| 475 if (verify_result->has_sha1) | 475 if (verify_result->has_sha1) |
| 476 verify_result->cert_status |= CERT_STATUS_SHA1_SIGNATURE_PRESENT; | 476 verify_result->cert_status |= CERT_STATUS_SHA1_SIGNATURE_PRESENT; |
| 477 | 477 |
| 478 // Flag certificates using weak signature algorithms. | 478 // Flag certificates using weak signature algorithms. |
| 479 // The CA/Browser Forum Baseline Requirements (beginning with v1.2.1) | 479 // The CA/Browser Forum Baseline Requirements (beginning with v1.2.1) |
| 480 // prohibits SHA-1 certificates from being issued beginning on | 480 // prohibits SHA-1 certificates from being issued beginning on |
| 481 // 1 January 2016. Ideally, all of SHA-1 in new certificates would be | 481 // 1 January 2016. Ideally, all of SHA-1 in new certificates would be |
| 482 // disabled on this date, but enterprises need more time to transition. | 482 // disabled on this date, but enterprises need more time to transition. |
|
eroman
2016/12/13 01:22:47
Should this comment be updated?
Ryan Sleevi
2016/12/13 01:29:57
I'm not sure it should be, but I'm admittedly thin
| |
| 483 // As the risk is greatest for publicly trusted certificates, prevent | 483 // As the risk is greatest for publicly trusted certificates, prevent |
| 484 // those certificates from being trusted from that date forward. | 484 // those certificates from being trusted from that date forward. |
| 485 // | 485 bool disable_sha1 = verify_result->is_issued_by_known_root || |
| 486 // TODO(mattm): apply the SHA-1 deprecation check to all certs unless | 486 !(flags & CertVerifier::VERIFY_ENABLE_SHA1_LOCAL_ANCHORS); |
| 487 // CertVerifier::VERIFY_ENABLE_SHA1_LOCAL_ANCHORS flag is present. | |
| 488 if (verify_result->has_md5 || | 487 if (verify_result->has_md5 || |
| 489 // Current SHA-1 behaviour: | 488 // Current SHA-1 behaviour: |
| 490 // - Reject all publicly trusted SHA-1 | 489 // - Reject all publicly trusted SHA-1 |
| 491 // - ... unless it's in the intermediate and SHA-1 intermediates are | 490 // - ... unless it's in the intermediate and SHA-1 intermediates are |
|
eroman
2016/12/13 01:22:47
This comment also seems incomplete now.
Ryan Sleevi
2016/12/13 01:29:57
Why does it seem incomplete?
It's consistent gram
eroman
2016/12/13 01:49:33
It doesn't note the per-request override.
| |
| 492 // allowed for that platform. See https://crbug.com/588789 | 491 // allowed for that platform. See https://crbug.com/588789 |
| 493 (!sha1_legacy_mode_enabled && | 492 (!sha1_legacy_mode_enabled && |
|
eroman
2016/12/13 01:22:47
This big nested if-statement is really hard to rea
Ryan Sleevi
2016/12/13 01:29:57
I explicitly wanted to avoid this. I'd be curious
eroman
2016/12/13 01:49:33
Similar concerns as hilghted in this article:
http
Ryan Sleevi
2016/12/13 02:22:47
I guess this doesn't really help me understand why
| |
| 494 (verify_result->is_issued_by_known_root && | 493 (disable_sha1 && |
| 495 (verify_result->has_sha1_leaf || | 494 (verify_result->has_sha1_leaf || |
| 496 (verify_result->has_sha1 && !AreSHA1IntermediatesAllowed())))) || | 495 (verify_result->has_sha1 && !AreSHA1IntermediatesAllowed())))) || |
| 497 // Legacy SHA-1 behaviour: | 496 // Legacy SHA-1 behaviour: |
| 498 // - Reject all publicly trusted SHA-1 leaf certs issued after | 497 // - Reject all publicly trusted SHA-1 leaf certs issued after |
| 499 // 2016-01-01. | 498 // 2016-01-01. |
| 500 (sha1_legacy_mode_enabled && (verify_result->has_sha1_leaf && | 499 (sha1_legacy_mode_enabled && |
| 501 verify_result->is_issued_by_known_root && | 500 (verify_result->has_sha1_leaf && disable_sha1 && |
| 502 IsPastSHA1DeprecationDate(*cert)))) { | 501 IsPastSHA1DeprecationDate(*cert)))) { |
| 503 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; | 502 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; |
| 504 // Avoid replacing a more serious error, such as an OS/library failure, | 503 // Avoid replacing a more serious error, such as an OS/library failure, |
| 505 // by ensuring that if verification failed, it failed with a certificate | 504 // by ensuring that if verification failed, it failed with a certificate |
| 506 // error. | 505 // error. |
| 507 if (rv == OK || IsCertificateError(rv)) | 506 if (rv == OK || IsCertificateError(rv)) |
| 508 rv = MapCertStatusToNetError(verify_result->cert_status); | 507 rv = MapCertStatusToNetError(verify_result->cert_status); |
| 509 } | 508 } |
| 510 | 509 |
| 511 // Flag certificates from publicly-trusted CAs that are issued to intranet | 510 // Flag certificates from publicly-trusted CAs that are issued to intranet |
| 512 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit | 511 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 return true; | 769 return true; |
| 771 | 770 |
| 772 return false; | 771 return false; |
| 773 } | 772 } |
| 774 | 773 |
| 775 // static | 774 // static |
| 776 const base::Feature CertVerifyProc::kSHA1LegacyMode{ | 775 const base::Feature CertVerifyProc::kSHA1LegacyMode{ |
| 777 "SHA1LegacyMode", base::FEATURE_DISABLED_BY_DEFAULT}; | 776 "SHA1LegacyMode", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 778 | 777 |
| 779 } // namespace net | 778 } // namespace net |
| OLD | NEW |