Commit e0cacef5 authored by Milan Broz's avatar Milan Broz

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).
parent 767ed40b
......@@ -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;
keyslot_alignment = LUKS_ALIGN_KEYSLOTS;
keyslot_alignment = bsize;
dmd.size = size_round_up(srcLength, keyslot_alignment) / SECTOR_SIZE;
if (mode == O_RDONLY)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment