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(); |
Ryan Sleevi
2016/08/25 18:56:24
FUTURE CL: Should we still have this ctor? Would i
Rob Percival
2016/10/03 17:39:26
LogDnsClient currently makes use of it, as it popu
| |
28 MerkleAuditProof(uint64_t leaf_index, | 28 MerkleAuditProof(uint64_t leaf_index, |
29 uint64_t tree_size, | |
29 const std::vector<std::string>& audit_path); | 30 const std::vector<std::string>& audit_path); |
30 ~MerkleAuditProof(); | 31 ~MerkleAuditProof(); |
31 | 32 |
32 // Index of the tree leaf in the log. | 33 // Index of the tree leaf in the log. |
33 uint64_t leaf_index = 0; | 34 uint64_t leaf_index = 0; |
34 | 35 |
36 // Number of leaves in the log's tree. | |
37 uint64_t tree_size = 0; | |
38 | |
35 // Audit path nodes. | 39 // Audit path nodes. |
36 std::vector<std::string> nodes; | 40 std::vector<std::string> nodes; |
37 }; | 41 }; |
38 | 42 |
39 } // namespace ct | 43 } // namespace ct |
40 } // namespace net | 44 } // namespace net |
41 | 45 |
42 #endif // NET_CERT_MERKLE_AUDIT_PROOF_H_ | 46 #endif // NET_CERT_MERKLE_AUDIT_PROOF_H_ |
OLD | NEW |