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

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: Further unit test improvements 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
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 lhs.version == rhs.version && lhs.timestamp == rhs.timestamp &&
50 lhs.tree_size == rhs.tree_size && lhs.log_id == rhs.log_id &&
Ryan Sleevi 2016/05/17 22:20:16 fwiw, you could use return std::tie(lhs.version,
Eran Messeri 2016/05/18 10:37:20 Done - switched to using std::tie and removed the
51 (memcmp(lhs.sha256_root_hash, rhs.sha256_root_hash,
52 kSthRootHashLength) == 0) &&
53 (lhs.signature.SignatureParametersMatch(
54 rhs.signature.hash_algorithm,
55 rhs.signature.signature_algorithm)) &&
56 lhs.signature.signature_data == rhs.signature.signature_data;
57 }
58
59 bool operator!=(const SignedTreeHead& lhs, const SignedTreeHead& rhs) {
60 return !operator==(lhs, rhs);
Ryan Sleevi 2016/05/17 22:20:16 !(lhs == rhs) No need to directly invoke operator
Eran Messeri 2016/05/18 10:37:20 Done.
61 }
62
48 } // namespace ct 63 } // namespace ct
49 } // namespace net 64 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698