verity: add support for salting.

Salting is exposed as an optional salt=<hex> argument. The salt is appended to
hashed blocks if present, padded to 32 bytes with zero bytes.

This code is not yet used by any tools, so it should have no effect.

BUG=chromium-os:12138
TEST=Adhoc, script:12138, unittest, autotest
Build an image (I did this for Kaen) and boot it.
Run the script attached to bug 12138; if it prints 'ok', everything's good.
Check that unit test 'CreateThenVerifyOkSalt' passes.
Run platform_DMVerityBitCorruption and platform_DMVerityCorruption.

Change-Id: I3eeb17d041bcd567c0908b017e9d57a896c11cc4
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/6708
Reviewed-by: Will Drewry <wad@chromium.org>
5 files changed