|
|
0b2424 |
From be088b8de8d636993767a42f195ffd3bf915e567 Mon Sep 17 00:00:00 2001
|
|
|
0b2424 |
From: Ondrej Kozina <okozina@redhat.com>
|
|
|
0b2424 |
Date: Mon, 12 Dec 2022 17:33:12 +0100
|
|
|
0b2424 |
Subject: [PATCH 1/2] Enable crypt_header_is_detached for empty contexts.
|
|
|
0b2424 |
|
|
|
0b2424 |
Also changes few tests now expecting crypt_header_is_detached
|
|
|
0b2424 |
works with empty contexts.
|
|
|
0b2424 |
---
|
|
|
0b2424 |
lib/setup.c | 2 +-
|
|
|
0b2424 |
tests/api-test-2.c | 2 +-
|
|
|
0b2424 |
tests/api-test.c | 2 +-
|
|
|
0b2424 |
3 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
0b2424 |
|
|
|
0b2424 |
diff --git a/lib/setup.c b/lib/setup.c
|
|
|
0b2424 |
index f169942c..3263578b 100644
|
|
|
0b2424 |
--- a/lib/setup.c
|
|
|
0b2424 |
+++ b/lib/setup.c
|
|
|
0b2424 |
@@ -3242,7 +3242,7 @@ int crypt_header_is_detached(struct crypt_device *cd)
|
|
|
0b2424 |
{
|
|
|
0b2424 |
int r;
|
|
|
0b2424 |
|
|
|
0b2424 |
- if (!cd || !isLUKS(cd->type))
|
|
|
0b2424 |
+ if (!cd || (cd->type && !isLUKS(cd->type)))
|
|
|
0b2424 |
return -EINVAL;
|
|
|
0b2424 |
|
|
|
0b2424 |
r = device_is_identical(crypt_data_device(cd), crypt_metadata_device(cd));
|
|
|
0b2424 |
diff --git a/tests/api-test-2.c b/tests/api-test-2.c
|
|
|
0b2424 |
index 2c39191b..c7e930ca 100644
|
|
|
0b2424 |
--- a/tests/api-test-2.c
|
|
|
0b2424 |
+++ b/tests/api-test-2.c
|
|
|
0b2424 |
@@ -889,7 +889,7 @@ static void AddDeviceLuks2(void)
|
|
|
0b2424 |
FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0), "Device is active");
|
|
|
0b2424 |
EQ_(crypt_status(cd, CDEVICE_2), CRYPT_INACTIVE);
|
|
|
0b2424 |
OK_(crypt_deactivate(cd, CDEVICE_1));
|
|
|
0b2424 |
- FAIL_(crypt_header_is_detached(cd), "no header for mismatched device");
|
|
|
0b2424 |
+ EQ_(crypt_header_is_detached(cd), 1);
|
|
|
0b2424 |
CRYPT_FREE(cd);
|
|
|
0b2424 |
|
|
|
0b2424 |
params.data_device = NULL;
|
|
|
0b2424 |
diff --git a/tests/api-test.c b/tests/api-test.c
|
|
|
0b2424 |
index 9bb6d2f1..f6e33a40 100644
|
|
|
0b2424 |
--- a/tests/api-test.c
|
|
|
0b2424 |
+++ b/tests/api-test.c
|
|
|
0b2424 |
@@ -960,7 +960,7 @@ static void AddDeviceLuks(void)
|
|
|
0b2424 |
FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0), "Device is active");
|
|
|
0b2424 |
EQ_(crypt_status(cd, CDEVICE_2), CRYPT_INACTIVE);
|
|
|
0b2424 |
OK_(crypt_deactivate(cd, CDEVICE_1));
|
|
|
0b2424 |
- FAIL_(crypt_header_is_detached(cd), "no header for mismatched device");
|
|
|
0b2424 |
+ EQ_(crypt_header_is_detached(cd), 1);
|
|
|
0b2424 |
CRYPT_FREE(cd);
|
|
|
0b2424 |
|
|
|
0b2424 |
params.data_device = NULL;
|
|
|
0b2424 |
--
|
|
|
0b2424 |
2.38.1
|
|
|
0b2424 |
|