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

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: Bugfixes for changes from initial comments 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/24 03:40:17 nit: it looks like there's a superfluous pair of p
472 return false;
473 // NOTE: x509_check_issued returns X509_V_OK in case of success
474 return X509_check_issued(cert.get(), cert.get()) == X509_V_OK;
472 } 475 }
473 476
474 } // namespace net 477 } // 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