From 568b417d18e2be72861f8b2cd7effa855db758ee Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 24 Nov 2020 20:43:16 -0800 Subject: 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 --- lib/enable.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit 1.2.3-korg