Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: net/base/cert_verify_proc_win.cc

Issue 10537153: Do not treat weak keys (<1024 bits || MD5) as fatal errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "crypto/capi_util.h" 11 #include "crypto/capi_util.h"
12 #include "crypto/scoped_capi_types.h" 12 #include "crypto/scoped_capi_types.h"
13 #include "crypto/sha2.h" 13 #include "crypto/sha2.h"
14 #include "net/base/asn1_util.h" 14 #include "net/base/asn1_util.h"
15 #include "net/base/cert_status_flags.h" 15 #include "net/base/cert_status_flags.h"
16 #include "net/base/cert_verify_result.h" 16 #include "net/base/cert_verify_result.h"
17 #include "net/base/crl_set.h" 17 #include "net/base/crl_set.h"
18 #include "net/base/ev_root_ca_metadata.h" 18 #include "net/base/ev_root_ca_metadata.h"
19 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
20 #include "net/base/test_root_certs.h" 20 #include "net/base/test_root_certs.h"
21 #include "net/base/x509_certificate.h" 21 #include "net/base/x509_certificate.h"
22 #include "net/base/x509_certificate_known_roots_win.h" 22 #include "net/base/x509_certificate_known_roots_win.h"
23 23
24 #pragma comment(lib, "crypt32.lib") 24 #pragma comment(lib, "crypt32.lib")
25 25
26 #if !defined(CERT_TRUST_HAS_WEAK_SIGNATURE)
27 // This was introduced in Windows 8 / Windows Server 2012, but retroactively
28 // ported as far back as Windows XP via system update.
29 #define CERT_TRUST_HAS_WEAK_SIGNATURE 0x00100000
30 #endif
31
26 namespace net { 32 namespace net {
27 33
28 namespace { 34 namespace {
29 35
30 struct FreeChainEngineFunctor { 36 struct FreeChainEngineFunctor {
31 void operator()(HCERTCHAINENGINE engine) const { 37 void operator()(HCERTCHAINENGINE engine) const {
32 if (engine) 38 if (engine)
33 CertFreeCertificateChainEngine(engine); 39 CertFreeCertificateChainEngine(engine);
34 } 40 }
35 }; 41 };
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (error_status & CERT_TRUST_IS_REVOKED) 139 if (error_status & CERT_TRUST_IS_REVOKED)
134 cert_status |= CERT_STATUS_REVOKED; 140 cert_status |= CERT_STATUS_REVOKED;
135 141
136 const DWORD kWrongUsageErrors = CERT_TRUST_IS_NOT_VALID_FOR_USAGE | 142 const DWORD kWrongUsageErrors = CERT_TRUST_IS_NOT_VALID_FOR_USAGE |
137 CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE; 143 CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE;
138 if (error_status & kWrongUsageErrors) { 144 if (error_status & kWrongUsageErrors) {
139 // TODO(wtc): Should we add CERT_STATUS_WRONG_USAGE? 145 // TODO(wtc): Should we add CERT_STATUS_WRONG_USAGE?
140 cert_status |= CERT_STATUS_INVALID; 146 cert_status |= CERT_STATUS_INVALID;
141 } 147 }
142 148
149 if (error_status & CERT_TRUST_IS_NOT_SIGNATURE_VALID) {
150 // Check for a 'non-strong-signed' signature. Depending on OS
agl 2012/06/13 21:15:13 You have 'non-strong-signed' in quotes, so maybe i
Ryan Sleevi 2012/06/13 21:22:37 Yeah, MSFT document. They don't call it a 'weak' s
151 // configuration, this may also exclude SHA-1 signatures.
152 if (error_status & CERT_TRUST_HAS_WEAK_SIGNATURE) {
153 cert_status |= CERT_STATUS_WEAK_KEY;
154 } else {
155 cert_status |= CERT_STATUS_INVALID;
156 }
157 }
158
143 // The rest of the errors. 159 // The rest of the errors.
144 const DWORD kCertInvalidErrors = 160 const DWORD kCertInvalidErrors =
145 CERT_TRUST_IS_NOT_SIGNATURE_VALID |
146 CERT_TRUST_IS_CYCLIC | 161 CERT_TRUST_IS_CYCLIC |
147 CERT_TRUST_INVALID_EXTENSION | 162 CERT_TRUST_INVALID_EXTENSION |
148 CERT_TRUST_INVALID_POLICY_CONSTRAINTS | 163 CERT_TRUST_INVALID_POLICY_CONSTRAINTS |
149 CERT_TRUST_INVALID_BASIC_CONSTRAINTS | 164 CERT_TRUST_INVALID_BASIC_CONSTRAINTS |
150 CERT_TRUST_INVALID_NAME_CONSTRAINTS | 165 CERT_TRUST_INVALID_NAME_CONSTRAINTS |
151 CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID | 166 CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID |
152 CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT | 167 CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT |
153 CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT | 168 CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT |
154 CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT | 169 CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT |
155 CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT | 170 CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(chain_context); 728 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(chain_context);
714 729
715 if (ev_policy_oid && 730 if (ev_policy_oid &&
716 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { 731 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) {
717 verify_result->cert_status |= CERT_STATUS_IS_EV; 732 verify_result->cert_status |= CERT_STATUS_IS_EV;
718 } 733 }
719 return OK; 734 return OK;
720 } 735 }
721 736
722 } // namespace net 737 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698