]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/verity: use FSV_BLOCK_SIZE by default
authorEric Biggers <ebiggers@google.com>
Thu, 29 Dec 2022 23:32:15 +0000 (15:32 -0800)
committerZorro Lang <zlang@kernel.org>
Sun, 1 Jan 2023 13:33:08 +0000 (21:33 +0800)
Make _fsv_enable() and _fsv_sign() default to FSV_BLOCK_SIZE if no block
size is explicitly specified, so that the individual tests don't have to
do this themselves.  This overrides the fsverity-utils default of 4096
bytes, or the page size in older versions of fsverity-utils, both of
which may differ from FSV_BLOCK_SIZE.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/verity

index a94ebf8ef26f55484afa127cecc828963cee9d48..1c706b80d3a8b988ff88bdab54f44b311b26401c 100644 (file)
@@ -249,7 +249,13 @@ _fsv_dump_signature()
 
 _fsv_enable()
 {
-       $FSVERITY_PROG enable "$@"
+       local args=("$@")
+       # If the caller didn't explicitly specify a Merkle tree block size, then
+       # use FSV_BLOCK_SIZE.
+       if ! [[ " $*" =~ " --block-size" ]]; then
+               args+=("--block-size=$FSV_BLOCK_SIZE")
+       fi
+       $FSVERITY_PROG enable "${args[@]}"
 }
 
 _fsv_measure()
@@ -259,7 +265,13 @@ _fsv_measure()
 
 _fsv_sign()
 {
-       $FSVERITY_PROG sign "$@"
+       local args=("$@")
+       # If the caller didn't explicitly specify a Merkle tree block size, then
+       # use FSV_BLOCK_SIZE.
+       if ! [[ " $*" =~ " --block-size" ]]; then
+               args+=("--block-size=$FSV_BLOCK_SIZE")
+       fi
+       $FSVERITY_PROG sign "${args[@]}"
 }
 
 # Generate a file, then enable verity on it.