mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 10:50:01 +01:00
Fix data alignment calculations with custom encryption sector size.
This commit is contained in:
committed by
Milan Broz
parent
b30ba41d6a
commit
71dd149ca2
@@ -936,7 +936,7 @@ static int action_luksFormat(void)
|
|||||||
.data_device = opt_header_device ? action_argv[0] : NULL,
|
.data_device = opt_header_device ? action_argv[0] : NULL,
|
||||||
};
|
};
|
||||||
struct crypt_params_luks2 params2 = {
|
struct crypt_params_luks2 params2 = {
|
||||||
.data_alignment = params1.data_alignment,
|
.data_alignment = params1.data_alignment / (opt_sector_size >> 9),
|
||||||
.data_device = params1.data_device,
|
.data_device = params1.data_device,
|
||||||
.sector_size = opt_sector_size,
|
.sector_size = opt_sector_size,
|
||||||
.label = opt_label,
|
.label = opt_label,
|
||||||
@@ -2651,6 +2651,12 @@ int main(int argc, const char **argv)
|
|||||||
_("Unsupported encryption sector size.\n"),
|
_("Unsupported encryption sector size.\n"),
|
||||||
poptGetInvocationName(popt_context));
|
poptGetInvocationName(popt_context));
|
||||||
|
|
||||||
|
if (opt_align_payload % (opt_sector_size / SECTOR_SIZE)) {
|
||||||
|
usage(popt_context, EXIT_FAILURE,
|
||||||
|
_("Payload alignment (in 512-byte sectors) is not a multiple of requested sector size.\n"),
|
||||||
|
poptGetInvocationName(popt_context));
|
||||||
|
}
|
||||||
|
|
||||||
if (opt_unbound && !opt_key_size)
|
if (opt_unbound && !opt_key_size)
|
||||||
usage(popt_context, EXIT_FAILURE,
|
usage(popt_context, EXIT_FAILURE,
|
||||||
_("Key size is required with --unbound option.\n"),
|
_("Key size is required with --unbound option.\n"),
|
||||||
|
|||||||
Reference in New Issue
Block a user