diff options
author | Eric Biggers <ebiggers@google.com> | 2022-11-29 07:51:39 +0300 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2022-11-30 08:07:41 +0300 |
commit | a4bbf53d88c728da9ff6c316b1e4ded63a8f3940 (patch) | |
tree | 0462f2ab83d7d9e8fe49c98a6625baf62135bcf7 /fs/verity/fsverity_private.h | |
parent | 98dc08bae6780bb950b5c0cdefeb662b22482655 (diff) | |
download | linux-a4bbf53d88c728da9ff6c316b1e4ded63a8f3940.tar.xz |
fsverity: simplify fsverity_get_digest()
Instead of looking up the algorithm by name in hash_algo_name[] to get
its hash_algo ID, just store the hash_algo ID in the fsverity_hash_alg
struct. Verify at boot time that every fsverity_hash_alg has a valid
hash_algo ID with matching digest size.
Remove an unnecessary memset() of the whole digest array to 0 before the
digest is copied into it.
Finally, remove the pr_debug statement. There is already a pr_debug for
the fsverity digest when the file is opened.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Link: https://lore.kernel.org/r/20221129045139.69803-1-ebiggers@kernel.org
Diffstat (limited to 'fs/verity/fsverity_private.h')
-rw-r--r-- | fs/verity/fsverity_private.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/verity/fsverity_private.h b/fs/verity/fsverity_private.h index dbe1ce5b450a..c7fcb855e068 100644 --- a/fs/verity/fsverity_private.h +++ b/fs/verity/fsverity_private.h @@ -32,6 +32,11 @@ struct fsverity_hash_alg { unsigned int digest_size; /* digest size in bytes, e.g. 32 for SHA-256 */ unsigned int block_size; /* block size in bytes, e.g. 64 for SHA-256 */ mempool_t req_pool; /* mempool with a preallocated hash request */ + /* + * The HASH_ALGO_* constant for this algorithm. This is different from + * FS_VERITY_HASH_ALG_*, which uses a different numbering scheme. + */ + enum hash_algo algo_id; }; /* Merkle tree parameters: hash algorithm, initial hash state, and topology */ |