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

Unified Diff: net/cert/x509_certificate_ios.cc

Issue 2000503002: Remove the fingerprint and ca_fingerprint from X509Certificate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_cache
Patch Set: Fix IDN test Created 4 years, 6 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/cert/x509_certificate.cc ('k') | net/cert/x509_certificate_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_ios.cc
diff --git a/net/cert/x509_certificate_ios.cc b/net/cert/x509_certificate_ios.cc
index a92c5d16a0b3c01e3bf8ada0103446384c3248c4..f50652ce8b634757032c0d6b2c40cbd24148b6ac 100644
--- a/net/cert/x509_certificate_ios.cc
+++ b/net/cert/x509_certificate_ios.cc
@@ -173,8 +173,6 @@ void X509Certificate::FreeOSCertHandle(OSCertHandle cert_handle) {
void X509Certificate::Initialize() {
crypto::EnsureOpenSSLInit();
- fingerprint_ = CalculateFingerprint(cert_handle_);
- ca_fingerprint_ = CalculateCAFingerprint(intermediate_ca_certs_);
ScopedX509 x509_cert = OSCertHandleToOpenSSL(cert_handle_);
if (!x509_cert)
return;
@@ -201,21 +199,6 @@ void X509Certificate::Initialize() {
}
// static
-SHA1HashValue X509Certificate::CalculateFingerprint(OSCertHandle cert) {
- SHA1HashValue sha1;
- memset(sha1.data, 0, sizeof(sha1.data));
-
- ScopedCFTypeRef<CFDataRef> cert_data(SecCertificateCopyData(cert));
- if (!cert_data)
- return sha1;
- DCHECK(CFDataGetBytePtr(cert_data));
- DCHECK_NE(0, CFDataGetLength(cert_data));
- CC_SHA1(CFDataGetBytePtr(cert_data), CFDataGetLength(cert_data), sha1.data);
-
- return sha1;
-}
-
-// static
SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) {
SHA256HashValue sha256;
memset(sha256.data, 0, sizeof(sha256.data));
@@ -232,23 +215,23 @@ SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) {
}
// static
-SHA1HashValue X509Certificate::CalculateCAFingerprint(
+SHA256HashValue X509Certificate::CalculateCAFingerprint256(
const OSCertHandles& intermediates) {
- SHA1HashValue sha1;
- memset(sha1.data, 0, sizeof(sha1.data));
+ SHA256HashValue sha256;
+ memset(sha256.data, 0, sizeof(sha256.data));
- CC_SHA1_CTX sha1_ctx;
- CC_SHA1_Init(&sha1_ctx);
+ CC_SHA256_CTX sha256_ctx;
+ CC_SHA256_Init(&sha256_ctx);
for (size_t i = 0; i < intermediates.size(); ++i) {
ScopedCFTypeRef<CFDataRef> cert_data(
SecCertificateCopyData(intermediates[i]));
if (!cert_data)
- return sha1;
- CC_SHA1_Update(&sha1_ctx, CFDataGetBytePtr(cert_data),
- CFDataGetLength(cert_data));
+ return sha256;
+ CC_SHA256_Update(&sha256_ctx, CFDataGetBytePtr(cert_data),
+ CFDataGetLength(cert_data));
}
- CC_SHA1_Final(sha1.data, &sha1_ctx);
- return sha1;
+ CC_SHA256_Final(sha256.data, &sha256_ctx);
+ return sha256;
}
// static
« no previous file with comments | « net/cert/x509_certificate.cc ('k') | net/cert/x509_certificate_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698