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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Generally looks fine.  A few nits below:

On Mon, Nov 29, 2021 at 12:00:54PM -0500, Mimi Zohar wrote:
> 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@xxxxxxxxxxxxx>
> ---
>  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.

> +/**
> + * 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux