--- cryptsetup-1.0.4+svn29.old/src/cryptsetup.c 2006-11-27 00:52:34.000000000 +0100 +++ cryptsetup-1.0.4+svn29/src/cryptsetup.c 2007-07-15 20:22:35.000000000 +0200 @@ -29,6 +29,7 @@ static int opt_timeout = 0; static int opt_tries = 3; static int opt_align_payload = 0; +static int opt_extra_shift = 0; static const char **action_argv; static int action_argc; @@ -110,7 +111,8 @@ .offset = opt_offset, .skip = opt_skip, .timeout = opt_timeout, - .tries = opt_tries + .tries = opt_tries, + .extra_shift = opt_extra_shift }; int r; @@ -219,6 +221,7 @@ .iteration_time = opt_iteration_time, .timeout = opt_timeout, .align_payload = opt_align_payload, + .extra_shift = 0 }; int r = 0; char *msg = NULL; @@ -240,7 +243,8 @@ .device = action_argv[0], .key_file = opt_key_file, .timeout = opt_timeout, - .tries = opt_tries + .tries = opt_tries, + .extra_shift = 0 }; int r; @@ -389,6 +393,7 @@ { "batch-mode", 'q', POPT_ARG_NONE, &opt_batch_mode, 0, N_("Do not ask for confirmation"), NULL }, { "version", '\0', POPT_ARG_NONE, &opt_version_mode, 0, N_("Print package version"), NULL }, { "timeout", 't', POPT_ARG_INT, &opt_timeout, 0, N_("Timeout for interactive passphrase prompt (in seconds)"), N_("secs") }, + { "extra_shift", 'e', POPT_ARG_INT, &opt_extra_shift, 0, N_("cipherblocksize = 512< sector boundaries - for luksFormat"), N_("SECTORS") }, POPT_TABLEEND --- cryptsetup-1.0.4+svn29.old/lib/libdevmapper.c 2006-11-27 00:52:34.000000000 +0100 +++ cryptsetup-1.0.4+svn29/lib/libdevmapper.c 2007-07-15 20:39:42.000000000 +0200 @@ -115,7 +115,7 @@ static char *get_params(struct crypt_options *options, const char *key) { - char *params; + char *params, *ptr; char *hexkey; int i; @@ -128,17 +128,20 @@ for(i = 0; i < options->key_size; i++) sprintf(&hexkey[i * 2], "%02x", (unsigned char)key[i]); - params = safe_alloc(strlen(hexkey) + strlen(options->cipher) + + ptr = params = safe_alloc(strlen(hexkey) + strlen(options->cipher) + strlen(options->device) + 64); if (!params) { set_error("Memory allocation problem"); goto out; } - sprintf(params, "%s %s %" PRIu64 " %s %" PRIu64, + ptr += sprintf(params, "%s %s %" PRIu64 " %s %" PRIu64, options->cipher, hexkey, options->skip, options->device, options->offset); + /* append the optional extra_shift parameter */ + if (options->extra_shift) sprintf(ptr, " %d", options->extra_shift); + out: safe_free(hexkey); --- cryptsetup-1.0.4+svn29.old/luks/keyencryption.c 2006-12-30 22:02:56.000000000 +0100 +++ cryptsetup-1.0.4+svn29/luks/keyencryption.c 2007-07-15 20:28:52.000000000 +0200 @@ -70,6 +70,7 @@ options->flags = 0; options->name = name; options->device = device; + options->extra_shift = 0; if (mode == O_RDONLY) { options->flags |= CRYPT_FLAG_READONLY; --- cryptsetup-1.0.4+svn29.old/lib/libcryptsetup.h 2006-11-27 00:52:34.000000000 +0100 +++ cryptsetup-1.0.4+svn29/lib/libcryptsetup.h 2007-07-15 17:11:49.000000000 +0200 @@ -32,6 +32,7 @@ uint64_t align_payload; int tries; + int extra_shift; }; int crypt_create_device(struct crypt_options *options);