Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tahoe-CHK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
PrivateStorage
Tahoe-CHK
Commits
fb1c340a
Commit
fb1c340a
authored
1 year ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
formatting
parent
240c3fe5
No related branches found
No related tags found
1 merge request
!52
Validate the crypttext hash tree and the segments
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Tahoe/CHK/Share.hs
+18
-20
18 additions, 20 deletions
src/Tahoe/CHK/Share.hs
with
18 additions
and
20 deletions
src/Tahoe/CHK/Share.hs
+
18
−
20
View file @
fb1c340a
...
...
@@ -87,22 +87,22 @@ type Crypttext = BS.ByteString
-- | Structured representation of a single CHK share.
data
Share
=
Share
{
_
block
S
ize
::
Word64
-- ^ The ZFEC
block
s
ize
. Legacy value. Unused.
,
_dataSize
::
Word64
-- ^ The share data length. Legacy value. Unused.
,
_blocks
::
[
LBS
.
ByteString
]
-- ^ The ZFEC encoded ciphertext blocks.
,
_plaintextHashTree
::
MerkleTree
BS
.
ByteString
SHA256d
-- ^ A merkle tree of plaintext segment hashes. Unimplemented.
,
_crypttextHashTree
::
M
erkle
T
ree
Crypttext
SHA256d
-- ^ A m
erkle
t
ree
of ciphertext segment hashes.
,
_blockHashTree
::
M
erkle
T
ree
BS
.
ByteString
SHA256d
-- ^ A merkle tree of hashes of `shareBlocks`.
,
_neededHashes
::
[(
ShareNum
,
Digest'
SHA256d
)]
-- ^ The information needed to complete a merkle proof for this share.
,
_uriExtension
::
URIExtension
-- ^ Additional metadata about this share.
{
-- | The ZFEC
block
s
ize
. Legacy value. Unused.
_
block
S
ize
::
Word64
,
-- | The share data length. Legacy value. Unused.
_dataSize
::
Word64
,
-- | The ZFEC encoded ciphertext blocks.
_blocks
::
[
LBS
.
ByteString
]
,
-- | A merkle tree of plaintext segment hashes. Unimplemented.
_plaintextHashTree
::
MerkleTree
BS
.
ByteString
SHA256d
,
-- | A m
erkle
t
ree
of ciphertext segment hashes.
_crypttextHashTree
::
M
erkle
T
ree
Crypttext
SHA256d
,
-- | A m
erkle
t
ree
of hashes of `shareBlocks`.
_blockHashTree
::
MerkleTree
BS
.
ByteString
SHA256d
,
-- | The information needed to complete a merkle proof for this share.
_neededHashes
::
[(
ShareNum
,
Digest'
SHA256d
)]
,
-- | Additional metadata about this share.
_uriExtension
::
URIExtension
}
deriving
(
Eq
,
Ord
,
Show
,
Generic
,
ToExpr
)
...
...
@@ -133,8 +133,7 @@ instance Binary Share where
-- much of allmydata.immutable.layout.
put
Share
{
..
}
=
let
-- shareDataSize is supposedly unused. Avoid making any
let
-- shareDataSize is supposedly unused. Avoid making any
-- calculations based on its value. We'll serialize it into
-- the output but otherwise we should ignore it. Instead,
-- we'll use this computed value that's consistent with the
...
...
@@ -198,8 +197,7 @@ instance Binary Share where
,
LBS
.
fromStrict
$
serializeNeededShares
_neededHashes
,
LBS
.
fromStrict
$
encodeWord
(
intToWord64
$
BS
.
length
ueb
)
<>
ueb
]
in
do
in
do
put
(
fromIntegral
version
::
Word32
)
mapM_
putWord
header
mapM_
putLazyByteString
_blocks
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment