mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 11:20:10 +01:00
Allow luksSuspend without explicitly specify detached header.
If LUKS device was configured to use detached header, suspend operation required --header option. For now it is enough that active device in-kernel UUID type is set properly. FIxes issue#229.
This commit is contained in:
@@ -975,8 +975,11 @@ static void SuspendDevice(void)
|
||||
suspend_status = crypt_suspend(cd, CDEVICE_1);
|
||||
if (suspend_status == -ENOTSUP) {
|
||||
printf("WARNING: Suspend/Resume not supported, skipping test.\n");
|
||||
goto out;
|
||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||
crypt_free(cd);
|
||||
return;
|
||||
}
|
||||
|
||||
OK_(suspend_status);
|
||||
FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
|
||||
|
||||
@@ -990,10 +993,30 @@ static void SuspendDevice(void)
|
||||
FAIL_(crypt_resume_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 1, 0), "wrong key");
|
||||
OK_(crypt_resume_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
|
||||
FAIL_(crypt_resume_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0), "not suspended");
|
||||
_remove_keyfiles();
|
||||
out:
|
||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||
crypt_free(cd);
|
||||
|
||||
/* create LUKS device with detached header */
|
||||
OK_(crypt_init(&cd, DEVICE_1));
|
||||
OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
|
||||
OK_(crypt_set_data_device(cd, DEVICE_2));
|
||||
OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
|
||||
crypt_free(cd);
|
||||
|
||||
/* Should be able to suspend but not resume if not header specified */
|
||||
OK_(crypt_init_by_name(&cd, CDEVICE_1));
|
||||
OK_(crypt_suspend(cd, CDEVICE_1));
|
||||
FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
|
||||
FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)-1), "no header");
|
||||
crypt_free(cd);
|
||||
|
||||
OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DEVICE_1));
|
||||
OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)));
|
||||
|
||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||
crypt_free(cd);
|
||||
|
||||
_remove_keyfiles();
|
||||
}
|
||||
|
||||
static void AddDeviceLuks(void)
|
||||
|
||||
Reference in New Issue
Block a user