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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: net/cert/signed_tree_head.cc
diff --git a/net/cert/signed_tree_head.cc b/net/cert/signed_tree_head.cc
index 8bf2b9f3ff7755fae4e6082f1f7528fbd166dafe..8ae617680a95db1ddb16561114241875e006a73d 100644
--- a/net/cert/signed_tree_head.cc
+++ b/net/cert/signed_tree_head.cc
@@ -45,5 +45,20 @@ void PrintTo(const SignedTreeHead& sth, std::ostream* os) {
<< "}";
}
+bool operator==(const SignedTreeHead& lhs, const SignedTreeHead& rhs) {
+ return lhs.version == rhs.version && lhs.timestamp == rhs.timestamp &&
+ 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
+ (memcmp(lhs.sha256_root_hash, rhs.sha256_root_hash,
+ kSthRootHashLength) == 0) &&
+ (lhs.signature.SignatureParametersMatch(
+ rhs.signature.hash_algorithm,
+ rhs.signature.signature_algorithm)) &&
+ lhs.signature.signature_data == rhs.signature.signature_data;
+}
+
+bool operator!=(const SignedTreeHead& lhs, const SignedTreeHead& rhs) {
+ 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.
+}
+
} // namespace ct
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698