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

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

Issue 1968053002: Certificate Transparency: Notify STH Observers of known STHs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final operator, test changes 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 | « 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 27 matching lines...) Expand all
38 << "\t\"version\": " << sth.version << ",\n" 38 << "\t\"version\": " << sth.version << ",\n"
39 << "\t\"timestamp\": " << sth.timestamp << ",\n" 39 << "\t\"timestamp\": " << sth.timestamp << ",\n"
40 << "\t\"tree_size\": " << sth.tree_size << ",\n" 40 << "\t\"tree_size\": " << sth.tree_size << ",\n"
41 << "\t\"sha256_root_hash\": \"" 41 << "\t\"sha256_root_hash\": \""
42 << base::HexEncode(sth.sha256_root_hash, kSthRootHashLength) 42 << base::HexEncode(sth.sha256_root_hash, kSthRootHashLength)
43 << "\",\n\t\"log_id\": \"" 43 << "\",\n\t\"log_id\": \""
44 << base::HexEncode(sth.log_id.data(), sth.log_id.size()) << "\"\n" 44 << base::HexEncode(sth.log_id.data(), sth.log_id.size()) << "\"\n"
45 << "}"; 45 << "}";
46 } 46 }
47 47
48 bool operator==(const SignedTreeHead& lhs, const SignedTreeHead& rhs) {
49 return std::tie(lhs.version, lhs.timestamp, lhs.tree_size, lhs.log_id) ==
50 std::tie(rhs.version, rhs.timestamp, rhs.tree_size, rhs.log_id) &&
51 memcmp(lhs.sha256_root_hash, rhs.sha256_root_hash,
52 kSthRootHashLength) == 0 &&
53 lhs.signature.SignatureParametersMatch(
54 rhs.signature.hash_algorithm, rhs.signature.signature_algorithm) &&
55 lhs.signature.signature_data == rhs.signature.signature_data;
56 }
57
58 bool operator!=(const SignedTreeHead& lhs, const SignedTreeHead& rhs) {
59 return !(lhs == rhs);
60 }
61
48 } // namespace ct 62 } // namespace ct
49 } // namespace net 63 } // 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