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

Unified Diff: net/cert/internal/verify_certificate_chain_pkits_unittest.cc

Issue 2327973002: Add CertErrors* parameter to the main Certificate parsing functions. (Closed)
Patch Set: StringPiece is kind of dangerous... Created 4 years, 3 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/trust_store_nss.cc ('k') | net/cert/x509_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/verify_certificate_chain_pkits_unittest.cc
diff --git a/net/cert/internal/verify_certificate_chain_pkits_unittest.cc b/net/cert/internal/verify_certificate_chain_pkits_unittest.cc
index 676aa288a8f45279c5bff33dd27d63f61ef4bac7..9bdb8502cd853c522d73a8fdaa8a870ead91df46 100644
--- a/net/cert/internal/verify_certificate_chain_pkits_unittest.cc
+++ b/net/cert/internal/verify_certificate_chain_pkits_unittest.cc
@@ -56,12 +56,11 @@ class VerifyCertificateChainPkitsTestDelegate {
// PKITS lists chains from trust anchor to target, VerifyCertificateChain
// takes them starting with the target and not including the trust anchor.
std::vector<scoped_refptr<net::ParsedCertificate>> input_chain;
+ CertErrors errors;
for (auto i = cert_ders.rbegin(); i != cert_ders.rend(); ++i) {
- if (!net::ParsedCertificate::CreateAndAddToVector(
- reinterpret_cast<const uint8_t*>(i->data()), i->size(),
- net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, {},
- &input_chain)) {
- ADD_FAILURE() << "cert failed to parse";
+ if (!net::ParsedCertificate::CreateAndAddToVector(*i, {}, &input_chain,
+ &errors)) {
+ ADD_FAILURE() << "Cert failed to parse:\n" << errors.ToDebugString();
return false;
}
}
@@ -76,7 +75,6 @@ class VerifyCertificateChainPkitsTestDelegate {
der::GeneralizedTime time = {2011, 4, 15, 0, 0, 0};
// TODO(crbug.com/634443): Test errors on failure?
- CertErrors errors;
return VerifyCertificateChain(input_chain, trust_anchor.get(),
&signature_policy, time, &errors);
}
« no previous file with comments | « net/cert/internal/trust_store_nss.cc ('k') | net/cert/x509_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698