| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ct_log_verifier.h" | 5 #include "net/cert/ct_log_verifier.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 new_tree_size), | 133 new_tree_size), |
| 134 old_tree_root, new_tree_root); | 134 old_tree_root, new_tree_root); |
| 135 } | 135 } |
| 136 | 136 |
| 137 class CTLogVerifierTest : public ::testing::Test { | 137 class CTLogVerifierTest : public ::testing::Test { |
| 138 public: | 138 public: |
| 139 CTLogVerifierTest() {} | 139 CTLogVerifierTest() {} |
| 140 | 140 |
| 141 void SetUp() override { | 141 void SetUp() override { |
| 142 log_ = CTLogVerifier::Create(ct::GetTestPublicKey(), "testlog", | 142 log_ = CTLogVerifier::Create(ct::GetTestPublicKey(), "testlog", |
| 143 "https://ct.example.com"); | 143 "https://ct.example.com", "ct.example.com"); |
| 144 | 144 |
| 145 ASSERT_TRUE(log_); | 145 ASSERT_TRUE(log_); |
| 146 ASSERT_EQ(log_->key_id(), ct::GetTestPublicKeyId()); | 146 ASSERT_EQ(ct::GetTestPublicKeyId(), log_->key_id()); |
| 147 ASSERT_EQ("ct.example.com", log_->domain()); |
| 147 } | 148 } |
| 148 | 149 |
| 149 // Given a consistency proof between two snapshots of the tree, asserts that | 150 // Given a consistency proof between two snapshots of the tree, asserts that |
| 150 // it verifies and no other combination of snapshots and proof nodes verifies. | 151 // it verifies and no other combination of snapshots and proof nodes verifies. |
| 151 void VerifierConsistencyCheck(int snapshot1, | 152 void VerifierConsistencyCheck(int snapshot1, |
| 152 int snapshot2, | 153 int snapshot2, |
| 153 const std::string& root1, | 154 const std::string& root1, |
| 154 const std::string& root2, | 155 const std::string& root2, |
| 155 const std::vector<std::string>& proof) { | 156 const std::vector<std::string>& proof) { |
| 156 // Verify the original consistency proof. | 157 // Verify the original consistency proof. |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 ReferenceSnapshotConsistency(data.data(), tree_size, snapshot, true); | 510 ReferenceSnapshotConsistency(data.data(), tree_size, snapshot, true); |
| 510 root1 = ReferenceMerkleTreeHash(data.data(), snapshot); | 511 root1 = ReferenceMerkleTreeHash(data.data(), snapshot); |
| 511 VerifierConsistencyCheck(snapshot, tree_size, root1, root2, proof); | 512 VerifierConsistencyCheck(snapshot, tree_size, root1, root2, proof); |
| 512 } | 513 } |
| 513 } | 514 } |
| 514 } | 515 } |
| 515 | 516 |
| 516 } // namespace | 517 } // namespace |
| 517 | 518 |
| 518 } // namespace net | 519 } // namespace net |
| OLD | NEW |