mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-19 14:50:09 +01:00
Add prompt for LUKS2 decryption with header export.
This commit is contained in:
committed by
Milan Broz
parent
05dbf04d82
commit
f96e19147c
@@ -703,7 +703,7 @@ static int decrypt_luks2_datashift_init(struct crypt_device **cd,
|
|||||||
size_t passwordLen;
|
size_t passwordLen;
|
||||||
struct stat hdr_st;
|
struct stat hdr_st;
|
||||||
bool remove_header = false;
|
bool remove_header = false;
|
||||||
char *active_name = NULL, *password = NULL;
|
char *msg, *active_name = NULL, *password = NULL;
|
||||||
struct crypt_params_reencrypt params = {
|
struct crypt_params_reencrypt params = {
|
||||||
.mode = CRYPT_REENCRYPT_DECRYPT,
|
.mode = CRYPT_REENCRYPT_DECRYPT,
|
||||||
.direction = CRYPT_REENCRYPT_FORWARD,
|
.direction = CRYPT_REENCRYPT_FORWARD,
|
||||||
@@ -715,6 +715,18 @@ static int decrypt_luks2_datashift_init(struct crypt_device **cd,
|
|||||||
.flags = CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT
|
.flags = CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!ARG_SET(OPT_BATCH_MODE_ID)) {
|
||||||
|
r = asprintf(&msg, _("Header file %s does not exist. Do you want to initialize LUKS2 "
|
||||||
|
"decryption of device %s and export LUKS2 header to file %s?"),
|
||||||
|
expheader, data_device, expheader);
|
||||||
|
if (r < 0)
|
||||||
|
return -ENOMEM;
|
||||||
|
r = yesDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
|
||||||
|
free(msg);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
if ((r = decrypt_verify_and_set_params(¶ms)))
|
if ((r = decrypt_verify_and_set_params(¶ms)))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user