]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: restric hmac options for gen-tls-key
authorMartin George <marting@netapp.com>
Thu, 14 Dec 2023 07:32:54 +0000 (13:02 +0530)
committerDaniel Wagner <wagi@monom.org>
Thu, 14 Dec 2023 12:25:13 +0000 (13:25 +0100)
During nvme gen-tls-key generation, the permitted hmac options is 1
for SHA-256 & 2 for SHA-384 respectively for the retained key. But
nvme-cli mistakenly permits an additional option 3 too which defaults
to SHA-256 itself. Rectify this.

Signed-off-by: Martin George <marting@netapp.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 14a5411774719b51cfd07f0df20038e8f364afa7..872dc89aee9e416c21959e673b4bf165aebad44e 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -8566,7 +8566,7 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl
        err = argconfig_parse(argc, argv, desc, opts);
        if (err)
                return err;
-       if (cfg.hmac < 1 || cfg.hmac > 3) {
+       if (cfg.hmac < 1 || cfg.hmac > 2) {
                nvme_show_error("Invalid HMAC identifier %u", cfg.hmac);
                return -EINVAL;
        }