Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <openssl/asn1.h> | 7 #include <openssl/asn1.h> |
| 8 #include <openssl/bytestring.h> | 8 #include <openssl/bytestring.h> |
| 9 #include <openssl/crypto.h> | 9 #include <openssl/crypto.h> |
| 10 #include <openssl/obj_mac.h> | 10 #include <openssl/obj_mac.h> |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 return false; | 451 return false; |
| 452 } | 452 } |
| 453 | 453 |
| 454 // static | 454 // static |
| 455 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) { | 455 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) { |
| 456 crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert_handle)); | 456 crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert_handle)); |
| 457 if (!scoped_key) | 457 if (!scoped_key) |
| 458 return false; | 458 return false; |
| 459 | 459 |
| 460 // NOTE: X509_verify() returns 1 in case of success, 0 or -1 on error. | 460 // NOTE: X509_verify() returns 1 in case of success, 0 or -1 on error. |
| 461 return X509_verify(cert_handle, scoped_key.get()) == 1; | 461 if (X509_verify(cert_handle, scoped_key.get()) != 1) { |
|
estark
2016/05/20 18:37:53
same nit about the curly braces
| |
| 462 return false; | |
| 463 } | |
| 464 // NOTE: x509_check_issued returns X509_V_OK in case of success | |
| 465 if (X509_check_issued(cert_handle, cert_handle) != X509_V_OK) { | |
|
svaldez
2016/05/20 17:54:52
Simplify to be the same as _ios comment.
dadrian
2016/05/20 19:01:21
Done.
| |
| 466 return false; | |
| 467 } | |
| 468 return true; | |
| 462 } | 469 } |
| 463 | 470 |
| 464 } // namespace net | 471 } // namespace net |
| OLD | NEW |