Index: net/cert/signed_tree_head.h |
diff --git a/net/cert/signed_tree_head.h b/net/cert/signed_tree_head.h |
index fdbcdc48499c4f439cac0471ffe32be81fe41295..8eae3a21aa0c74cc33a0c59b8354682f5e25b979 100644 |
--- a/net/cert/signed_tree_head.h |
+++ b/net/cert/signed_tree_head.h |
@@ -5,6 +5,7 @@ |
#ifndef NET_CERT_SIGNED_TREE_HEAD_H_ |
#define NET_CERT_SIGNED_TREE_HEAD_H_ |
+#include <ostream> |
#include <string> |
#include <vector> |
@@ -26,15 +27,39 @@ struct NET_EXPORT SignedTreeHead { |
// RFC6962-bis to use separate versions, so using a separate scheme here. |
enum Version { V1 = 0, }; |
+ SignedTreeHead(); |
+ SignedTreeHead(Version version, |
+ const base::Time& timestamp, |
+ uint64_t tree_size, |
+ const char sha256_root_hash[kSthRootHashLength], |
+ const DigitallySigned& signature, |
+ const std::string& log_id); |
+ ~SignedTreeHead(); |
+ |
Version version; |
base::Time timestamp; |
uint64_t tree_size; |
char sha256_root_hash[kSthRootHashLength]; |
DigitallySigned signature; |
+ |
+ // Added in RFC6962-bis, Appendix A |
+ std::string log_id; |
}; |
+// Two STHs are considered equal if they are from the same log and have matching |
+// timestamps, since RFC6962 forbids a log from issuing two different STHs with |
+// the same timestamp. |
+NET_EXPORT bool operator==(const SignedTreeHead& sth1, |
+ const SignedTreeHead& sth2); |
+NET_EXPORT bool operator!=(const SignedTreeHead& sth1, |
+ const SignedTreeHead& sth2); |
+ |
+NET_EXPORT std::ostream& operator<<(std::ostream& stream, |
+ const SignedTreeHead& sth); |
+ |
} // namespace ct |
} // namespace net |
-#endif |
+#endif // NET_CERT_SIGNED_TREE_HEAD_H_ |
+ |