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;
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;
l = strcspn(opt_cipher, "-");
if (!(truncated_cipher = strndup(opt_cipher, l))) {
- log_error("Out of memory");
+ log_oom();
goto finish;
}
char **p;
if (asprintf(&text, "Please enter passphrase for disk %s!", name) < 0) {
- log_error("Out of memory");
+ log_oom();
goto finish;
}
assert(strv_length(passwords) == 1);
if (asprintf(&text, "Please enter passphrase for disk %s! (verification)", name) < 0) {
- log_error("Out of memory");
+ log_oom();
goto finish;
}
/* Pad password if necessary */
if (!(c = new(char, opt_key_size))) {
- log_error("Out of memory.");
+ log_oom();
goto finish;
}
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;