Data alignment is always 512B sectors count.

This commit is contained in:
Ondrej Kozina
2018-08-09 14:24:57 +02:00
committed by Milan Broz
parent d2f0773eb8
commit 248f99cad3
2 changed files with 4 additions and 4 deletions

View File

@@ -368,7 +368,7 @@ struct crypt_params_plain {
*/ */
struct crypt_params_luks1 { struct crypt_params_luks1 {
const char *hash; /**< hash used in LUKS header */ const char *hash; /**< hash used in LUKS header */
size_t data_alignment; /**< data alignment in sectors, data offset is multiple of this */ size_t data_alignment; /**< data area alignment in 512B sectors, data offset is multiple of this */
const char *data_device; /**< detached encrypted data device or @e NULL */ const char *data_device; /**< detached encrypted data device or @e NULL */
}; };
@@ -490,7 +490,7 @@ struct crypt_params_luks2 {
const struct crypt_pbkdf_type *pbkdf; /**< PBKDF (and hash) parameters or @e NULL*/ const struct crypt_pbkdf_type *pbkdf; /**< PBKDF (and hash) parameters or @e NULL*/
const char *integrity; /**< integrity algorithm or @e NULL */ const char *integrity; /**< integrity algorithm or @e NULL */
const struct crypt_params_integrity *integrity_params; /**< Data integrity parameters or @e NULL*/ const struct crypt_params_integrity *integrity_params; /**< Data integrity parameters or @e NULL*/
size_t data_alignment; /**< data alignment in sectors, data offset is multiple of this */ size_t data_alignment; /**< data area alignment in 512B sectors, data offset is multiple of this */
const char *data_device; /**< detached encrypted data device or @e NULL */ const char *data_device; /**< detached encrypted data device or @e NULL */
uint32_t sector_size; /**< encryption sector size */ uint32_t sector_size; /**< encryption sector size */
const char *label; /**< header label or @e NULL*/ const char *label; /**< header label or @e NULL*/

View File

@@ -1572,9 +1572,9 @@ static int _crypt_format_luks2(struct crypt_device *cd,
cd->device = NULL; cd->device = NULL;
if (device_alloc(&cd->device, params->data_device) < 0) if (device_alloc(&cd->device, params->data_device) < 0)
return -ENOMEM; return -ENOMEM;
required_alignment = params->data_alignment * sector_size; required_alignment = params->data_alignment * SECTOR_SIZE;
} else if (params && params->data_alignment) { } else if (params && params->data_alignment) {
required_alignment = params->data_alignment * sector_size; required_alignment = params->data_alignment * SECTOR_SIZE;
} else } else
device_topology_alignment(cd->device, device_topology_alignment(cd->device,
&required_alignment, &required_alignment,