| OLD | NEW |
| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Saves some information about the certificate chain cert_list in | 174 // Saves some information about the certificate chain cert_list in |
| 175 // *verify_result. The caller MUST initialize *verify_result before calling | 175 // *verify_result. The caller MUST initialize *verify_result before calling |
| 176 // this function. | 176 // this function. |
| 177 // Note that cert_list[0] is the end entity certificate and cert_list doesn't | 177 // Note that cert_list[0] is the end entity certificate and cert_list doesn't |
| 178 // contain the root CA certificate. | 178 // contain the root CA certificate. |
| 179 void GetCertChainInfo(CERTCertList* cert_list, | 179 void GetCertChainInfo(CERTCertList* cert_list, |
| 180 CertVerifyResult* verify_result) { | 180 CertVerifyResult* verify_result) { |
| 181 // NOTE: Using a NSS library before 3.12.3.1 will crash below. To see the |
| 182 // NSS version currently in use: |
| 183 // 1. use ldd on the chrome executable for NSS's location (ie. libnss3.so*) |
| 184 // 2. use ident libnss3.so* for the library's version |
| 185 DCHECK(cert_list); |
| 181 int i = 0; | 186 int i = 0; |
| 182 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); | 187 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); |
| 183 !CERT_LIST_END(node, cert_list); | 188 !CERT_LIST_END(node, cert_list); |
| 184 node = CERT_LIST_NEXT(node), i++) { | 189 node = CERT_LIST_NEXT(node), i++) { |
| 185 SECAlgorithmID& signature = node->cert->signature; | 190 SECAlgorithmID& signature = node->cert->signature; |
| 186 SECOidTag oid_tag = SECOID_FindOIDTag(&signature.algorithm); | 191 SECOidTag oid_tag = SECOID_FindOIDTag(&signature.algorithm); |
| 187 switch (oid_tag) { | 192 switch (oid_tag) { |
| 188 case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: | 193 case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: |
| 189 verify_result->has_md5 = true; | 194 verify_result->has_md5 = true; |
| 190 if (i != 0) | 195 if (i != 0) |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 DCHECK(0 != cert->derCert.len); | 632 DCHECK(0 != cert->derCert.len); |
| 628 | 633 |
| 629 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data, | 634 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data, |
| 630 cert->derCert.data, cert->derCert.len); | 635 cert->derCert.data, cert->derCert.len); |
| 631 DCHECK(rv == SECSuccess); | 636 DCHECK(rv == SECSuccess); |
| 632 | 637 |
| 633 return sha1; | 638 return sha1; |
| 634 } | 639 } |
| 635 | 640 |
| 636 } // namespace net | 641 } // namespace net |
| OLD | NEW |