Re: [PATCH 1/4] fs-verity: define a function to return the integrity protected file digest

From
Eric Biggers <ebiggers@kernel.org>
Date
2021-11-30 02:19:23
Also in
linux-fscrypt, lkml
Reply to
Mimi Zohar, 2021-11-29
Generally looks fine.  A few nits below:

On Mon, Nov 29, 2021 at 12:00:54PM -0500, Mimi Zohar wrote:
quoted hunk ↗ jump to hunk
Define a function named fsverity_measure() to return the verity file digest
and the associated hash algorithm (enum hash_algo).

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
 fs/verity/fsverity_private.h |  6 -----
 fs/verity/measure.c          | 49 ++++++++++++++++++++++++++++++++++++
 include/linux/fsverity.h     | 17 +++++++++++++
 3 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/fs/verity/fsverity_private.h b/fs/verity/fsverity_private.h
index a7920434bae5..54c5f0993541 100644
--- a/fs/verity/fsverity_private.h
+++ b/fs/verity/fsverity_private.h
@@ -26,12 +26,6 @@ struct ahash_request;
  */
 #define FS_VERITY_MAX_LEVELS		8
 
-/*
- * Largest digest size among all hash algorithms supported by fs-verity.
- * Currently assumed to be <= size of fsverity_descriptor::root_hash.
- */
-#define FS_VERITY_MAX_DIGEST_SIZE	SHA512_DIGEST_SIZE
The include of sha2.h should be removed from this file.
quoted hunk ↗ jump to hunk
+/**
+ * fsverity_measure() - get a verity file's digest
+ * @inode: inode to get digest of
+ * @digest: pointer to the digest
+ * @alg: pointer to the hash algorithm enumeration
It should be made clear that @digest and @alg are output, for example:

 * @digest: (out) pointer to the digest
 * @alg: (out) pointer to the hash algorithm enumeration
+ * Return the file hash algorithm, digest size, and digest of an fsverity
+ * protected file.
The digest size is implied, not returned.
+
+		if (!strcmp(hash_alg->name, hash_algo_name[i])) {
As the kernel test robot pointed out, this creates a dependency on
CRYPTO_HASH_INFO.  So FS_VERITY will need to select CRYPTO_HASH_INFO.

- Eric
Thread (23 messages) 23 messages, 4 authors, last reply 2021-12-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help