mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Enable crypt_header_is_detached for empty contexts.
Also changes few tests now expecting crypt_header_is_detached works with empty contexts.
This commit is contained in:
@@ -3242,7 +3242,7 @@ int crypt_header_is_detached(struct crypt_device *cd)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (!cd || !isLUKS(cd->type))
|
||||
if (!cd || (cd->type && !isLUKS(cd->type)))
|
||||
return -EINVAL;
|
||||
|
||||
r = device_is_identical(crypt_data_device(cd), crypt_metadata_device(cd));
|
||||
|
||||
@@ -889,7 +889,7 @@ static void AddDeviceLuks2(void)
|
||||
FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0), "Device is active");
|
||||
EQ_(crypt_status(cd, CDEVICE_2), CRYPT_INACTIVE);
|
||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||
FAIL_(crypt_header_is_detached(cd), "no header for mismatched device");
|
||||
EQ_(crypt_header_is_detached(cd), 1);
|
||||
CRYPT_FREE(cd);
|
||||
|
||||
params.data_device = NULL;
|
||||
|
||||
@@ -960,7 +960,7 @@ static void AddDeviceLuks(void)
|
||||
FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0), "Device is active");
|
||||
EQ_(crypt_status(cd, CDEVICE_2), CRYPT_INACTIVE);
|
||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||
FAIL_(crypt_header_is_detached(cd), "no header for mismatched device");
|
||||
EQ_(crypt_header_is_detached(cd), 1);
|
||||
CRYPT_FREE(cd);
|
||||
|
||||
params.data_device = NULL;
|
||||
|
||||
Reference in New Issue
Block a user