| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |