X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcryptsetup%2Fcryptsetup.c;h=f570724b9d8c0105d26c12715e0a3521c42b55b4;hb=c2f1db8f83618e60dcded8303d14656d7d26b436;hp=b26fcca836993c73019f56f351793bf8f8ad3354;hpb=2a2aab602e1d8b6bf0b440730e379f9dd6586b80;p=elogind.git diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c index b26fcca83..f570724b9 100644 --- a/src/cryptsetup/cryptsetup.c +++ b/src/cryptsetup/cryptsetup.c @@ -37,6 +37,7 @@ static const char *opt_type = NULL; /* LUKS1 or PLAIN */ static char *opt_cipher = NULL; static unsigned opt_key_size = 0; +static unsigned opt_keyfile_offset = 0; static char *opt_hash = NULL; static unsigned opt_tries = 0; static bool opt_readonly = false; @@ -79,6 +80,13 @@ static int parse_one_option(const char *option) { return 0; } + } else if (startswith(option, "keyfile-offset=")) { + + if (safe_atou(option+15, &opt_keyfile_offset) < 0) { + log_error("keyfile-offset= parse failure, ignoring."); + return 0; + } + } else if (startswith(option, "hash=")) { char *t; @@ -462,7 +470,8 @@ int main(int argc, char *argv[]) { argv[3]); if (key_file) - k = crypt_activate_by_keyfile(cd, argv[2], CRYPT_ANY_SLOT, key_file, keyfile_size, flags); + k = crypt_activate_by_keyfile_offset(cd, argv[2], CRYPT_ANY_SLOT, key_file, keyfile_size, + opt_keyfile_offset, flags); else { char **p;