diff options
author | Eric Biggers <ebiggers@google.com> | 2020-11-24 20:43:16 -0800 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2020-11-24 20:43:16 -0800 |
commit | 568b417d18e2be72861f8b2cd7effa855db758ee (patch) | |
tree | 21122b482b62be1a0fcc6e1039c50a795e6eeb3f | |
parent | bda5bda3aabc46fc8660115ad14ac154be5a7907 (diff) | |
download | fsverity-utils-568b417d18e2be72861f8b2cd7effa855db758ee.tar.gz |
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>
-rw-r--r-- | lib/enable.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/enable.c b/lib/enable.c index c27ec89..2478077 100644 --- a/lib/enable.c +++ b/lib/enable.c @@ -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; |