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

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

Issue 1094983002: Account for the OS returning an empty certificate chain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size test cert to a multiple of 8, otherwise key size in bits is weird Created 5 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 unified diff | Download patch
« no previous file with comments | « net/cert/cert_verify_proc_unittest.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 <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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, 490 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
491 size_t* size_bits, 491 size_t* size_bits,
492 PublicKeyType* type) { 492 PublicKeyType* type) {
493 // Since we might fail, set the output parameters to default values first. 493 // Since we might fail, set the output parameters to default values first.
494 *type = kPublicKeyTypeUnknown; 494 *type = kPublicKeyTypeUnknown;
495 *size_bits = 0; 495 *size_bits = 0;
496 496
497 SecKeyRef key; 497 SecKeyRef key;
498 OSStatus status = SecCertificateCopyPublicKey(cert_handle, &key); 498 OSStatus status = SecCertificateCopyPublicKey(cert_handle, &key);
499 if (status) { 499 if (status) {
500 NOTREACHED() << "SecCertificateCopyPublicKey failed: " << status; 500 // SecCertificateCopyPublicKey may fail if the certificate has an invalid
501 // key. See https://crbug.com/472291.
502 LOG(WARNING) << "SecCertificateCopyPublicKey failed: " << status;
501 return; 503 return;
502 } 504 }
503 ScopedCFTypeRef<SecKeyRef> scoped_key(key); 505 ScopedCFTypeRef<SecKeyRef> scoped_key(key);
504 506
505 const CSSM_KEY* cssm_key; 507 const CSSM_KEY* cssm_key;
506 status = SecKeyGetCSSMKey(key, &cssm_key); 508 status = SecKeyGetCSSMKey(key, &cssm_key);
507 if (status) { 509 if (status) {
508 NOTREACHED() << "SecKeyGetCSSMKey failed: " << status; 510 NOTREACHED() << "SecKeyGetCSSMKey failed: " << status;
509 return; 511 return;
510 } 512 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 status = SecCertificateGetData(cert_handle, &cert_data); 564 status = SecCertificateGetData(cert_handle, &cert_data);
563 if (status) 565 if (status)
564 return false; 566 return false;
565 567
566 if (CSSM_CL_CertVerify(cl_handle, 0, &cert_data, &cert_data, NULL, 0)) 568 if (CSSM_CL_CertVerify(cl_handle, 0, &cert_data, &cert_data, NULL, 0))
567 return false; 569 return false;
568 return true; 570 return true;
569 } 571 }
570 572
571 } // namespace net 573 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698