diff options
author | Eric Biggers <ebiggers@google.com> | 2023-06-03 19:23:48 -0700 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2023-06-04 05:56:11 -0700 |
commit | 32ab3c5e6226a5c39b6674b5fbb16b492c2faa2e (patch) | |
tree | 1988c2696957c61a3e145b259ad56f4fb8a5680f /fs/verity/hash_algs.c | |
parent | 8fcd94add6c5c93ed3b9314456e8420914401530 (diff) | |
download | lwn-32ab3c5e6226a5c39b6674b5fbb16b492c2faa2e.tar.gz lwn-32ab3c5e6226a5c39b6674b5fbb16b492c2faa2e.zip |
fsverity: constify fsverity_hash_alg
Now that fsverity_hash_alg doesn't have an embedded mempool, it can be
'const' almost everywhere. Add it.
Link: https://lore.kernel.org/r/20230604022348.48658-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'fs/verity/hash_algs.c')
-rw-r--r-- | fs/verity/hash_algs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/verity/hash_algs.c b/fs/verity/hash_algs.c index e7e982412e23..c598d2035476 100644 --- a/fs/verity/hash_algs.c +++ b/fs/verity/hash_algs.c @@ -39,8 +39,8 @@ static DEFINE_MUTEX(fsverity_hash_alg_init_mutex); * * Return: pointer to the hash alg on success, else an ERR_PTR() */ -struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode, - unsigned int num) +const struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode, + unsigned int num) { struct fsverity_hash_alg *alg; struct crypto_shash *tfm; @@ -108,7 +108,7 @@ out_unlock: * Return: NULL if the salt is empty, otherwise the kmalloc()'ed precomputed * initial hash state on success or an ERR_PTR() on failure. */ -const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg, +const u8 *fsverity_prepare_hash_state(const struct fsverity_hash_alg *alg, const u8 *salt, size_t salt_size) { u8 *hashstate = NULL; @@ -206,7 +206,7 @@ int fsverity_hash_block(const struct merkle_tree_params *params, * * Return: 0 on success, -errno on failure */ -int fsverity_hash_buffer(struct fsverity_hash_alg *alg, +int fsverity_hash_buffer(const struct fsverity_hash_alg *alg, const void *data, size_t size, u8 *out) { return crypto_shash_tfm_digest(alg->tfm, data, size, out); |