summaryrefslogtreecommitdiff
path: root/fs/verity/enable.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2025-06-30 10:22:24 -0700
committerEric Biggers <ebiggers@kernel.org>2025-07-14 11:29:32 -0700
commit998646b3c1129188f1fdffac3779feb9708b4b4a (patch)
treed7cce8b2f1073958caca922909e1951ed8b3ef3f /fs/verity/enable.c
parentb309bf7c3e35e86e414921ff655a9578016a1788 (diff)
downloadlinux-next-998646b3c1129188f1fdffac3779feb9708b4b4a.tar.gz
linux-next-998646b3c1129188f1fdffac3779feb9708b4b4a.zip
fsverity: Switch from crypto_shash to SHA-2 library
fsverity supports two hash algorithms: SHA-256 and SHA-512. Since both of these have a library API now, just use the library API instead of crypto_shash. Even with multiple algorithms, the library-based code still ends up being quite a bit simpler, due to how clumsy the old-school crypto API is. The library-based code is also more efficient, since it avoids overheads such as indirect calls. Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20250630172224.46909-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'fs/verity/enable.c')
-rw-r--r--fs/verity/enable.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/verity/enable.c b/fs/verity/enable.c
index 9b335bee88a5..503268cf4296 100644
--- a/fs/verity/enable.c
+++ b/fs/verity/enable.c
@@ -7,7 +7,6 @@
#include "fsverity_private.h"
-#include <crypto/hash.h>
#include <linux/export.h>
#include <linux/mount.h>
#include <linux/sched/signal.h>
@@ -25,7 +24,6 @@ static int hash_one_block(struct inode *inode,
struct block_buffer *cur)
{
struct block_buffer *next = cur + 1;
- int err;
/*
* Safety check to prevent a buffer overflow in case of a filesystem bug
@@ -38,10 +36,8 @@ static int hash_one_block(struct inode *inode,
/* Zero-pad the block if it's shorter than the block size. */
memset(&cur->data[cur->filled], 0, params->block_size - cur->filled);
- err = fsverity_hash_block(params, inode, cur->data,
- &next->data[next->filled]);
- if (err)
- return err;
+ fsverity_hash_block(params, inode, cur->data,
+ &next->data[next->filled]);
next->filled += params->digest_size;
cur->filled = 0;
return 0;