Skip to content

Commit edca379

Browse files
committed
daemon/c_vol: switch to new cryptfs API in c_vol_cleanup_dm()
The API of common/cryptfs has been changed. Thus, we switch to this API in c_vol_cleanup_dm(), too. We select the proper cryptfs mode CRYPTFS_MODE_AUTHENC or CRYPTFS_MODE_INTEGRITY_ENCRYPT during cleanup. Signed-off-by: Michael Weiß <[email protected]>
1 parent 70415c4 commit edca379

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

daemon/c_vol.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,12 @@ c_vol_cleanup_dm(c_vol_t *vol)
11091109
DEBUG("Cleanup: removing block device %s of type %s\n", label, type);
11101110

11111111
if (!strcmp(type, "crypt")) {
1112-
if (cryptfs_delete_blk_dev(fd, label) < 0)
1112+
char *not_stacked_file = c_vol_meta_image_path_new(vol, mntent, ".not-stacked");
1113+
cryptfs_mode_t mode = file_exists(not_stacked_file) ?
1114+
CRYPTFS_MODE_INTEGRITY_ENCRYPT :
1115+
CRYPTFS_MODE_AUTHENC;
1116+
mem_free0(not_stacked_file);
1117+
if (cryptfs_delete_blk_dev(fd, label, mode) < 0)
11131118
DEBUG("Could not delete dm-crypt dev %s", label);
11141119
} else if (!strcmp(type, "verity")) {
11151120
if (verity_delete_blk_dev(label) < 0)

0 commit comments

Comments
 (0)