Skip to content

Commit

Permalink
lcfs-verity: Fix name for data_size member of fsverity_descriptor
Browse files Browse the repository at this point in the history
This member should be little endian, the matching kernel struct has:

   __le64 data_size;       /* size of file the Merkle tree is built over */

So, rename from data_size_be to data_size_le.

Signed-off-by: Alexander Larsson <[email protected]>
  • Loading branch information
alexlarsson committed Sep 25, 2023
1 parent a38da45 commit 7704ed2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcomposefs/lcfs-fsverity.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ struct fsverity_descriptor {
uint8_t log_blocksize;
uint8_t salt_size;
uint32_t reserved1;
uint64_t data_size_be;
uint64_t data_size_le;
uint8_t root_hash[64];
uint8_t salt[32];
uint8_t reserved2[144];
Expand Down Expand Up @@ -448,7 +448,7 @@ void lcfs_fsverity_context_get_digest(FsVerityContext *ctx,
descriptor.hash_algorithm = 1;
descriptor.log_blocksize = 12;
descriptor.salt_size = 0;
descriptor.data_size_be = htole64(ctx->file_size);
descriptor.data_size_le = htole64(ctx->file_size);

do_sha256(ctx, ctx->buffer[ctx->max_level], FSVERITY_BLOCK_SIZE,
descriptor.root_hash);
Expand Down

0 comments on commit 7704ed2

Please sign in to comment.