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

Side by Side Diff: net/cert/cert_verify_proc_nss.cc

Issue 18332012: Reland r209278 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « crypto/signature_creator_nss.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | 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/cert/cert_verify_proc_nss.h" 5 #include "net/cert/cert_verify_proc_nss.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include <cert.h> 10 #include <cert.h>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return MapNetErrorToCertStatus(net_error); 151 return MapNetErrorToCertStatus(net_error);
152 } 152 }
153 153
154 // Saves some information about the certificate chain cert_list in 154 // Saves some information about the certificate chain cert_list in
155 // *verify_result. The caller MUST initialize *verify_result before calling 155 // *verify_result. The caller MUST initialize *verify_result before calling
156 // this function. 156 // this function.
157 // Note that cert_list[0] is the end entity certificate. 157 // Note that cert_list[0] is the end entity certificate.
158 void GetCertChainInfo(CERTCertList* cert_list, 158 void GetCertChainInfo(CERTCertList* cert_list,
159 CERTCertificate* root_cert, 159 CERTCertificate* root_cert,
160 CertVerifyResult* verify_result) { 160 CertVerifyResult* verify_result) {
161 // NOTE: Using a NSS library before 3.12.3.1 will crash below. To see the
162 // NSS version currently in use:
163 // 1. use ldd on the chrome executable for NSS's location (ie. libnss3.so*)
164 // 2. use ident libnss3.so* for the library's version
165 DCHECK(cert_list); 161 DCHECK(cert_list);
166 162
167 CERTCertificate* verified_cert = NULL; 163 CERTCertificate* verified_cert = NULL;
168 std::vector<CERTCertificate*> verified_chain; 164 std::vector<CERTCertificate*> verified_chain;
169 int i = 0; 165 int i = 0;
170 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); 166 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list);
171 !CERT_LIST_END(node, cert_list); 167 !CERT_LIST_END(node, cert_list);
172 node = CERT_LIST_NEXT(node), ++i) { 168 node = CERT_LIST_NEXT(node), ++i) {
173 if (i == 0) { 169 if (i == 0) {
174 verified_cert = node->cert; 170 verified_cert = node->cert;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 SECStatus PKIXVerifyCert(CERTCertificate* cert_handle, 335 SECStatus PKIXVerifyCert(CERTCertificate* cert_handle,
340 bool check_revocation, 336 bool check_revocation,
341 bool cert_io_enabled, 337 bool cert_io_enabled,
342 const SECOidTag* policy_oids, 338 const SECOidTag* policy_oids,
343 int num_policy_oids, 339 int num_policy_oids,
344 CERTCertList* additional_trust_anchors, 340 CERTCertList* additional_trust_anchors,
345 CERTValOutParam* cvout) { 341 CERTValOutParam* cvout) {
346 bool use_crl = check_revocation; 342 bool use_crl = check_revocation;
347 bool use_ocsp = check_revocation; 343 bool use_ocsp = check_revocation;
348 344
349 // These CAs have multiple keys, which trigger two bugs in NSS's CRL code.
350 // 1. NSS may use one key to verify a CRL signed with another key,
351 // incorrectly concluding that the CRL's signature is invalid.
352 // Hopefully this bug will be fixed in NSS 3.12.9.
353 // 2. NSS considers all certificates issued by the CA as revoked when it
354 // receives a CRL with an invalid signature. This overly strict policy
355 // has been relaxed in NSS 3.12.7. See
356 // https://bugzilla.mozilla.org/show_bug.cgi?id=562542.
357 // So we have to turn off CRL checking for these CAs. See
358 // http://crbug.com/55695.
359 static const char* const kMultipleKeyCA[] = {
360 "CN=Microsoft Secure Server Authority,"
361 "DC=redmond,DC=corp,DC=microsoft,DC=com",
362 "CN=Microsoft Secure Server Authority",
363 };
364
365 if (!NSS_VersionCheck("3.12.7")) {
366 for (size_t i = 0; i < arraysize(kMultipleKeyCA); ++i) {
367 if (strcmp(cert_handle->issuerName, kMultipleKeyCA[i]) == 0) {
368 use_crl = false;
369 break;
370 }
371 }
372 }
373
374 PRUint64 revocation_method_flags = 345 PRUint64 revocation_method_flags =
375 CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD | 346 CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD |
376 CERT_REV_M_ALLOW_NETWORK_FETCHING | 347 CERT_REV_M_ALLOW_NETWORK_FETCHING |
377 CERT_REV_M_IGNORE_IMPLICIT_DEFAULT_SOURCE | 348 CERT_REV_M_IGNORE_IMPLICIT_DEFAULT_SOURCE |
378 CERT_REV_M_IGNORE_MISSING_FRESH_INFO | 349 CERT_REV_M_IGNORE_MISSING_FRESH_INFO |
379 CERT_REV_M_STOP_TESTING_ON_FRESH_INFO; 350 CERT_REV_M_STOP_TESTING_ON_FRESH_INFO;
380 PRUint64 revocation_method_independent_flags = 351 PRUint64 revocation_method_independent_flags =
381 CERT_REV_MI_TEST_ALL_LOCAL_INFORMATION_FIRST; 352 CERT_REV_MI_TEST_ALL_LOCAL_INFORMATION_FIRST;
382 if (check_revocation && policy_oids && num_policy_oids > 0) { 353 if (check_revocation && policy_oids && num_policy_oids > 0) {
383 // EV verification requires revocation checking. Consider the certificate 354 // EV verification requires revocation checking. Consider the certificate
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 if ((flags & CertVerifier::VERIFY_EV_CERT) && is_ev_candidate && 839 if ((flags & CertVerifier::VERIFY_EV_CERT) && is_ev_candidate &&
869 VerifyEV(cert_handle, flags, crl_set, metadata, ev_policy_oid, 840 VerifyEV(cert_handle, flags, crl_set, metadata, ev_policy_oid,
870 trust_anchors.get())) { 841 trust_anchors.get())) {
871 verify_result->cert_status |= CERT_STATUS_IS_EV; 842 verify_result->cert_status |= CERT_STATUS_IS_EV;
872 } 843 }
873 844
874 return OK; 845 return OK;
875 } 846 }
876 847
877 } // namespace net 848 } // namespace net
OLDNEW
« no previous file with comments | « crypto/signature_creator_nss.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698