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

Unified Diff: net/cert/multi_log_ct_verifier.cc

Issue 2225223002: Certificate Transparency: Change CTVerifyResult to have a single list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NetLog int to string Created 4 years, 4 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/ct_verify_result.cc ('k') | net/cert/multi_log_ct_verifier_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/multi_log_ct_verifier.cc
diff --git a/net/cert/multi_log_ct_verifier.cc b/net/cert/multi_log_ct_verifier.cc
index d3ff7375a9c8292b1c6c60d3dcb6eed09b0b65d6..8cba5b043ee64176926e4ebb4d04682996909233 100644
--- a/net/cert/multi_log_ct_verifier.cc
+++ b/net/cert/multi_log_ct_verifier.cc
@@ -46,12 +46,14 @@ void LogSCTOriginToUMA(ct::SignedCertificateTimestamp::Origin origin) {
// * When SCTs are available, how many are available per connection.
void LogNumSCTsToUMA(const ct::CTVerifyResult& result) {
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.CertificateTransparency.SCTsPerConnection",
- result.invalid_scts.size() +
- result.verified_scts.size() +
- result.unknown_logs_scts.size(),
- 1,
- 10,
- 11);
+ result.scts.size(), 1, 10, 11);
+}
+
+void AddSCTAndLogStatus(scoped_refptr<ct::SignedCertificateTimestamp> sct,
+ ct::SCTVerifyStatus status,
+ SignedCertificateTimestampAndStatusList* sct_list) {
+ LogSCTStatusToUMA(status);
+ sct_list->push_back(SignedCertificateTimestampAndStatus(sct, status));
}
} // namespace
@@ -82,9 +84,7 @@ int MultiLogCTVerifier::Verify(
DCHECK(cert);
DCHECK(result);
- result->verified_scts.clear();
- result->invalid_scts.clear();
- result->unknown_logs_scts.clear();
+ result->scts.clear();
bool has_verified_scts = false;
@@ -191,8 +191,7 @@ bool MultiLogCTVerifier::VerifySingleSCT(
const auto& it = logs_.find(sct->log_id);
if (it == logs_.end()) {
DVLOG(1) << "SCT does not match any known log.";
- result->unknown_logs_scts.push_back(sct);
- LogSCTStatusToUMA(ct::SCT_STATUS_LOG_UNKNOWN);
+ AddSCTAndLogStatus(sct, ct::SCT_STATUS_LOG_UNKNOWN, &(result->scts));
return false;
}
@@ -200,21 +199,18 @@ bool MultiLogCTVerifier::VerifySingleSCT(
if (!it->second->Verify(expected_entry, *sct.get())) {
DVLOG(1) << "Unable to verify SCT signature.";
- result->invalid_scts.push_back(sct);
- LogSCTStatusToUMA(ct::SCT_STATUS_INVALID);
+ AddSCTAndLogStatus(sct, ct::SCT_STATUS_INVALID, &(result->scts));
return false;
}
// SCT verified ok, just make sure the timestamp is legitimate.
if (sct->timestamp > base::Time::Now()) {
DVLOG(1) << "SCT is from the future!";
- result->invalid_scts.push_back(sct);
- LogSCTStatusToUMA(ct::SCT_STATUS_INVALID);
+ AddSCTAndLogStatus(sct, ct::SCT_STATUS_INVALID, &(result->scts));
return false;
}
- LogSCTStatusToUMA(ct::SCT_STATUS_OK);
- result->verified_scts.push_back(sct);
+ AddSCTAndLogStatus(sct, ct::SCT_STATUS_OK, &(result->scts));
if (observer_)
observer_->OnSCTVerified(cert, sct.get());
return true;
« no previous file with comments | « net/cert/ct_verify_result.cc ('k') | net/cert/multi_log_ct_verifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698