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

Side by Side Diff: net/cert/x509_certificate_openssl.cc

Issue 542673002: Revert "Certificate Transparency: Code for unpacking EV cert hashes whitelist" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « net/cert/x509_certificate_nss.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cert/x509_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include <openssl/asn1.h> 7 #include <openssl/asn1.h>
8 #include <openssl/bytestring.h> 8 #include <openssl/bytestring.h>
9 #include <openssl/crypto.h> 9 #include <openssl/crypto.h>
10 #include <openssl/obj_mac.h> 10 #include <openssl/obj_mac.h>
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 SHA1HashValue X509Certificate::CalculateFingerprint(OSCertHandle cert) { 287 SHA1HashValue X509Certificate::CalculateFingerprint(OSCertHandle cert) {
288 SHA1HashValue sha1; 288 SHA1HashValue sha1;
289 unsigned int sha1_size = static_cast<unsigned int>(sizeof(sha1.data)); 289 unsigned int sha1_size = static_cast<unsigned int>(sizeof(sha1.data));
290 int ret = X509_digest(cert, EVP_sha1(), sha1.data, &sha1_size); 290 int ret = X509_digest(cert, EVP_sha1(), sha1.data, &sha1_size);
291 CHECK(ret); 291 CHECK(ret);
292 CHECK_EQ(sha1_size, sizeof(sha1.data)); 292 CHECK_EQ(sha1_size, sizeof(sha1.data));
293 return sha1; 293 return sha1;
294 } 294 }
295 295
296 // static 296 // static
297 SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) {
298 SHA256HashValue sha256;
299 unsigned int sha256_size = static_cast<unsigned int>(sizeof(sha256.data));
300 int ret = X509_digest(cert, EVP_sha256(), sha256.data, &sha256_size);
301 CHECK(ret);
302 CHECK_EQ(sha256_size, sizeof(sha256.data));
303 return sha256;
304 }
305
306 // static
307 SHA1HashValue X509Certificate::CalculateCAFingerprint( 297 SHA1HashValue X509Certificate::CalculateCAFingerprint(
308 const OSCertHandles& intermediates) { 298 const OSCertHandles& intermediates) {
309 SHA1HashValue sha1; 299 SHA1HashValue sha1;
310 memset(sha1.data, 0, sizeof(sha1.data)); 300 memset(sha1.data, 0, sizeof(sha1.data));
311 301
312 SHA_CTX sha1_ctx; 302 SHA_CTX sha1_ctx;
313 SHA1_Init(&sha1_ctx); 303 SHA1_Init(&sha1_ctx);
314 DERCache der_cache; 304 DERCache der_cache;
315 for (size_t i = 0; i < intermediates.size(); ++i) { 305 for (size_t i = 0; i < intermediates.size(); ++i) {
316 if (!GetDERAndCacheIfNeeded(intermediates[i], &der_cache)) 306 if (!GetDERAndCacheIfNeeded(intermediates[i], &der_cache))
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 if (X509_NAME_cmp(issuer, cert_names[n]) == 0) { 501 if (X509_NAME_cmp(issuer, cert_names[n]) == 0) {
512 return true; 502 return true;
513 } 503 }
514 } 504 }
515 } 505 }
516 506
517 return false; 507 return false;
518 } 508 }
519 509
520 } // namespace net 510 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_nss.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698