Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: net/cert/merkle_audit_proof.h

Issue 2182533002: Adds a VerifyAuditProof method to CTLogVerifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update RFC6962-bis link Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698