summaryrefslogtreecommitdiffstats
path: root/fs/verity/verify.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2022-12-23 12:36:32 -0800
committerEric Biggers <ebiggers@google.com>2023-01-09 19:06:01 -0800
commitf45555bf23cfc6bf0f0239de321221b1b81817ab (patch)
tree8b3f08dfb3f0d25ab648268315840f75e1382675 /fs/verity/verify.c
parent55eed69cc8fd88272860b3409ac83e191330d370 (diff)
downloadlinux-f45555bf23cfc6bf0f0239de321221b1b81817ab.tar.gz
linux-f45555bf23cfc6bf0f0239de321221b1b81817ab.tar.bz2
linux-f45555bf23cfc6bf0f0239de321221b1b81817ab.zip
fsverity: replace fsverity_hash_page() with fsverity_hash_block()
In preparation for allowing the Merkle tree block size to differ from PAGE_SIZE, replace fsverity_hash_page() with fsverity_hash_block(). The new function is similar to the old one, but it operates on the block at the given offset in the page instead of on the full page. (For now, all callers still pass a full page.) Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com> Tested-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Link: https://lore.kernel.org/r/20221223203638.41293-6-ebiggers@kernel.org
Diffstat (limited to 'fs/verity/verify.c')
-rw-r--r--fs/verity/verify.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index d2fcb6a21ea8..44df06ddcc60 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -125,12 +125,13 @@ static bool verify_page(struct inode *inode, const struct fsverity_info *vi,
want_hash = vi->root_hash;
descend:
- /* Descend the tree verifying hash pages */
+ /* Descend the tree verifying hash blocks. */
for (; level > 0; level--) {
struct page *hpage = hpages[level - 1];
unsigned int hoffset = hoffsets[level - 1];
- err = fsverity_hash_page(params, inode, req, hpage, real_hash);
+ err = fsverity_hash_block(params, inode, req, hpage, 0,
+ real_hash);
if (err)
goto out;
err = cmp_hashes(vi, want_hash, real_hash, index, level - 1);
@@ -142,8 +143,8 @@ descend:
put_page(hpage);
}
- /* Finally, verify the data page */
- err = fsverity_hash_page(params, inode, req, data_page, real_hash);
+ /* Finally, verify the data block. */
+ err = fsverity_hash_block(params, inode, req, data_page, 0, real_hash);
if (err)
goto out;
err = cmp_hashes(vi, want_hash, real_hash, index, -1);