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

Unified Diff: net/cert/x509_certificate_bytes.cc

Issue 2897433002: X509CertificateBytes: Allow invalid serial numbers for now. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « net/cert/internal/parsed_certificate_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_bytes.cc
diff --git a/net/cert/x509_certificate_bytes.cc b/net/cert/x509_certificate_bytes.cc
index a351fb90cf26b933abb0085d42cdb428f6657592..ef4e006713f07f7ef2aa78ac19c903c6c44547db 100644
--- a/net/cert/x509_certificate_bytes.cc
+++ b/net/cert/x509_certificate_bytes.cc
@@ -42,6 +42,12 @@ bool GeneralizedTimeToBaseTime(const der::GeneralizedTime& generalized,
return base::Time::FromUTCExploded(exploded, result);
}
+ParseCertificateOptions DefaultParseCertificateOptions() {
+ ParseCertificateOptions options;
+ options.allow_invalid_serial_numbers = true;
+ return options;
+}
+
// Sets |value| to the Value from a DER Sequence Tag-Length-Value and return
// true, or return false if the TLV was not a valid DER Sequence.
WARN_UNUSED_RESULT bool GetSequenceValue(const der::Input& tlv,
@@ -64,7 +70,8 @@ bool GetNormalizedCertIssuer(CRYPTO_BUFFER* cert,
return false;
}
ParsedTbsCertificate tbs;
- if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs, nullptr))
+ if (!ParseTbsCertificate(tbs_certificate_tlv,
+ DefaultParseCertificateOptions(), &tbs, nullptr))
return false;
der::Input issuer_value;
@@ -168,7 +175,8 @@ bool X509Certificate::Initialize() {
}
ParsedTbsCertificate tbs;
- if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs, nullptr))
+ if (!ParseTbsCertificate(tbs_certificate_tlv,
+ DefaultParseCertificateOptions(), &tbs, nullptr))
return false;
if (!ParsePrincipal(tbs.subject_tlv, &subject_) ||
@@ -203,7 +211,8 @@ bool X509Certificate::GetSubjectAltName(
}
ParsedTbsCertificate tbs;
- if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs, nullptr))
+ if (!ParseTbsCertificate(tbs_certificate_tlv,
+ DefaultParseCertificateOptions(), &tbs, nullptr))
return false;
if (!tbs.has_extensions)
return false;
@@ -427,7 +436,8 @@ bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) {
return false;
}
ParsedTbsCertificate tbs;
- if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs, nullptr)) {
+ if (!ParseTbsCertificate(tbs_certificate_tlv,
+ DefaultParseCertificateOptions(), &tbs, nullptr)) {
return false;
}
« no previous file with comments | « net/cert/internal/parsed_certificate_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698