diff options
author | Eric Biggers <ebiggers@google.com> | 2022-12-23 12:36:30 -0800 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2023-01-09 19:05:56 -0800 |
commit | 579a12f78d889339488175cd9f353dba2bb8d047 (patch) | |
tree | b5ab4ec28788a73a4be44534f080f2889bac9a06 /fs/verity/open.c | |
parent | 9098f36b739db9a77d24b7c302dcb9d3fe987308 (diff) |
fsverity: store log2(digest_size) precomputed
Add log_digestsize to struct merkle_tree_params so that it can be used
in verify.c. Also save memory by using u8 for all the log_* fields.
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-4-ebiggers@kernel.org
Diffstat (limited to 'fs/verity/open.c')
-rw-r--r-- | fs/verity/open.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/verity/open.c b/fs/verity/open.c index e356eefb54d7..ca8de73e5a0b 100644 --- a/fs/verity/open.c +++ b/fs/verity/open.c @@ -76,7 +76,8 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params, err = -EINVAL; goto out_err; } - params->log_arity = params->log_blocksize - ilog2(params->digest_size); + params->log_digestsize = ilog2(params->digest_size); + params->log_arity = log_blocksize - params->log_digestsize; params->hashes_per_block = 1 << params->log_arity; /* |