From 5c17ca4142500bc2a75b1537af120b47ca12a0fa Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 28 Oct 2024 12:56:40 +0000 Subject: [PATCH] writer: Use blocksize constant Drive by cleanup. Signed-off-by: Colin Walters --- libcomposefs/lcfs-fsverity.c | 1 - libcomposefs/lcfs-internal.h | 2 ++ libcomposefs/lcfs-writer.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libcomposefs/lcfs-fsverity.c b/libcomposefs/lcfs-fsverity.c index ed7c29a5..099e2f7a 100644 --- a/libcomposefs/lcfs-fsverity.c +++ b/libcomposefs/lcfs-fsverity.c @@ -304,7 +304,6 @@ struct fsverity_descriptor { uint8_t reserved2[144]; }; -#define FSVERITY_BLOCK_SIZE 4096 #define FSVERITY_MAX_LEVELS 8 /* enough for 64bit file size */ struct FsVerityContext { diff --git a/libcomposefs/lcfs-internal.h b/libcomposefs/lcfs-internal.h index e6b0f8e3..af9b59f7 100644 --- a/libcomposefs/lcfs-internal.h +++ b/libcomposefs/lcfs-internal.h @@ -30,6 +30,8 @@ typedef int errint_t; /* What may be returned by the kernel for digests */ #define MAX_DIGEST_SIZE 64 +/* We picked this default block size */ +#define FSVERITY_BLOCK_SIZE 4096 #define OVERLAY_XATTR_USER_PREFIX "user." #define OVERLAY_XATTR_TRUSTED_PREFIX "trusted." diff --git a/libcomposefs/lcfs-writer.c b/libcomposefs/lcfs-writer.c index e7bf1eb6..f7560c6b 100644 --- a/libcomposefs/lcfs-writer.c +++ b/libcomposefs/lcfs-writer.c @@ -674,7 +674,7 @@ int lcfs_fd_enable_fsverity(int fd) arg.version = 1; arg.hash_algorithm = FS_VERITY_HASH_ALG_SHA256; - arg.block_size = 4096; + arg.block_size = FSVERITY_BLOCK_SIZE; arg.salt_size = 0; arg.salt_ptr = 0; arg.sig_size = 0;