From 52b2dc5148e3b7bb8456ab9840937236a0ab9656 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Fri, 27 Oct 2023 15:05:18 +0200 Subject: [PATCH] Fail early if OPAL is selected with LUKS1. --- src/cryptsetup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cryptsetup.c b/src/cryptsetup.c index 8e0eb736..6d2a0dc3 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -1468,6 +1468,11 @@ int luksFormat(struct crypt_device **r_cd, char **r_password, size_t *r_password log_err(_("Unsupported LUKS2 metadata size options.")); return -EINVAL; } + + if (ARG_SET(OPT_HW_OPAL_ID) || ARG_SET(OPT_HW_OPAL_ONLY_ID)) { + log_err(_("OPAL is supported only for LUKS2 format.")); + return -EINVAL; + } } else return -EINVAL;