mirror of
https://github.com/openharmony/third_party_fsverity-utils.git
synced 2026-07-01 10:05:35 -04:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user