diff --git a/lib/luks2/luks2_json_format.c b/lib/luks2/luks2_json_format.c index d9a5e0ad..a0b72ab5 100644 --- a/lib/luks2/luks2_json_format.c +++ b/lib/luks2/luks2_json_format.c @@ -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);