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

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

Issue 1923433002: Certificate path builder for new certificate verification library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes for review comment #20 Created 4 years, 6 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.h ('k') | net/cert/internal/verify_certificate_chain.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/trust_store.cc
diff --git a/net/cert/internal/trust_store.cc b/net/cert/internal/trust_store.cc
index 892698ba5f6928fd3a64929a739c630bf64dac25..d46933b14e4c33dbd905788beb3fde7f2c137c89 100644
--- a/net/cert/internal/trust_store.cc
+++ b/net/cert/internal/trust_store.cc
@@ -4,8 +4,6 @@
#include "net/cert/internal/trust_store.h"
-#include "net/cert/internal/parsed_certificate.h"
-
namespace net {
TrustStore::TrustStore() {}
@@ -24,7 +22,7 @@ void TrustStore::AddTrustedCertificate(
void TrustStore::FindTrustAnchorsByNormalizedName(
const der::Input& normalized_name,
- std::vector<scoped_refptr<ParsedCertificate>>* matches) const {
+ ParsedCertificateList* matches) const {
auto range = anchors_.equal_range(normalized_name.AsStringPiece());
for (auto it = range.first; it != range.second; ++it)
matches->push_back(it->second);
@@ -33,9 +31,13 @@ void TrustStore::FindTrustAnchorsByNormalizedName(
bool TrustStore::IsTrustedCertificate(const ParsedCertificate* cert) const {
auto range = anchors_.equal_range(cert->normalized_subject().AsStringPiece());
for (auto it = range.first; it != range.second; ++it) {
- // First compare the ParsedCertificate pointers as an optimization, fall
- // back to comparing full DER encoding.
- if (it->second == cert || it->second->der_cert() == cert->der_cert())
+ // First compare the ParsedCertificate pointers as an optimization.
+ if (it->second == cert ||
+ // Trust check is based on Name+SPKI match. This could match the same
+ // certificate stored in a different ParsedCertificate object, or a
+ // different cert that has the same Name+SPKI.
+ (it->second->normalized_subject() == cert->normalized_subject() &&
+ it->second->tbs().spki_tlv == cert->tbs().spki_tlv))
return true;
}
return false;
« no previous file with comments | « net/cert/internal/trust_store.h ('k') | net/cert/internal/verify_certificate_chain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698