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/base/cert_verify_proc_win.h" | 5 #include "net/base/cert_verify_proc_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 typedef scoped_ptr_malloc<const CERT_CHAIN_CONTEXT, | 64 typedef scoped_ptr_malloc<const CERT_CHAIN_CONTEXT, |
65 FreeCertChainContextFunctor> | 65 FreeCertChainContextFunctor> |
66 ScopedPCCERT_CHAIN_CONTEXT; | 66 ScopedPCCERT_CHAIN_CONTEXT; |
67 | 67 |
68 typedef scoped_ptr_malloc<const CERT_CONTEXT, | 68 typedef scoped_ptr_malloc<const CERT_CONTEXT, |
69 FreeCertContextFunctor> ScopedPCCERT_CONTEXT; | 69 FreeCertContextFunctor> ScopedPCCERT_CONTEXT; |
70 | 70 |
71 //----------------------------------------------------------------------------- | 71 //----------------------------------------------------------------------------- |
72 | 72 |
73 // TODO(wtc): This is a copy of the MapSecurityError function in | |
74 // ssl_client_socket_win.cc. Another function that maps Windows error codes | |
75 // to our network error codes is WinInetUtil::OSErrorToNetError. We should | |
76 // eliminate the code duplication. | |
77 int MapSecurityError(SECURITY_STATUS err) { | 73 int MapSecurityError(SECURITY_STATUS err) { |
78 // There are numerous security error codes, but these are the ones we thus | 74 // There are numerous security error codes, but these are the ones we thus |
79 // far find interesting. | 75 // far find interesting. |
80 switch (err) { | 76 switch (err) { |
81 case SEC_E_WRONG_PRINCIPAL: // Schannel | 77 case SEC_E_WRONG_PRINCIPAL: // Schannel |
82 case CERT_E_CN_NO_MATCH: // CryptoAPI | 78 case CERT_E_CN_NO_MATCH: // CryptoAPI |
83 return ERR_CERT_COMMON_NAME_INVALID; | 79 return ERR_CERT_COMMON_NAME_INVALID; |
84 case SEC_E_UNTRUSTED_ROOT: // Schannel | 80 case SEC_E_UNTRUSTED_ROOT: // Schannel |
85 case CERT_E_UNTRUSTEDROOT: // CryptoAPI | 81 case CERT_E_UNTRUSTEDROOT: // CryptoAPI |
86 return ERR_CERT_AUTHORITY_INVALID; | 82 return ERR_CERT_AUTHORITY_INVALID; |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 return MapCertStatusToNetError(verify_result->cert_status); | 740 return MapCertStatusToNetError(verify_result->cert_status); |
745 | 741 |
746 if (ev_policy_oid && | 742 if (ev_policy_oid && |
747 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { | 743 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { |
748 verify_result->cert_status |= CERT_STATUS_IS_EV; | 744 verify_result->cert_status |= CERT_STATUS_IS_EV; |
749 } | 745 } |
750 return OK; | 746 return OK; |
751 } | 747 } |
752 | 748 |
753 } // namespace net | 749 } // namespace net |
OLD | NEW |