mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 03:40:05 +01:00
Align legacy keyslot temporary device according to keyslot alignment.
For some strange filesystems (nfs) we get big block size (1MB). For temporary keyslot devices this mapping does not make sense and can cause problem with detached headers that are smaller (contains exactly the slot size).
This commit is contained in:
@@ -67,7 +67,7 @@ static int LUKS_endec_template(char *src, size_t srcLength,
|
||||
}
|
||||
};
|
||||
int r, devfd = -1;
|
||||
size_t bsize, alignment;
|
||||
size_t bsize, keyslot_alignment, alignment;
|
||||
|
||||
log_dbg("Using dmcrypt to access keyslot area.");
|
||||
|
||||
@@ -76,7 +76,11 @@ static int LUKS_endec_template(char *src, size_t srcLength,
|
||||
if (!bsize || !alignment)
|
||||
return -EINVAL;
|
||||
|
||||
dmd.size = size_round_up(srcLength, bsize) / SECTOR_SIZE;
|
||||
if (bsize > LUKS_ALIGN_KEYSLOTS)
|
||||
keyslot_alignment = LUKS_ALIGN_KEYSLOTS;
|
||||
else
|
||||
keyslot_alignment = bsize;
|
||||
dmd.size = size_round_up(srcLength, keyslot_alignment) / SECTOR_SIZE;
|
||||
|
||||
if (mode == O_RDONLY)
|
||||
dmd.flags |= CRYPT_ACTIVATE_READONLY;
|
||||
|
||||
Reference in New Issue
Block a user