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

From
Lakshmi Ramasubramanian <hidden>
Date
2021-11-30 05:33:32
Also in
linux-fscrypt, lkml
Reply to
Eric Biggers, 2021-11-30
Hi Mimi,

On 11/29/2021 6:19 PM, Eric Biggers wrote:
Generally looks fine.  A few nits below:

On Mon, Nov 29, 2021 at 12:00:54PM -0500, Mimi Zohar wrote:
quoted
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
+/**
+ * fsverity_measure() - get a verity file's digest
nit: The function name seems to suggest it is measuring the fs-verity file's digest. Since it is reading the file's digest: fsverity_read_digest() or fsverity_read_measure()?

 -lakshmi
quoted
+ * @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
quoted
+ * Return the file hash algorithm, digest size, and digest of an fsverity
+ * protected file.
The digest size is implied, not returned.
quoted
+
+		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