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 #ifndef NET_CERT_MERKLE_AUDIT_PROOF_H_ | 5 #ifndef NET_CERT_MERKLE_AUDIT_PROOF_H_ |
6 #define NET_CERT_MERKLE_AUDIT_PROOF_H_ | 6 #define NET_CERT_MERKLE_AUDIT_PROOF_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 namespace ct { | 17 namespace ct { |
18 | 18 |
19 // Returns the length of the audit path for a leaf at |leaf_index| in a Merkle | 19 // Returns the length of the audit path for a leaf at |leaf_index| in a Merkle |
20 // tree containing |tree_size| leaves. | 20 // tree containing |tree_size| leaves. |
21 // The |leaf_index| must be less than the |tree_size|. | 21 // The |leaf_index| must be less than the |tree_size|. |
22 NET_EXPORT uint64_t CalculateAuditPathLength(uint64_t leaf_index, | 22 NET_EXPORT uint64_t CalculateAuditPathLength(uint64_t leaf_index, |
23 uint64_t tree_size); | 23 uint64_t tree_size); |
24 | 24 |
25 // Audit proof for a Merkle tree leaf, as defined in section 2.1.1. of RFC6962. | 25 // Audit proof for a Merkle tree leaf, as defined in section 2.1.1. of RFC6962. |
26 struct NET_EXPORT MerkleAuditProof { | 26 struct NET_EXPORT MerkleAuditProof { |
27 MerkleAuditProof(); | 27 MerkleAuditProof(); |
28 MerkleAuditProof(const std::string& log_id, | 28 MerkleAuditProof(uint64_t leaf_index, |
29 uint64_t leaf_index, | |
30 const std::vector<std::string>& audit_path); | 29 const std::vector<std::string>& audit_path); |
31 ~MerkleAuditProof(); | 30 ~MerkleAuditProof(); |
32 | 31 |
33 // The origin of this proof. | |
34 std::string log_id; | |
35 | |
36 // Index of the tree leaf in the log. | 32 // Index of the tree leaf in the log. |
37 uint64_t leaf_index = 0; | 33 uint64_t leaf_index = 0; |
38 | 34 |
39 // Audit path nodes. | 35 // Audit path nodes. |
40 std::vector<std::string> nodes; | 36 std::vector<std::string> nodes; |
41 }; | 37 }; |
42 | 38 |
43 } // namespace ct | 39 } // namespace ct |
44 } // namespace net | 40 } // namespace net |
45 | 41 |
46 #endif // NET_CERT_MERKLE_AUDIT_PROOF_H_ | 42 #endif // NET_CERT_MERKLE_AUDIT_PROOF_H_ |
OLD | NEW |