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

Unified Diff: net/cert/multi_threaded_cert_verifier.cc

Issue 303133006: Added net_log logging statments for CertVerifyResult (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved 'certificates' explanation to BEGIN phase comment" Created 6 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
« net/base/net_log_event_type_list.h ('K') | « net/base/net_log_event_type_list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/multi_threaded_cert_verifier.cc
diff --git a/net/cert/multi_threaded_cert_verifier.cc b/net/cert/multi_threaded_cert_verifier.cc
index f1b9bb8d1faf19c95a9b231314bebeb6528bc3fd..8f72adc90f88d6f97f8e4045dd24ff880835764b 100644
--- a/net/cert/multi_threaded_cert_verifier.cc
+++ b/net/cert/multi_threaded_cert_verifier.cc
@@ -15,6 +15,8 @@
#include "base/synchronization/lock.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
+#include "base/values.h"
+#include "net/base/hash_value.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/cert/cert_trust_anchor_provider.h"
@@ -78,6 +80,35 @@ const unsigned kMaxCacheEntries = 256;
// The number of seconds for which we'll cache a cache entry.
const unsigned kTTLSecs = 1800; // 30 minutes.
+base::Value* CertVerifyResultCallback(const CertVerifyResult& verify_result,
+ NetLog::LogLevel log_level) {
+ base::DictionaryValue* results = new base::DictionaryValue();
+ results->SetBoolean("has_md5", verify_result.has_md5);
+ results->SetBoolean("has_md2", verify_result.has_md2);
+ results->SetBoolean("has_md4", verify_result.has_md4);
+ results->SetBoolean("is_issued_by_known_root",
+ verify_result.is_issued_by_known_root);
+ results->SetBoolean("is_issued_by_additional_trust_anchor",
+ verify_result.is_issued_by_additional_trust_anchor);
+ results->SetBoolean("common_name_fallback_used",
+ verify_result.common_name_fallback_used);
+ results->SetInteger("cert_status", verify_result.cert_status);
+ results->Set(
+ "verified_cert",
+ NetLogX509CertificateCallback(verify_result.verified_cert, log_level));
+ base::ListValue* hashes = new base::ListValue();
+ for (std::vector<HashValue>::const_iterator it =
+ verify_result.public_key_hashes.begin();
+ it != verify_result.public_key_hashes.end();
+ ++it) {
+ hashes->AppendString(it->ToString());
+ }
+
+ results->Set("public_key_hashes", hashes);
wtc 2014/06/02 22:29:47 Please use blank lines to suggest that lines 99-10
+
+ return results;
+}
+
} // namespace
MultiThreadedCertVerifier::CachedResult::CachedResult() : error(ERR_FAILED) {}
@@ -351,7 +382,9 @@ class CertVerifierJob {
const MultiThreadedCertVerifier::CachedResult& verify_result,
bool is_first_job) {
worker_ = NULL;
- net_log_.EndEvent(NetLog::TYPE_CERT_VERIFIER_JOB);
+ net_log_.EndEvent(
+ NetLog::TYPE_CERT_VERIFIER_JOB,
+ base::Bind(&CertVerifyResultCallback, verify_result.result));
base::TimeDelta latency = base::TimeTicks::Now() - start_time_;
UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertVerifier_Job_Latency",
latency,
@@ -583,3 +616,4 @@ void MultiThreadedCertVerifier::OnCACertChanged(
}
} // namespace net
+
wtc 2014/06/02 22:29:47 Nit: if this line was not added by git cl format,
« net/base/net_log_event_type_list.h ('K') | « net/base/net_log_event_type_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698