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

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

Issue 1845113003: Certificate Transparency: Start tracking logs' state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « net/cert/signed_tree_head.h ('k') | net/cert/sth_distributor.h » ('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 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/signed_tree_head.h" 5 #include "net/cert/signed_tree_head.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <ostream> 9 #include <ostream>
10 10
(...skipping 15 matching lines...) Expand all
26 tree_size(tree_size), 26 tree_size(tree_size),
27 signature(signature), 27 signature(signature),
28 log_id(log_id) { 28 log_id(log_id) {
29 memcpy(this->sha256_root_hash, sha256_root_hash, kSthRootHashLength); 29 memcpy(this->sha256_root_hash, sha256_root_hash, kSthRootHashLength);
30 } 30 }
31 31
32 SignedTreeHead::SignedTreeHead(const SignedTreeHead& other) = default; 32 SignedTreeHead::SignedTreeHead(const SignedTreeHead& other) = default;
33 33
34 SignedTreeHead::~SignedTreeHead() {} 34 SignedTreeHead::~SignedTreeHead() {}
35 35
36 bool operator==(const SignedTreeHead& sth1, const SignedTreeHead& sth2) {
37 return sth1.log_id == sth2.log_id && sth1.timestamp == sth2.timestamp;
38 }
39
40 bool operator!=(const SignedTreeHead& sth1, const SignedTreeHead& sth2) {
41 return !(sth1 == sth2);
42 }
43
36 void PrintTo(const SignedTreeHead& sth, std::ostream* os) { 44 void PrintTo(const SignedTreeHead& sth, std::ostream* os) {
37 (*os) << "{\n" 45 (*os) << "{\n"
38 << "\t\"version\": " << sth.version << ",\n" 46 << "\t\"version\": " << sth.version << ",\n"
39 << "\t\"timestamp\": " << sth.timestamp << ",\n" 47 << "\t\"timestamp\": " << sth.timestamp << ",\n"
40 << "\t\"tree_size\": " << sth.tree_size << ",\n" 48 << "\t\"tree_size\": " << sth.tree_size << ",\n"
41 << "\t\"sha256_root_hash\": \"" 49 << "\t\"sha256_root_hash\": \""
42 << base::HexEncode(sth.sha256_root_hash, kSthRootHashLength) 50 << base::HexEncode(sth.sha256_root_hash, kSthRootHashLength)
43 << "\",\n\t\"log_id\": \"" 51 << "\",\n\t\"log_id\": \""
44 << base::HexEncode(sth.log_id.data(), sth.log_id.size()) << "\"\n" 52 << base::HexEncode(sth.log_id.data(), sth.log_id.size()) << "\"\n"
45 << "}"; 53 << "}";
46 } 54 }
47 55
48 } // namespace ct 56 } // namespace ct
49 } // namespace net 57 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/signed_tree_head.h ('k') | net/cert/sth_distributor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698