From 03a74b74e544df44f0005d4a5b5b0b99931143ab Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Thu, 9 Aug 2018 14:26:38 +0200 Subject: [PATCH] Revert "Fix data alignment calculations with custom encryption sector size." This reverts commit 71dd149ca2cd15befddd2ed1b8a0b06517c7f86b. Enforcing data alignment to be encryption sector size aligned is completelly wrong. The underlying data device alignment has nothing to do with dm-crypt internal encryption sector size. The restriction is however valid for dm-crypt segment size. --- src/cryptsetup.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/cryptsetup.c b/src/cryptsetup.c index b7f0a7c1..386af508 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -936,7 +936,7 @@ static int action_luksFormat(void) .data_device = opt_header_device ? action_argv[0] : NULL, }; struct crypt_params_luks2 params2 = { - .data_alignment = params1.data_alignment / (opt_sector_size >> 9), + .data_alignment = params1.data_alignment, .data_device = params1.data_device, .sector_size = opt_sector_size, .label = opt_label, @@ -2651,12 +2651,6 @@ int main(int argc, const char **argv) _("Unsupported encryption sector size.\n"), 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) usage(popt_context, EXIT_FAILURE, _("Key size is required with --unbound option.\n"),