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

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

Issue 1573243011: Refactor der::Input helper methods into new constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 11 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/test_helpers.cc ('k') | net/cert/internal/verify_certificate_chain_unittest.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.cc
diff --git a/net/cert/internal/verify_certificate_chain.cc b/net/cert/internal/verify_certificate_chain.cc
index 4c15fa6d31375ff6117346828059849cbf8afdbf..524de925d3e2ce4036c91f3c4e63b82898eb4637 100644
--- a/net/cert/internal/verify_certificate_chain.cc
+++ b/net/cert/internal/verify_certificate_chain.cc
@@ -17,11 +17,6 @@ namespace net {
namespace {
-// TODO(eroman): Move into net/der (duplicated from test_helpers.cc).
-static der::Input InputFromString(const std::string* s) {
- return der::Input(reinterpret_cast<const uint8_t*>(s->data()), s->size());
-}
-
// Map from OID to ParsedExtension.
using ExtensionsMap = std::map<der::Input, ParsedExtension>;
@@ -177,7 +172,7 @@ WARN_UNUSED_RESULT const TrustAnchor* FindTrustAnchorByName(
const TrustStore& trust_store,
const der::Input& name) {
for (const auto& anchor : trust_store.anchors) {
- if (NameMatches(name, InputFromString(&anchor.name)))
+ if (NameMatches(name, der::Input(&anchor.name)))
return &anchor;
}
return nullptr;
@@ -519,8 +514,8 @@ bool VerifyCertificateChain(const std::vector<der::Input>& certs_der,
FindTrustAnchorByName(trust_store, cert.tbs.issuer_tlv);
if (!trust_anchor)
return false;
- working_spki = InputFromString(&trust_anchor->spki);
- working_issuer_name = InputFromString(&trust_anchor->name);
+ working_spki = der::Input(&trust_anchor->spki);
+ working_issuer_name = der::Input(&trust_anchor->name);
}
// Per RFC 5280 section 6.1:
« no previous file with comments | « net/cert/internal/test_helpers.cc ('k') | net/cert/internal/verify_certificate_chain_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698