(MOVED) Merged into src/platform2/verity/ now; Userspace tools for working dm-verity

Clone this repo:
  1. a47361b Run clang-format on missed files by Amin Hassani · 3 years, 10 months ago factory-zork-13427.B main master release-R86-13421.B stabilize-13421.102.B stabilize-13421.103.B stabilize-13421.42.B stabilize-13421.53.B stabilize-13421.73.B stabilize-13421.80.B stabilize-13421.89.B stabilize-13421.96.B stabilize-13421.99.B stabilize-quickfix-13421.100.B stabilize-quickfix-13421.74.B
  2. 4c1a3b7 Prepare for presubmit pass in platform2 by Amin Hassani · 3 years, 11 months ago
  3. f13b57c Replace all tabs with proper whitespace by Amin Hassani · 3 years, 11 months ago
  4. 9db041c Run clang-format by Amin Hassani · 3 years, 11 months ago
  5. 3f01ced clean up stray whitespace by Mike Frysinger · 3 years, 11 months ago


Verity is the userspace tool for creating integrity hashes for a device image.

This tool is a frontend for dm-bht, a device-mapper friendly block hash table structure. `verity' produces dm-bht-based images for use with dm-verity. The dm-verity module provides a transparent, integrity-checking layer over a given block device. This expects a backing device and a secondary device which provides cryptographic digests of the blocks on the primary device

Note, the secondary device image can be appended to the primary device or used as a standalone device.

This tool creates an image of the format:

  • [hash of hash of blocks n ... n+n-1]
  • [hash of hash of blocks 0 ... n-1]
  • [...]
  • [hash of block 1]
  • [hash of block 0]

Upon completion, the hash of the root hash will be printed to standard out. The root hash, tree depth, number of hashed blocks, and cryptographic hash algorithm used must be supplied to the dm-verity when configuring a device.


To build outside of Chromium OS:


Example Usage

To use:

./verity mode depth alg image hash_image [root_hexdigest]

For example:

dd if=/dev/zero of=/tmp/image bs=4k count=512
./verity create 2 sha256 /tmp/image /tmp/hash | tee table
# ...
cat table
ls -la /tmp/hash


All the source code is licensed GPLv2 to be completely kernel compatible. The Makefiles are from the parent project and are licensed under a BSD-style license.