mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 05:10:03 +01:00
Implement active device suspend info.
Add CRYPT_ACTIVATE_SUSPENDED bit to crypt_get_active_device() flags that informs the caller that device is suspended (luksSuspend). Fixes: #501.
This commit is contained in:
@@ -678,6 +678,7 @@ static void UseLuksDevice(void)
|
||||
|
||||
static void SuspendDevice(void)
|
||||
{
|
||||
struct crypt_active_device cad;
|
||||
int suspend_status;
|
||||
|
||||
OK_(crypt_init(&cd, DEVICE_1));
|
||||
@@ -693,12 +694,18 @@ static void SuspendDevice(void)
|
||||
}
|
||||
|
||||
OK_(suspend_status);
|
||||
OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
|
||||
EQ_(CRYPT_ACTIVATE_SUSPENDED, cad.flags & CRYPT_ACTIVATE_SUSPENDED);
|
||||
|
||||
FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
|
||||
|
||||
FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)-1), "wrong key");
|
||||
OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)));
|
||||
FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)), "not suspended");
|
||||
|
||||
OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
|
||||
EQ_(0, cad.flags & CRYPT_ACTIVATE_SUSPENDED);
|
||||
|
||||
OK_(prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
|
||||
OK_(crypt_suspend(cd, CDEVICE_1));
|
||||
FAIL_(crypt_resume_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1 "blah", 0), "wrong keyfile");
|
||||
|
||||
Reference in New Issue
Block a user