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> |
| 8 |
7 #include <string> | 9 #include <string> |
8 | 10 |
9 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
11 #include "crypto/secure_hash.h" | 13 #include "crypto/secure_hash.h" |
12 #include "net/base/hash_value.h" | 14 #include "net/base/hash_value.h" |
13 #include "net/cert/ct_log_verifier_util.h" | 15 #include "net/cert/ct_log_verifier_util.h" |
14 #include "net/cert/merkle_consistency_proof.h" | 16 #include "net/cert/merkle_consistency_proof.h" |
15 #include "net/cert/signed_certificate_timestamp.h" | 17 #include "net/cert/signed_certificate_timestamp.h" |
16 #include "net/cert/signed_tree_head.h" | 18 #include "net/cert/signed_tree_head.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // nodes in the proof. | 87 // nodes in the proof. |
86 {2, | 88 {2, |
87 5, | 89 5, |
88 2, | 90 2, |
89 {{"5f083f0a1a33ca076a95279832580db3e0ef4584bdff1f54c8a360f50de3031e", 32}, | 91 {{"5f083f0a1a33ca076a95279832580db3e0ef4584bdff1f54c8a360f50de3031e", 32}, |
90 {"bc1a0643b12e4d2d7c77918f44e0f4f79a838b6cf9ec5b5c283e1f4d88599e6b", 32}, | 92 {"bc1a0643b12e4d2d7c77918f44e0f4f79a838b6cf9ec5b5c283e1f4d88599e6b", 32}, |
91 {"", 0}}}}; | 93 {"", 0}}}}; |
92 | 94 |
93 // Decodes a hexadecimal string into the binary data it represents. | 95 // Decodes a hexadecimal string into the binary data it represents. |
94 std::string HexToBytes(const char* hex_data, size_t hex_data_length) { | 96 std::string HexToBytes(const char* hex_data, size_t hex_data_length) { |
95 std::vector<uint8> output; | 97 std::vector<uint8_t> output; |
96 std::string result; | 98 std::string result; |
97 std::string hex_data_input(hex_data, hex_data_length); | 99 std::string hex_data_input(hex_data, hex_data_length); |
98 if (base::HexStringToBytes(hex_data, &output)) | 100 if (base::HexStringToBytes(hex_data, &output)) |
99 result.assign(reinterpret_cast<const char*>(&output[0]), output.size()); | 101 result.assign(reinterpret_cast<const char*>(&output[0]), output.size()); |
100 return result; | 102 return result; |
101 } | 103 } |
102 | 104 |
103 std::string GetEmptyTreeHash() { | 105 std::string GetEmptyTreeHash() { |
104 return HexToBytes(kSHA256EmptyTreeHash.str, | 106 return HexToBytes(kSHA256EmptyTreeHash.str, |
105 kSHA256EmptyTreeHash.length_bytes); | 107 kSHA256EmptyTreeHash.length_bytes); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 ReferenceSnapshotConsistency(data.data(), tree_size, snapshot, true); | 479 ReferenceSnapshotConsistency(data.data(), tree_size, snapshot, true); |
478 root1 = ReferenceMerkleTreeHash(data.data(), snapshot); | 480 root1 = ReferenceMerkleTreeHash(data.data(), snapshot); |
479 VerifierConsistencyCheck(snapshot, tree_size, root1, root2, proof); | 481 VerifierConsistencyCheck(snapshot, tree_size, root1, root2, proof); |
480 } | 482 } |
481 } | 483 } |
482 } | 484 } |
483 | 485 |
484 } // namespace | 486 } // namespace |
485 | 487 |
486 } // namespace net | 488 } // namespace net |
OLD | NEW |