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

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

Issue 1950463002: Certificate Transparency: Fix Pilot log ID comparison. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/sth_distributor.h" 5 #include "net/cert/sth_distributor.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "net/cert/signed_tree_head.h" 9 #include "net/cert/signed_tree_head.h"
10 10
11 namespace { 11 namespace {
12 const char kPilotLogID[33] = 12 const char kPilotLogID[33] =
13 "\xa4\xb9\x09\x90\xb4\x18\x58\x14\x87\xbb\x13\xa2\xcc\x67\x70\x0a\x3c\x35" 13 "\xa4\xb9\x09\x90\xb4\x18\x58\x14\x87\xbb\x13\xa2\xcc\x67\x70\x0a\x3c\x35"
14 "\x98\x04\xf9\x1b\xdf\xb8\xe3\x77\xcd\x0e\xc8\x0d\xdc\x10"; 14 "\x98\x04\xf9\x1b\xdf\xb8\xe3\x77\xcd\x0e\xc8\x0d\xdc\x10";
15 } 15 }
16 16
17 namespace net { 17 namespace net {
18 18
19 namespace ct { 19 namespace ct {
20 20
21 STHDistributor::STHDistributor() 21 STHDistributor::STHDistributor()
22 : observer_list_(base::ObserverList<STHObserver>::NOTIFY_EXISTING_ONLY) {} 22 : observer_list_(base::ObserverList<STHObserver>::NOTIFY_EXISTING_ONLY) {}
23 23
24 STHDistributor::~STHDistributor() {} 24 STHDistributor::~STHDistributor() {}
25 25
26 void STHDistributor::NewSTHObserved(const SignedTreeHead& sth) { 26 void STHDistributor::NewSTHObserved(const SignedTreeHead& sth) {
27 FOR_EACH_OBSERVER(STHObserver, observer_list_, NewSTHObserved(sth)); 27 FOR_EACH_OBSERVER(STHObserver, observer_list_, NewSTHObserved(sth));
28 28
29 if (sth.log_id.compare(0, sth.log_id.size(), kPilotLogID, 29 if (sth.log_id.compare(0, sth.log_id.size(), kPilotLogID,
30 arraysize(kPilotLogID)) != 0) 30 arraysize(kPilotLogID) - 1) != 0)
31 return; 31 return;
32 32
33 const base::TimeDelta sth_age = base::Time::Now() - sth.timestamp; 33 const base::TimeDelta sth_age = base::Time::Now() - sth.timestamp;
34 UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertificateTransparency.PilotSTHAge", sth_age, 34 UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertificateTransparency.PilotSTHAge", sth_age,
35 base::TimeDelta::FromHours(1), 35 base::TimeDelta::FromHours(1),
36 base::TimeDelta::FromDays(4), 100); 36 base::TimeDelta::FromDays(4), 100);
37 } 37 }
38 38
39 void STHDistributor::RegisterObserver(STHObserver* observer) { 39 void STHDistributor::RegisterObserver(STHObserver* observer) {
40 observer_list_.AddObserver(observer); 40 observer_list_.AddObserver(observer);
41 } 41 }
42 42
43 void STHDistributor::UnregisterObserver(STHObserver* observer) { 43 void STHDistributor::UnregisterObserver(STHObserver* observer) {
44 observer_list_.RemoveObserver(observer); 44 observer_list_.RemoveObserver(observer);
45 } 45 }
46 46
47 } // namespace ct 47 } // namespace ct
48 48
49 } // namespace net 49 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698