Skip to content

Commit 508ac53

Browse files
committed
Generalize Merkle tree requirements
The Merkle tree requirements did not allow for optimizations like those used in the rust implementation. This pr describes the properties needed, while leaving details to a POUF. It also adds a link to the rust implementation. Signed-off-by: Marina Moore <mnm678@gmail.com>
1 parent a3ce168 commit 508ac53

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

tap16.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
* TAP: 16
22
* Title: Snapshot Merkle Trees
33
* Version: 0
4-
* Last-Modified: 22/01/2021
4+
* Last-Modified: 02/04/2024
55
* Author: Marina Moore, Justin Cappos
66
* Type: Standardization
77
* Status: Draft
@@ -111,7 +111,10 @@ In addition the path should contain direction information so that the client
111111
will know whether each listed node is a left or right sibling when reconstructing the
112112
tree.
113113

114-
This information will be included in the following metadata format:
114+
While the exact format will depend on the algorithm specified in a POUF,
115+
each leaf must contain equivalent information to the version information
116+
defined for snapshot metadata. We provide an example metadata format:
117+
115118
```
116119
{ “leaf_contents”: {METAFILES},
117120
“merkle_path”: {INDEX:HASH}
@@ -123,9 +126,16 @@ Where `METAFILES` is the version information as defined for snapshot metadata,
123126
`INDEX` provides the ordering of nodes, `HASH` is the hash of the sibling node,
124127
and `DIR` indicates whether the given node is a left or right sibling.
125128

129+
Alternatively, if using a Merkle prefix tree, the hash of the `METAPATH` can
130+
be used as the location in the Merkle tree, with the version information in the
131+
node. The Merkle path and path directions can then be provided with this version
132+
information as the snapshot Merkle metadata file for each leaf.
133+
134+
## Timestamp
135+
126136
In addition, the following optional field will be added to timestamp metadata.
127137
If this field is included, the client should use snapshot Merkle metadata to
128-
verify updates instead:
138+
verify updates:
129139

130140
```
131141
("merkle_root": ROOT_HASH)
@@ -136,7 +146,7 @@ Where `ROOT_HASH` is the hash of the Merkle tree's root node.
136146
Note that snapshot Merkle metadata files do not need to be signed by a snapshot
137147
key because the path information will be verified based on the Merkle root
138148
provided in timestamp. Removing these signatures will provide additional space
139-
savings for clients.
149+
savings for clients. The timestamp metadata must still be signed.
140150

141151
Previous versions of snapshot Merkle metadata files using the current timestamp
142152
key must remain available to clients and auditors. The repository may store
@@ -149,10 +159,10 @@ If a client sees the `merkle_root` field in timestamp metadata, they will use
149159
the snapshot Merkle metadata to check version information. If this field is
150160
present, the client will download the snapshot Merkle metadata file only for
151161
the targets metadata the client is attempting to update. The client will verify the
152-
snapshot Merkle metadata file by reconstructing the Merkle tree and comparing
153-
the computed root hash to the hash provided in timestamp metadata. If the
154-
hashes do not match, the snapshot Merkle metadata is invalid. Otherwise, the
155-
client will use the version information in the verified snapshot Merkle
162+
snapshot Merkle metadata file by reconstructing the path through the Merkle tree
163+
and comparing the computed root hash to the hash provided in timestamp metadata.
164+
If the hashes do not match, the snapshot Merkle metadata is invalid. Otherwise,
165+
the client will use the version information in the verified snapshot Merkle
156166
metadata to proceed with the update.
157167

158168
For additional rollback protection, the client may download previous versions
@@ -306,8 +316,8 @@ compatibility for clients and repositories.
306316

307317
# Augmented Reference Implementation
308318

309-
https://github.com/theupdateframework/python-tuf/pull/1113/
310-
TODO: auditor implementation
319+
* https://github.com/theupdateframework/python-tuf/pull/1113/
320+
* https://github.com/znewman01/scalingsnapshots/blob/main/sssim/src/authenticator/merkle.rs
311321

312322
# Copyright
313323

0 commit comments

Comments
 (0)