Skip to content

Commit

Permalink
We do not need to wipe specific keyslot area only.
Browse files Browse the repository at this point in the history
  • Loading branch information
oniko committed Sep 29, 2023
1 parent f0b556b commit df9976e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/luks2/luks2.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ int LUKS2_keyslot_store(struct crypt_device *cd,

int LUKS2_keyslot_wipe(struct crypt_device *cd,
struct luks2_hdr *hdr,
int keyslot,
int wipe_area_only);
int keyslot);

crypt_keyslot_priority LUKS2_keyslot_priority_get(struct luks2_hdr *hdr, int keyslot);

Expand Down
9 changes: 1 addition & 8 deletions lib/luks2/luks2_keyslot.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,7 @@ int LUKS2_keyslot_store(struct crypt_device *cd,

int LUKS2_keyslot_wipe(struct crypt_device *cd,
struct luks2_hdr *hdr,
int keyslot,
int wipe_area_only)
int keyslot)
{
struct device *device = crypt_metadata_device(cd);
uint64_t area_offset, area_length;
Expand All @@ -696,9 +695,6 @@ int LUKS2_keyslot_wipe(struct crypt_device *cd,
if (!jobj_keyslot)
return -ENOENT;

if (wipe_area_only)
log_dbg(cd, "Wiping keyslot %d area only.", keyslot);

r = LUKS2_device_write_lock(cd, hdr, device);
if (r)
return r;
Expand All @@ -722,9 +718,6 @@ int LUKS2_keyslot_wipe(struct crypt_device *cd,
}
}

if (wipe_area_only)
goto out;

/* Slot specific wipe */
if (h) {
r = h->wipe(cd, keyslot);
Expand Down
2 changes: 1 addition & 1 deletion lib/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -4537,7 +4537,7 @@ int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot)
return LUKS_del_key(keyslot, &cd->u.luks1.hdr, cd);
}

return LUKS2_keyslot_wipe(cd, &cd->u.luks2.hdr, keyslot, 0);
return LUKS2_keyslot_wipe(cd, &cd->u.luks2.hdr, keyslot);
}

static int _check_header_data_overlap(struct crypt_device *cd, const char *name)
Expand Down

0 comments on commit df9976e

Please sign in to comment.