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

Unified Diff: net/cert/cert_verify_proc_mac.cc

Issue 2746103003: Add X509CertificateBytes which uses CRYPTO_BUFFER instead of macOS-native certificate types. (Closed)
Patch Set: rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/BUILD.gn ('k') | net/cert/internal/parse_name.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/cert_verify_proc_mac.cc
diff --git a/net/cert/cert_verify_proc_mac.cc b/net/cert/cert_verify_proc_mac.cc
index 6e1f8d6322dab4be2a80df7563f0d5ce5331e4f1..0ed65a6039c6ad84e506fba6d6aefa28dfacb672 100644
--- a/net/cert/cert_verify_proc_mac.cc
+++ b/net/cert/cert_verify_proc_mac.cc
@@ -202,7 +202,8 @@ void CopyCertChainToVerifyResult(CFArrayRef cert_chain,
}
scoped_refptr<X509Certificate> verified_cert_with_chain =
- X509Certificate::CreateFromHandle(verified_cert, verified_chain);
+ x509_util::CreateX509CertificateFromSecCertificate(verified_cert,
+ verified_chain);
if (verified_cert_with_chain)
verify_result->verified_cert = std::move(verified_cert_with_chain);
else
@@ -212,7 +213,7 @@ void CopyCertChainToVerifyResult(CFArrayRef cert_chain,
// Returns true if the certificate uses MD2, MD4, MD5, or SHA1, and false
// otherwise. A return of false also includes the case where the signature
// algorithm couldn't be conclusively labeled as weak.
-bool CertUsesWeakHash(X509Certificate::OSCertHandle cert_handle) {
+bool CertUsesWeakHash(SecCertificateRef cert_handle) {
x509_util::CSSMCachedCertificate cached_cert;
OSStatus status = cached_cert.Init(cert_handle);
if (status)
@@ -616,7 +617,7 @@ class OSXKnownRootHelper {
return false;
SecCertificateRef root_ref = reinterpret_cast<SecCertificateRef>(
const_cast<void*>(CFArrayGetValueAtIndex(chain, n - 1)));
- SHA256HashValue hash = X509Certificate::CalculateFingerprint256(root_ref);
+ SHA256HashValue hash = x509_util::CalculateFingerprint256(root_ref);
return known_roots_.find(hash) != known_roots_.end();
}
@@ -636,7 +637,7 @@ class OSXKnownRootHelper {
for (CFIndex i = 0, size = CFArrayGetCount(cert_array); i < size; ++i) {
SecCertificateRef cert = reinterpret_cast<SecCertificateRef>(
const_cast<void*>(CFArrayGetValueAtIndex(cert_array, i)));
- known_roots_.insert(X509Certificate::CalculateFingerprint256(cert));
+ known_roots_.insert(x509_util::CalculateFingerprint256(cert));
}
}
@@ -782,7 +783,9 @@ int VerifyWithGivenFlags(X509Certificate* cert,
}
ScopedCFTypeRef<CFMutableArrayRef> cert_array(
- cert->CreateOSCertChainForCert());
+ x509_util::CreateSecCertificateArrayForX509Certificate(cert));
+ if (!cert_array)
+ return ERR_CERT_INVALID;
// Beginning with the certificate chain as supplied by the server, attempt
// to verify the chain. If a failure is encountered, trim a certificate
« no previous file with comments | « net/BUILD.gn ('k') | net/cert/internal/parse_name.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698