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

Unified Diff: net/base/x509_certificate_openssl.cc

Issue 8387032: OpenSSL: fix serial number tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate_openssl.cc
diff --git a/net/base/x509_certificate_openssl.cc b/net/base/x509_certificate_openssl.cc
index ac5b75c83d47a84133c8ac65c0f3d4a8f3c162cf..40e2ecfcc5710f2ff5a30d48a48f9835b638ee9a 100644
--- a/net/base/x509_certificate_openssl.cc
+++ b/net/base/x509_certificate_openssl.cc
@@ -332,6 +332,13 @@ void X509Certificate::Initialize() {
serial_number_ = std::string(
reinterpret_cast<char*>(num->data),
num->length);
+ if ((num->type & V_ASN1_NEG) == 0 &&
+ num->length != 0 &&
+ num->data[0] >= 0x80) {
joth 2011/10/31 17:17:45 nit: I find the last term slightly easier to read
agl 2011/10/31 17:23:45 Done.
+ // The non-negative serial_number_ needs to be padded with a leading 0
+ // byte in order that the MSB isn't set.
joth 2011/10/31 17:17:45 is there a reasonable hint you could add here as t
agl 2011/10/31 17:23:45 Have expanded the comment.
+ serial_number_ = std::string("", 1) + serial_number_;
+ }
}
ParsePrincipal(cert_handle_, X509_get_subject_name(cert_handle_), &subject_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698