Chromium Code Reviews| Index: net/cert/cert_verify_proc.cc |
| diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc |
| index 413abb4b2fb6cae29b2d75f800f8925f8eaf76da..efffcba5ead72564a77831997ba1b7833bfcaf41 100644 |
| --- a/net/cert/cert_verify_proc.cc |
| +++ b/net/cert/cert_verify_proc.cc |
| @@ -482,24 +482,23 @@ int CertVerifyProc::Verify(X509Certificate* cert, |
| // 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
|
| // As the risk is greatest for publicly trusted certificates, prevent |
| // those certificates from being trusted from that date forward. |
| - // |
| - // TODO(mattm): apply the SHA-1 deprecation check to all certs unless |
| - // CertVerifier::VERIFY_ENABLE_SHA1_LOCAL_ANCHORS flag is present. |
| + bool disable_sha1 = verify_result->is_issued_by_known_root || |
| + !(flags & CertVerifier::VERIFY_ENABLE_SHA1_LOCAL_ANCHORS); |
| if (verify_result->has_md5 || |
| // Current SHA-1 behaviour: |
| // - Reject all publicly trusted SHA-1 |
| // - ... 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.
|
| // allowed for that platform. See https://crbug.com/588789 |
| (!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
|
| - (verify_result->is_issued_by_known_root && |
| + (disable_sha1 && |
| (verify_result->has_sha1_leaf || |
| (verify_result->has_sha1 && !AreSHA1IntermediatesAllowed())))) || |
| // Legacy SHA-1 behaviour: |
| // - Reject all publicly trusted SHA-1 leaf certs issued after |
| // 2016-01-01. |
| - (sha1_legacy_mode_enabled && (verify_result->has_sha1_leaf && |
| - verify_result->is_issued_by_known_root && |
| - IsPastSHA1DeprecationDate(*cert)))) { |
| + (sha1_legacy_mode_enabled && |
| + (verify_result->has_sha1_leaf && disable_sha1 && |
| + IsPastSHA1DeprecationDate(*cert)))) { |
| verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; |
| // Avoid replacing a more serious error, such as an OS/library failure, |
| // by ensuring that if verification failed, it failed with a certificate |