| 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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return OK; | 88 return OK; |
| 89 default: | 89 default: |
| 90 LOG(WARNING) << "Unknown error " << err << " mapped to net::ERR_FAILED"; | 90 LOG(WARNING) << "Unknown error " << err << " mapped to net::ERR_FAILED"; |
| 91 return ERR_FAILED; | 91 return ERR_FAILED; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Map the errors in the chain_context->TrustStatus.dwErrorStatus returned by | 95 // Map the errors in the chain_context->TrustStatus.dwErrorStatus returned by |
| 96 // CertGetCertificateChain to our certificate status flags. | 96 // CertGetCertificateChain to our certificate status flags. |
| 97 int MapCertChainErrorStatusToCertStatus(DWORD error_status) { | 97 int MapCertChainErrorStatusToCertStatus(DWORD error_status) { |
| 98 int cert_status = 0; | 98 CertStatus cert_status = 0; |
| 99 | 99 |
| 100 // We don't include CERT_TRUST_IS_NOT_TIME_NESTED because it's obsolete and | 100 // We don't include CERT_TRUST_IS_NOT_TIME_NESTED because it's obsolete and |
| 101 // we wouldn't consider it an error anyway | 101 // we wouldn't consider it an error anyway |
| 102 const DWORD kDateInvalidErrors = CERT_TRUST_IS_NOT_TIME_VALID | | 102 const DWORD kDateInvalidErrors = CERT_TRUST_IS_NOT_TIME_VALID | |
| 103 CERT_TRUST_CTL_IS_NOT_TIME_VALID; | 103 CERT_TRUST_CTL_IS_NOT_TIME_VALID; |
| 104 if (error_status & kDateInvalidErrors) | 104 if (error_status & kDateInvalidErrors) |
| 105 cert_status |= CERT_STATUS_DATE_INVALID; | 105 cert_status |= CERT_STATUS_DATE_INVALID; |
| 106 | 106 |
| 107 const DWORD kAuthorityInvalidErrors = CERT_TRUST_IS_UNTRUSTED_ROOT | | 107 const DWORD kAuthorityInvalidErrors = CERT_TRUST_IS_UNTRUSTED_ROOT | |
| 108 CERT_TRUST_IS_EXPLICIT_DISTRUST | | 108 CERT_TRUST_IS_EXPLICIT_DISTRUST | |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], | 1061 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], |
| 1062 &length)) { | 1062 &length)) { |
| 1063 return false; | 1063 return false; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), | 1066 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), |
| 1067 length); | 1067 length); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 } // namespace net | 1070 } // namespace net |
| OLD | NEW |