Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |