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

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

Issue 2004843002: Adds a MerkleAuditProof struct to net/cert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/cert/merkle_audit_proof.h"
6
7 namespace net {
8 namespace ct {
9
10 uint64_t CalculateAuditPathLength(uint64_t leaf_index, uint64_t tree_size) {
11 // As described in RFC6962, section 4.5
Eran Messeri 2016/05/23 13:10:51 The length calculation is not described in this se
Rob Percival 2016/05/24 17:10:04 Fixed to point to the CT over DNS draft RFC.
12 uint64_t length = 0;
13 uint64_t ln = tree_size - 1;
Eran Messeri 2016/05/23 13:10:51 Can you think of more informative names to describ
Rob Percival 2016/05/24 17:10:04 Done.
14 uint64_t li = leaf_index;
15
16 while (ln != 0) {
17 if ((li & 1) || li < ln)
Eran Messeri 2016/05/23 13:10:51 (1) Better documentation (copy from the DNS I-D if
Rob Percival 2016/05/24 17:10:04 1. The DNS I-D doesn't really document this, it ju
18 ++length;
19 li >>= 1;
20 ln >>= 1;
21 }
22
23 return length;
24 }
25
26 MerkleAuditProof::MerkleAuditProof() {}
27
28 MerkleAuditProof::MerkleAuditProof(const std::string& log_id,
29 uint64_t leaf_index,
30 const std::vector<std::string>& audit_path)
31 : log_id(log_id), leaf_index(leaf_index), nodes(audit_path) {}
32
33 MerkleAuditProof::~MerkleAuditProof() {}
34
35 } // namespace ct
36 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698