| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |