verity: remove compare_hash layer
We've refactored the code such that we are now only calling compare_hash
into two places in the same function. So we really don't need this layer
any more.
I plan to send a CL soonish that will remove the second call so we'll
be down to just the one call.
BUG=chromium-os:13872
TEST=Ran dm-verity.git unit tests. Ran platform_DMVerityCorruption on H/W.
Change-Id: Ieb20dfdcf425a3c423ebabf63f86d549c259c0f8
kernel-next.git Review URL: http://codereview.chromium.org/6902084
TBRing. Already LGTMed and committed to kernel-next.git.
TBR=wad@chromium.org,taysom@chromium.org
diff --git a/dm-bht.c b/dm-bht.c
index d254160..7467455 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -523,11 +523,6 @@
}
-static int dm_bht_compare_hash(struct dm_bht *bht, u8 *known, u8 *computed)
-{
- return memcmp(known, computed, bht->digest_size);
-}
-
/* dm_bht_verify_path
* Verifies the path. Returns 0 on ok.
*/
@@ -553,7 +548,7 @@
node = dm_bht_get_node(bht, entry, depth, block_index);
if (dm_bht_compute_hash(bht, pg, offset, digest) ||
- dm_bht_compare_hash(bht, digest, node))
+ memcmp(digest, node, bht->digest_size))
goto mismatch;
/* Keep the containing block of hashes to be verified in the
@@ -565,7 +560,7 @@
if (depth == 0 && state != DM_BHT_ENTRY_VERIFIED) {
if (dm_bht_compute_hash(bht, pg, offset, digest) ||
- dm_bht_compare_hash(bht, digest, bht->root_digest))
+ memcmp(digest, bht->root_digest, bht->digest_size))
goto mismatch;
atomic_set(&entry->state, DM_BHT_ENTRY_VERIFIED);
}