| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_status_flags.h" | 5 #include "net/cert/cert_status_flags.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 case ERR_CERT_COMMON_NAME_INVALID: | 22 case ERR_CERT_COMMON_NAME_INVALID: |
| 23 return CERT_STATUS_COMMON_NAME_INVALID; | 23 return CERT_STATUS_COMMON_NAME_INVALID; |
| 24 case ERR_CERT_DATE_INVALID: | 24 case ERR_CERT_DATE_INVALID: |
| 25 return CERT_STATUS_DATE_INVALID; | 25 return CERT_STATUS_DATE_INVALID; |
| 26 case ERR_CERT_AUTHORITY_INVALID: | 26 case ERR_CERT_AUTHORITY_INVALID: |
| 27 return CERT_STATUS_AUTHORITY_INVALID; | 27 return CERT_STATUS_AUTHORITY_INVALID; |
| 28 case ERR_CERT_NO_REVOCATION_MECHANISM: | 28 case ERR_CERT_NO_REVOCATION_MECHANISM: |
| 29 return CERT_STATUS_NO_REVOCATION_MECHANISM; | 29 return CERT_STATUS_NO_REVOCATION_MECHANISM; |
| 30 case ERR_CERT_UNABLE_TO_CHECK_REVOCATION: | 30 case ERR_CERT_UNABLE_TO_CHECK_REVOCATION: |
| 31 return CERT_STATUS_UNABLE_TO_CHECK_REVOCATION; | 31 return CERT_STATUS_UNABLE_TO_CHECK_REVOCATION; |
| 32 case ERR_CERTIFICATE_TRANSPARENCY_REQUIRED: |
| 33 return CERT_STATUS_CERTIFICATE_TRANSPARENCY_REQUIRED; |
| 32 case ERR_CERT_REVOKED: | 34 case ERR_CERT_REVOKED: |
| 33 return CERT_STATUS_REVOKED; | 35 return CERT_STATUS_REVOKED; |
| 34 // We added the ERR_CERT_CONTAINS_ERRORS error code when we were using | 36 // We added the ERR_CERT_CONTAINS_ERRORS error code when we were using |
| 35 // WinInet, but we never figured out how it differs from ERR_CERT_INVALID. | 37 // WinInet, but we never figured out how it differs from ERR_CERT_INVALID. |
| 36 // We should not use ERR_CERT_CONTAINS_ERRORS in new code. | 38 // We should not use ERR_CERT_CONTAINS_ERRORS in new code. |
| 37 case ERR_CERT_CONTAINS_ERRORS: | 39 case ERR_CERT_CONTAINS_ERRORS: |
| 38 NOTREACHED(); | 40 NOTREACHED(); |
| 39 // Falls through. | 41 // Falls through. |
| 40 case ERR_CERT_INVALID: | 42 case ERR_CERT_INVALID: |
| 41 return CERT_STATUS_INVALID; | 43 return CERT_STATUS_INVALID; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 66 if (cert_status & CERT_STATUS_INVALID) | 68 if (cert_status & CERT_STATUS_INVALID) |
| 67 return ERR_CERT_INVALID; | 69 return ERR_CERT_INVALID; |
| 68 if (cert_status & CERT_STATUS_PINNED_KEY_MISSING) | 70 if (cert_status & CERT_STATUS_PINNED_KEY_MISSING) |
| 69 return ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; | 71 return ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; |
| 70 | 72 |
| 71 // Recoverable errors | 73 // Recoverable errors |
| 72 if (cert_status & CERT_STATUS_AUTHORITY_INVALID) | 74 if (cert_status & CERT_STATUS_AUTHORITY_INVALID) |
| 73 return ERR_CERT_AUTHORITY_INVALID; | 75 return ERR_CERT_AUTHORITY_INVALID; |
| 74 if (cert_status & CERT_STATUS_COMMON_NAME_INVALID) | 76 if (cert_status & CERT_STATUS_COMMON_NAME_INVALID) |
| 75 return ERR_CERT_COMMON_NAME_INVALID; | 77 return ERR_CERT_COMMON_NAME_INVALID; |
| 78 if (cert_status & CERT_STATUS_CERTIFICATE_TRANSPARENCY_REQUIRED) |
| 79 return ERR_CERTIFICATE_TRANSPARENCY_REQUIRED; |
| 76 // CERT_STATUS_NON_UNIQUE_NAME is intentionally not mapped to an error. | 80 // CERT_STATUS_NON_UNIQUE_NAME is intentionally not mapped to an error. |
| 77 // It is treated as just a warning and used to degrade the SSL UI. | 81 // It is treated as just a warning and used to degrade the SSL UI. |
| 78 if (cert_status & CERT_STATUS_NAME_CONSTRAINT_VIOLATION) | 82 if (cert_status & CERT_STATUS_NAME_CONSTRAINT_VIOLATION) |
| 79 return ERR_CERT_NAME_CONSTRAINT_VIOLATION; | 83 return ERR_CERT_NAME_CONSTRAINT_VIOLATION; |
| 80 if (cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM) | 84 if (cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM) |
| 81 return ERR_CERT_WEAK_SIGNATURE_ALGORITHM; | 85 return ERR_CERT_WEAK_SIGNATURE_ALGORITHM; |
| 82 if (cert_status & CERT_STATUS_WEAK_KEY) | 86 if (cert_status & CERT_STATUS_WEAK_KEY) |
| 83 return ERR_CERT_WEAK_KEY; | 87 return ERR_CERT_WEAK_KEY; |
| 84 if (cert_status & CERT_STATUS_DATE_INVALID) | 88 if (cert_status & CERT_STATUS_DATE_INVALID) |
| 85 return ERR_CERT_DATE_INVALID; | 89 return ERR_CERT_DATE_INVALID; |
| 86 if (cert_status & CERT_STATUS_VALIDITY_TOO_LONG) | 90 if (cert_status & CERT_STATUS_VALIDITY_TOO_LONG) |
| 87 return ERR_CERT_VALIDITY_TOO_LONG; | 91 return ERR_CERT_VALIDITY_TOO_LONG; |
| 88 | 92 |
| 89 // Unknown status. Give it the benefit of the doubt. | 93 // Unknown status. Give it the benefit of the doubt. |
| 90 if (cert_status & CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) | 94 if (cert_status & CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) |
| 91 return ERR_CERT_UNABLE_TO_CHECK_REVOCATION; | 95 return ERR_CERT_UNABLE_TO_CHECK_REVOCATION; |
| 92 if (cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM) | 96 if (cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM) |
| 93 return ERR_CERT_NO_REVOCATION_MECHANISM; | 97 return ERR_CERT_NO_REVOCATION_MECHANISM; |
| 94 | 98 |
| 95 NOTREACHED(); | 99 NOTREACHED(); |
| 96 return ERR_UNEXPECTED; | 100 return ERR_UNEXPECTED; |
| 97 } | 101 } |
| 98 | 102 |
| 99 } // namespace net | 103 } // namespace net |
| OLD | NEW |