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

Side by Side Diff: net/cert/x509_certificate_mac.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_ios.cc ('k') | net/cert/x509_certificate_nss.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 <CommonCrypto/CommonDigest.h> 7 #include <CommonCrypto/CommonDigest.h>
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <Security/Security.h> 9 #include <Security/Security.h>
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 DCHECK(cert_data.Data); 368 DCHECK(cert_data.Data);
369 DCHECK_NE(cert_data.Length, 0U); 369 DCHECK_NE(cert_data.Length, 0U);
370 370
371 CC_SHA1(cert_data.Data, cert_data.Length, sha1.data); 371 CC_SHA1(cert_data.Data, cert_data.Length, sha1.data);
372 372
373 return sha1; 373 return sha1;
374 } 374 }
375 375
376 // static 376 // static
377 SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) {
378 SHA256HashValue sha256;
379 memset(sha256.data, 0, sizeof(sha256.data));
380
381 CSSM_DATA cert_data;
382 OSStatus status = SecCertificateGetData(cert, &cert_data);
383 if (status)
384 return sha256;
385
386 DCHECK(cert_data.Data);
387 DCHECK_NE(cert_data.Length, 0U);
388
389 CC_SHA256(cert_data.Data, cert_data.Length, sha256.data);
390
391 return sha256;
392 }
393
394 // static
395 SHA1HashValue X509Certificate::CalculateCAFingerprint( 377 SHA1HashValue X509Certificate::CalculateCAFingerprint(
396 const OSCertHandles& intermediates) { 378 const OSCertHandles& intermediates) {
397 SHA1HashValue sha1; 379 SHA1HashValue sha1;
398 memset(sha1.data, 0, sizeof(sha1.data)); 380 memset(sha1.data, 0, sizeof(sha1.data));
399 381
400 // The CC_SHA(3cc) man page says all CC_SHA1_xxx routines return 1, so 382 // The CC_SHA(3cc) man page says all CC_SHA1_xxx routines return 1, so
401 // we don't check their return values. 383 // we don't check their return values.
402 CC_SHA1_CTX sha1_ctx; 384 CC_SHA1_CTX sha1_ctx;
403 CC_SHA1_Init(&sha1_ctx); 385 CC_SHA1_Init(&sha1_ctx);
404 CSSM_DATA cert_data; 386 CSSM_DATA cert_data;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 *type = kPublicKeyTypeDH; 507 *type = kPublicKeyTypeDH;
526 break; 508 break;
527 default: 509 default:
528 *type = kPublicKeyTypeUnknown; 510 *type = kPublicKeyTypeUnknown;
529 *size_bits = 0; 511 *size_bits = 0;
530 break; 512 break;
531 } 513 }
532 } 514 }
533 515
534 } // namespace net 516 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_ios.cc ('k') | net/cert/x509_certificate_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698