Make luksErase work with detached header.

For it to work correctly with LUKS2 OPAL we have to
set data device properly so it can erase OPAL locking
range (or revert via PSID).
This commit is contained in:
Ondrej Kozina
2023-07-31 14:53:18 +02:00
parent e1d494c4e1
commit 28da4ed72d

View File

@@ -2722,8 +2722,8 @@ static int action_luksErase(void)
char *msg = NULL;
int i, max, r, hw_enc;
if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
goto out;
if ((r = crypt_init_data_device(&cd, uuid_or_device(ARG_STR(OPT_HEADER_ID) ?: action_argv[0]), action_argv[0])))
return r;
/* Allow factory reset even if there's no LUKS header, as long as OPAL is enabled on the device */
if (ARG_SET(OPT_HW_OPAL_FACTORY_RESET_ID)) {