From df9976e2a735eb11e83c77b8290eb404574590a3 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Tue, 26 Sep 2023 15:50:43 +0200 Subject: [PATCH] We do not need to wipe specific keyslot area only. --- lib/luks2/luks2.h | 3 +-- lib/luks2/luks2_keyslot.c | 9 +-------- lib/setup.c | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h index c9616d86f..08f6df5b5 100644 --- a/lib/luks2/luks2.h +++ b/lib/luks2/luks2.h @@ -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); diff --git a/lib/luks2/luks2_keyslot.c b/lib/luks2/luks2_keyslot.c index 412ec48fa..93e9eb73b 100644 --- a/lib/luks2/luks2_keyslot.c +++ b/lib/luks2/luks2_keyslot.c @@ -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; @@ -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; @@ -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); diff --git a/lib/setup.c b/lib/setup.c index c8cb2d133..ec870259a 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -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)