lib/enable: validate params->version

Make libfsverity_enable() validate that
libfsverity_merkle_tree_params::version is set to 1.

This allows for future extensibility, and it matches what
libfsverity_compute_digest() does.

Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers
2020-11-24 20:43:16 -08:00
parent bda5bda3aa
commit 568b417d18
+6
View File
@@ -31,6 +31,12 @@ libfsverity_enable_with_sig(int fd,
return -EINVAL;
}
if (params->version != 1) {
libfsverity_error_msg("unsupported version (%u)",
params->version);
return -EINVAL;
}
arg.version = 1;
arg.hash_algorithm =
params->hash_algorithm ?: FS_VERITY_HASH_ALG_DEFAULT;