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

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

Issue 173199: Avoid a crash in X.509 NSS certificate verification glue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 4 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424 7 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424
8 // until NSS 3.12.2 comes out and we update to it. 8 // until NSS 3.12.2 comes out and we update to it.
9 #define Lock FOO_NSS_Lock 9 #define Lock FOO_NSS_Lock
10 #include <cert.h> 10 #include <cert.h>
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 } 166 }
167 167
168 // Saves some information about the certificate chain cert_list in 168 // Saves some information about the certificate chain cert_list in
169 // *verify_result. The caller MUST initialize *verify_result before calling 169 // *verify_result. The caller MUST initialize *verify_result before calling
170 // this function. 170 // this function.
171 // Note that cert_list[0] is the end entity certificate and cert_list doesn't 171 // Note that cert_list[0] is the end entity certificate and cert_list doesn't
172 // contain the root CA certificate. 172 // contain the root CA certificate.
173 void GetCertChainInfo(CERTCertList* cert_list, 173 void GetCertChainInfo(CERTCertList* cert_list,
174 CertVerifyResult* verify_result) { 174 CertVerifyResult* verify_result) {
175 if (!cert_list) {
176 return;
177 }
178
175 int i = 0; 179 int i = 0;
176 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); 180 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list);
177 !CERT_LIST_END(node, cert_list); 181 !CERT_LIST_END(node, cert_list);
178 node = CERT_LIST_NEXT(node), i++) { 182 node = CERT_LIST_NEXT(node), i++) {
179 SECAlgorithmID& signature = node->cert->signature; 183 SECAlgorithmID& signature = node->cert->signature;
180 SECOidTag oid_tag = SECOID_FindOIDTag(&signature.algorithm); 184 SECOidTag oid_tag = SECOID_FindOIDTag(&signature.algorithm);
181 switch (oid_tag) { 185 switch (oid_tag) {
182 case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: 186 case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION:
183 verify_result->has_md5 = true; 187 verify_result->has_md5 = true;
184 if (i != 0) 188 if (i != 0)
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 DCHECK(0 != cert->derCert.len); 608 DCHECK(0 != cert->derCert.len);
605 609
606 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data, 610 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data,
607 cert->derCert.data, cert->derCert.len); 611 cert->derCert.data, cert->derCert.len);
608 DCHECK(rv == SECSuccess); 612 DCHECK(rv == SECSuccess);
609 613
610 return sha1; 614 return sha1;
611 } 615 }
612 616
613 } // namespace net 617 } // 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