tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BTTypes.h (1661B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef BTTypes_h
      8 #define BTTypes_h
      9 
     10 #include <vector>
     11 
     12 #include "Buffer.h"
     13 
     14 namespace mozilla {
     15 namespace ct {
     16 
     17 // Represents a Merkle inclusion proof for purposes of serialization,
     18 // deserialization, and verification of the proof.  The format for inclusion
     19 // proofs in RFC 6962-bis is as follows:
     20 //
     21 //    opaque LogID<2..127>;
     22 //    opaque NodeHash<32..2^8-1>;
     23 //
     24 //     struct {
     25 //         LogID log_id;
     26 //         uint64 tree_size;
     27 //         uint64 leaf_index;
     28 //         NodeHash inclusion_path<1..2^16-1>;
     29 //     } InclusionProofDataV2;
     30 
     31 struct InclusionProofDataV2 {
     32  Buffer logId;
     33  uint64_t treeSize;
     34  uint64_t leafIndex;
     35  std::vector<Buffer> inclusionPath;
     36 };
     37 
     38 // Represents a Signed Tree Head as per RFC 6962-bis. All extensions are
     39 // ignored. The signature field covers the data in the tree_head field.
     40 //
     41 //     struct {
     42 //         LogID log_id;
     43 //         TreeHeadDataV2 tree_head;
     44 //         opaque signature<0..2^16-1>;
     45 //     } SignedTreeHeadDataV2;
     46 //
     47 //     struct {
     48 //         uint64 timestamp;
     49 //         uint64 tree_size;
     50 //         NodeHash root_hash;
     51 //         Extension sth_extensions<0..2^16-1>;
     52 //     } TreeHeadDataV2;
     53 
     54 struct SignedTreeHeadDataV2 {
     55  Buffer logId;
     56  uint64_t timestamp;
     57  uint64_t treeSize;
     58  Buffer rootHash;
     59 };
     60 
     61 }  // namespace ct
     62 }  // namespace mozilla
     63 
     64 #endif  // BTTypes_h