| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // doesn't contain the root of snapshot1, so set have_root1 = false. | 476 // doesn't contain the root of snapshot1, so set have_root1 = false. |
| 477 subproof = ReferenceSnapshotConsistency(&inputs[split], snapshot2 - split, | 477 subproof = ReferenceSnapshotConsistency(&inputs[split], snapshot2 - split, |
| 478 snapshot1 - split, false); | 478 snapshot1 - split, false); |
| 479 proof.insert(proof.end(), subproof.begin(), subproof.end()); | 479 proof.insert(proof.end(), subproof.begin(), subproof.end()); |
| 480 // Record the hash of the left subtree (equal in both trees). | 480 // Record the hash of the left subtree (equal in both trees). |
| 481 proof.push_back(ReferenceMerkleTreeHash(&inputs[0], split)); | 481 proof.push_back(ReferenceMerkleTreeHash(&inputs[0], split)); |
| 482 } | 482 } |
| 483 return proof; | 483 return proof; |
| 484 } | 484 } |
| 485 | 485 |
| 486 // "brute-force" test generating a tree of 256 entries, generating | 486 // Times out on Win7 test bot. http://crbug.com/598406 |
| 487 // a consistency proof for each snapshot of each sub-tree up to that | 487 #if defined(OS_WIN) |
| 488 // size and making sure it verifies. | 488 #define MAYBE_VerifiesValidConsistencyProofsFromReferenceGenerator \ |
| 489 DISABLED_VerifiesValidConsistencyProofsFromReferenceGenerator |
| 490 #else |
| 491 #define MAYBE_VerifiesValidConsistencyProofsFromReferenceGenerator \ |
| 492 VerifiesValidConsistencyProofsFromReferenceGenerator |
| 493 #endif |
| 489 TEST_F(CTLogVerifierTest, | 494 TEST_F(CTLogVerifierTest, |
| 490 VerifiesValidConsistencyProofsFromReferenceGenerator) { | 495 MAYBE_VerifiesValidConsistencyProofsFromReferenceGenerator) { |
| 491 std::vector<std::string> data; | 496 std::vector<std::string> data; |
| 492 for (int i = 0; i < 256; ++i) | 497 for (int i = 0; i < 256; ++i) |
| 493 data.push_back(std::string(1, i)); | 498 data.push_back(std::string(1, i)); |
| 494 | 499 |
| 495 std::vector<std::string> proof; | 500 std::vector<std::string> proof; |
| 496 std::string root1, root2; | 501 std::string root1, root2; |
| 497 // More tests with reference proof generator. | 502 // More tests with reference proof generator. |
| 498 for (size_t tree_size = 1; tree_size <= data.size() / 2; ++tree_size) { | 503 for (size_t tree_size = 1; tree_size <= data.size() / 2; ++tree_size) { |
| 499 root2 = ReferenceMerkleTreeHash(data.data(), tree_size); | 504 root2 = ReferenceMerkleTreeHash(data.data(), tree_size); |
| 500 // Repeat for each snapshot in range. | 505 // Repeat for each snapshot in range. |
| 501 for (size_t snapshot = 1; snapshot <= tree_size; ++snapshot) { | 506 for (size_t snapshot = 1; snapshot <= tree_size; ++snapshot) { |
| 502 proof = | 507 proof = |
| 503 ReferenceSnapshotConsistency(data.data(), tree_size, snapshot, true); | 508 ReferenceSnapshotConsistency(data.data(), tree_size, snapshot, true); |
| 504 root1 = ReferenceMerkleTreeHash(data.data(), snapshot); | 509 root1 = ReferenceMerkleTreeHash(data.data(), snapshot); |
| 505 VerifierConsistencyCheck(snapshot, tree_size, root1, root2, proof); | 510 VerifierConsistencyCheck(snapshot, tree_size, root1, root2, proof); |
| 506 } | 511 } |
| 507 } | 512 } |
| 508 } | 513 } |
| 509 | 514 |
| 510 } // namespace | 515 } // namespace |
| 511 | 516 |
| 512 } // namespace net | 517 } // namespace net |
| OLD | NEW |