diff options
author | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-18 21:00:18 +0000 |
---|---|---|
committer | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-18 21:00:18 +0000 |
commit | e9d315dd4ac20719da8a37d43b85b583a18a119c (patch) | |
tree | 4f182071f4b0fe6c30be1598e714688f6dcd4490 /net | |
parent | 113ab13f317a212284c022771438705c6cba6227 (diff) | |
download | chromium_src-e9d315dd4ac20719da8a37d43b85b583a18a119c.zip chromium_src-e9d315dd4ac20719da8a37d43b85b583a18a119c.tar.gz chromium_src-e9d315dd4ac20719da8a37d43b85b583a18a119c.tar.bz2 |
Some tweaks pointed out by wtc.
Review URL: http://codereview.chromium.org/2973
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/x509_certificate_mac.cc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc index a65bec1..59964af 100644 --- a/net/base/x509_certificate_mac.cc +++ b/net/base/x509_certificate_mac.cc @@ -40,11 +40,6 @@ bool IsNullFingerprint(const X509Certificate::Fingerprint& fingerprint) { // (all zero) fingerprint on failure. X509Certificate::Fingerprint CalculateFingerprint( X509Certificate::OSCertHandle cert) { - // The Windows code uses CryptHashCertificate, a function specially designed - // to hash certificates. I'm not sure what the difference between using it and - // just hashing the data is. WINE's implementation just hashes the data, and - // so we'll do that. - X509Certificate::Fingerprint sha1; memset(sha1.data, 0, sizeof(sha1.data)); @@ -132,26 +127,25 @@ void GetCertFieldsForOID(X509Certificate::OSCertHandle cert_handle, if (status) return; - CSSM_CL_HANDLE clHandle; - status = SecCertificateGetCLHandle(cert_handle, &clHandle); + CSSM_CL_HANDLE cl_handle; + status = SecCertificateGetCLHandle(cert_handle, &cl_handle); if (status) return; - uint32 numOfFields; + uint32 num_of_fields; CSSM_FIELD_PTR fields; - status = CSSM_CL_CertGetAllFields(clHandle, &cert_data, &numOfFields, + status = CSSM_CL_CertGetAllFields(cl_handle, &cert_data, &num_of_fields, &fields); if (status) return; - for (size_t field = 0; field < numOfFields; ++field) { + for (size_t field = 0; field < num_of_fields; ++field) { if (CSSMOIDEqual(&fields[field].FieldOid, &oid)) { std::string value = std::string(reinterpret_cast<std::string::value_type*> (fields[field].FieldValue.Data), fields[field].FieldValue.Length); result->push_back(value); - break; } } } @@ -335,6 +329,9 @@ void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const { GetCertFieldsForOID(cert_handle_, CSSMOID_SubjectAltName, dns_names); + // TODO(avi): wtc says we need more parsing here. Return and fix when the + // unit tests are complete and we can verify we're doing this right. + if (dns_names->empty()) dns_names->push_back(subject_.common_name); } |