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

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: 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..18164463fec92f18db0afa5a54eb412c023e56ba 100644
--- a/net/cert/signed_tree_head.cc
+++ b/net/cert/signed_tree_head.cc
@@ -45,5 +45,19 @@ void PrintTo(const SignedTreeHead& sth, std::ostream* os) {
<< "}";
}
+bool operator==(const SignedTreeHead& lhs, const SignedTreeHead& rhs) {
+ return std::tie(lhs.version, lhs.timestamp, lhs.tree_size, lhs.log_id) ==
+ std::tie(rhs.version, rhs.timestamp, rhs.tree_size, rhs.log_id) &&
+ 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 !(lhs == rhs);
+}
+
} // namespace ct
} // namespace net
« 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