Replace all tabs with proper whitespace

This change removes all tabs and replaces them with proper whitespaces
for everywhere that the previous clang-format could not fix. This is
done manually without any automatic tools.

Also replaces the LICENSE file to [1] which has a better formatting.

[1] - https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

BUG=chromium:886953
TEST=repo upload passes
TEST=CQ passes

Change-Id: I329d332e8bf40ba757df5bd86e1cc1192d71bbb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dm-verity/+/2353061
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
3 files changed
tree: ddd0a033cd74036cd70cf11c3c93e7989b8f247a
  1. include/
  2. kernel/
  3. logging/
  4. simple_file/
  5. .gitignore
  6. common.mk
  7. dm-bht-userspace.c
  8. dm-bht-userspace.h
  9. dm-bht.c
  10. dm-bht.h
  11. dm-bht_unittest.cc
  12. file_hasher.cc
  13. file_hasher.h
  14. file_hasher_unittest.cc
  15. LICENSE
  16. LICENSE.makefile
  17. logging.h
  18. Makefile
  19. OWNERS
  20. PRESUBMIT.cfg
  21. README.md
  22. utils.cc
  23. utils.h
  24. verity_main.cc
  25. verity_testrunner.cc
README.md

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.