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

Unified Diff: net/cert/x509_certificate_openssl.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 side-by-side diff with in-line comments
Download patch
Index: net/cert/x509_certificate_openssl.cc
diff --git a/net/cert/x509_certificate_openssl.cc b/net/cert/x509_certificate_openssl.cc
index dc1b4ee6244901ac2bb006e04933903455df05a7..154106059682b7ea51df2c9eaba87e89f622a8b2 100644
--- a/net/cert/x509_certificate_openssl.cc
+++ b/net/cert/x509_certificate_openssl.cc
@@ -458,7 +458,14 @@ bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) {
return false;
// NOTE: X509_verify() returns 1 in case of success, 0 or -1 on error.
- return X509_verify(cert_handle, scoped_key.get()) == 1;
+ if (X509_verify(cert_handle, scoped_key.get()) != 1) {
estark 2016/05/20 18:37:53 same nit about the curly braces
+ return false;
+ }
+ // NOTE: x509_check_issued returns X509_V_OK in case of success
+ 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.
+ return false;
+ }
+ return true;
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698