mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Calculate keyslots area size properly with detached headers.
When LUKS2 crypt_format() is called with detached header and custom data alignment is requested, keyslots area is miscalculated. This mistake is correctly detected by LUKS2 validation code but it's feature regression with regard to LUKSv1 format.
This commit is contained in:
committed by
Milan Broz
parent
d664565174
commit
ae8247fe6a
@@ -212,7 +212,7 @@ int LUKS2_generate_hdr(
|
||||
|
||||
/* for detached metadata device compute reasonable keyslot areas size */
|
||||
// FIXME: this is coupled with FIXME above
|
||||
if (detached_metadata_device)
|
||||
if (detached_metadata_device && !offset)
|
||||
keyslots_size = LUKS2_HDR_DEFAULT_LEN - get_min_offset(hdr);
|
||||
else
|
||||
keyslots_size = offset - get_min_offset(hdr);
|
||||
|
||||
Reference in New Issue
Block a user