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

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

Issue 1988993002: Check self-signed certificate names and signatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More Windows bugfixes Created 4 years, 7 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 | « no previous file | net/cert/x509_certificate_nss.cc » ('j') | net/cert/x509_certificate_nss.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 <Security/Security.h> 8 #include <Security/Security.h>
9 9
10 #include <openssl/x509.h> 10 #include <openssl/x509.h>
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // static 461 // static
462 bool X509Certificate::IsSelfSigned(OSCertHandle os_cert) { 462 bool X509Certificate::IsSelfSigned(OSCertHandle os_cert) {
463 ScopedX509 cert = OSCertHandleToOpenSSL(os_cert); 463 ScopedX509 cert = OSCertHandleToOpenSSL(os_cert);
464 if (!cert) 464 if (!cert)
465 return false; 465 return false;
466 crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert.get())); 466 crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert.get()));
467 if (!scoped_key) 467 if (!scoped_key)
468 return false; 468 return false;
469 469
470 // NOTE: X509_verify() returns 1 in case of success, 0 or -1 on error. 470 // NOTE: X509_verify() returns 1 in case of success, 0 or -1 on error.
471 return X509_verify(cert.get(), scoped_key.get()) == 1; 471 if ((X509_verify(cert.get(), scoped_key.get())) != 1) {
estark 2016/05/20 18:37:53 nit: as much as it pains me personally, use no cur
dadrian 2016/05/20 19:01:21 Done, though I wash my hands of all responsibility
472 return false;
473 }
474 // NOTE: x509_check_issued returns X509_V_OK in case of success
475 if (X509_check_issued(cert.get(), cert.get()) != X509_V_OK) {
svaldez 2016/05/20 17:54:52 Consider: return X509_check_issued...
dadrian 2016/05/20 19:01:21 Done.
476 return false;
477 }
478 return true;
472 } 479 }
473 480
474 } // namespace net 481 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/cert/x509_certificate_nss.cc » ('j') | net/cert/x509_certificate_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698