mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
FEC (Forward Error Correction) data should cover the whole data area, hashes (Merkle tree) and optionally additional metadata (located after hash area). Unfortunately, if FEC data is stored in the same file as hash, the calculation wrongly used the whole file size thus overlaps with FEC area itself. This produces unusable and too large FEC data. (There is not a problem if FEC image is a separate image.) This patch fixes the problem, introducing FEC blocks calculation as: -If hash device is in a separate image, metadata covers the whole rest of the image after hash area. (Unchanged behaviour.) -If hash and FEC device is in the image, metadata ends on the FEC area offset. This should probably fix several issues reported with FEC wrong calculations. Fixes: #554