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

Side by Side Diff: net/cert/cert_policy_enforcer.cc

Issue 985993003: Certificate Transparency: Add UMA for whitelist status (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct use of the macro Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/cert_policy_enforcer.h" 5 #include "net/cert/cert_policy_enforcer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/build_time.h" 10 #include "base/build_time.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 case CT_ENOUGH_SCTS: 119 case CT_ENOUGH_SCTS:
120 return "ENOUGH_SCTS"; 120 return "ENOUGH_SCTS";
121 break; 121 break;
122 case CT_COMPLIANCE_MAX: 122 case CT_COMPLIANCE_MAX:
123 break; 123 break;
124 } 124 }
125 125
126 return "unknown"; 126 return "unknown";
127 } 127 }
128 128
129 void LogCTComplianceStatusToUMA(CTComplianceStatus status) { 129 enum EVWhitelistStatus {
130 EV_WHITELIST_NOT_PRESENT = 0,
131 EV_WHITELIST_INVALID = 1,
132 EV_WHITELIST_VALID = 2,
133 EV_WHITELIST_MAX,
134 };
135
136 void LogCTComplianceStatusToUMA(CTComplianceStatus status,
137 const ct::EVCertsWhitelist* ev_whitelist) {
130 UMA_HISTOGRAM_ENUMERATION("Net.SSL_EVCertificateCTCompliance", status, 138 UMA_HISTOGRAM_ENUMERATION("Net.SSL_EVCertificateCTCompliance", status,
131 CT_COMPLIANCE_MAX); 139 CT_COMPLIANCE_MAX);
140 if (status == CT_NOT_COMPLIANT) {
141 EVWhitelistStatus ev_whitelist_status = EV_WHITELIST_NOT_PRESENT;
142 if (ev_whitelist != NULL) {
143 if (ev_whitelist->IsValid())
144 ev_whitelist_status = EV_WHITELIST_VALID;
145 else
146 ev_whitelist_status = EV_WHITELIST_INVALID;
147 }
148
149 UMA_HISTOGRAM_ENUMERATION("Net.SSL_EVWhitelistValidityForNonCompliantCert",
150 ev_whitelist_status, EV_WHITELIST_MAX);
151 }
132 } 152 }
133 153
134 struct ComplianceDetails { 154 struct ComplianceDetails {
135 ComplianceDetails() 155 ComplianceDetails()
136 : ct_presence_required(false), 156 : ct_presence_required(false),
137 build_timely(false), 157 build_timely(false),
138 status(CT_NOT_COMPLIANT) {} 158 status(CT_NOT_COMPLIANT) {}
139 159
140 // Whether enforcement of the policy was required or not. 160 // Whether enforcement of the policy was required or not.
141 bool ct_presence_required; 161 bool ct_presence_required;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 257
238 net_log.AddEvent(NetLog::TYPE_EV_CERT_CT_COMPLIANCE_CHECKED, 258 net_log.AddEvent(NetLog::TYPE_EV_CERT_CT_COMPLIANCE_CHECKED,
239 net_log_callback); 259 net_log_callback);
240 260
241 if (!details.ct_presence_required) 261 if (!details.ct_presence_required)
242 return true; 262 return true;
243 263
244 if (!details.build_timely) 264 if (!details.build_timely)
245 return false; 265 return false;
246 266
247 LogCTComplianceStatusToUMA(details.status); 267 LogCTComplianceStatusToUMA(details.status, ev_whitelist);
248 268
249 if (details.status == CT_IN_WHITELIST || details.status == CT_ENOUGH_SCTS) 269 if (details.status == CT_IN_WHITELIST || details.status == CT_ENOUGH_SCTS)
250 return true; 270 return true;
251 271
252 return false; 272 return false;
253 } 273 }
254 274
255 } // namespace net 275 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698