summaryrefslogtreecommitdiffstats
path: root/net/base/cert_verify_proc_mac.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/cert_verify_proc_mac.cc')
-rw-r--r--net/base/cert_verify_proc_mac.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/net/base/cert_verify_proc_mac.cc b/net/base/cert_verify_proc_mac.cc
index 49798b5..f38c5b1 100644
--- a/net/base/cert_verify_proc_mac.cc
+++ b/net/base/cert_verify_proc_mac.cc
@@ -8,6 +8,9 @@
#include <CoreServices/CoreServices.h>
#include <Security/Security.h>
+#include <string>
+#include <vector>
+
#include "base/logging.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
@@ -231,7 +234,7 @@ void GetCertChainInfo(CFArrayRef cert_chain,
}
void AppendPublicKeyHashes(CFArrayRef chain,
- std::vector<SHA1Fingerprint>* hashes) {
+ std::vector<HashValueVector>* hashes) {
const CFIndex n = CFArrayGetCount(chain);
for (CFIndex i = 0; i < n; i++) {
SecCertificateRef cert = reinterpret_cast<SecCertificateRef>(
@@ -246,9 +249,15 @@ void AppendPublicKeyHashes(CFArrayRef chain,
if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes))
continue;
- SHA1Fingerprint hash;
- CC_SHA1(spki_bytes.data(), spki_bytes.size(), hash.data);
- hashes->push_back(hash);
+ HashValue sha1;
+ sha1.tag = HASH_VALUE_SHA1;
+ CC_SHA1(spki_bytes.data(), spki_bytes.size(), sha1.data());
+ (*hashes)[HASH_VALUE_SHA1].push_back(sha1);
+
+ HashValue sha256;
+ sha256.tag = HASH_VALUE_SHA256;
+ CC_SHA256(spki_bytes.data(), spki_bytes.size(), sha256.data());
+ (*hashes)[HASH_VALUE_SHA256].push_back(sha256);
}
}
@@ -325,7 +334,7 @@ bool IsIssuedByKnownRoot(CFArrayRef chain) {
return false;
SecCertificateRef root_ref = reinterpret_cast<SecCertificateRef>(
const_cast<void*>(CFArrayGetValueAtIndex(chain, n - 1)));
- SHA1Fingerprint hash = X509Certificate::CalculateFingerprint(root_ref);
+ SHA1HashValue hash = X509Certificate::CalculateFingerprint(root_ref);
return IsSHA1HashInSortedArray(
hash, &kKnownRootCertSHA1Hashes[0][0], sizeof(kKnownRootCertSHA1Hashes));
}