(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 · 9 weeks ago factory-zork-13427.B firmware-zork-13421.B master release-R86-13421.B stabilize-13421.42.B stabilize-13421.53.B stabilize-13421.73.B
  2. 4c1a3b7 Prepare for presubmit pass in platform2 by Amin Hassani · 9 weeks ago
  3. f13b57c Replace all tabs with proper whitespace by Amin Hassani · 9 weeks ago
  4. 9db041c Run clang-format by Amin Hassani · 9 weeks ago
  5. 3f01ced clean up stray whitespace by Mike Frysinger · 2 months ago

Verity

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.

Building

To build outside of Chromium OS:

make

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

Licensing

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.