+/*
+ * cryptsetup - setup cryptographic volumes for dm-crypt
+ *
+ * Copyright (C) 2004, Christophe Saout <christophe@saout.de>
+ * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2011, Red Hat, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
.hash = opt_hash ?: NULL, // FIXME
.offset = opt_offset,
};
- unsigned int key_size = (opt_key_size ?: 128) / 8;
+ unsigned int key_size = (opt_key_size ?: DEFAULT_LOOPAES_KEYBITS) / 8;
int r;
if (!opt_key_file) {
return -EINVAL;
}
- if ((r = crypt_init(&cd, action_argv[1])))
+ if ((r = crypt_init(&cd, action_argv[0])))
goto out;
- r = crypt_format(cd, CRYPT_LOOPAES, NULL, NULL, NULL, NULL,
- key_size, ¶ms);
+ r = crypt_format(cd, CRYPT_LOOPAES, opt_cipher ?: DEFAULT_LOOPAES_CIPHER,
+ NULL, NULL, NULL, key_size, ¶ms);
if (r < 0)
goto out;
- r = crypt_activate_by_keyfile(cd, action_argv[0],
+ r = crypt_activate_by_keyfile(cd, action_argv[1],
CRYPT_ANY_SLOT, opt_key_file, 0,
opt_readonly ? CRYPT_ACTIVATE_READONLY : 0);
out:
if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
goto out;
+ if (opt_iteration_time)
+ crypt_set_iterarion_time(cd, opt_iteration_time);
+
r = crypt_get_key(_("Enter LUKS passphrase to be changed: "),
&password, &passwordLen,
opt_keyfile_size, opt_key_file, opt_timeout,
crypt_get_dir());
log_std(_("\nDefault compiled-in device cipher parameters:\n"
+ "\tloop-AES: %s, Key %d bits\n"
"\tplain: %s, Key: %d bits, Password hashing: %s\n"
"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"),
+ DEFAULT_LOOPAES_CIPHER, DEFAULT_LOOPAES_KEYBITS,
DEFAULT_CIPHER(PLAIN), DEFAULT_PLAIN_KEYBITS, DEFAULT_PLAIN_HASH,
DEFAULT_CIPHER(LUKS1), DEFAULT_LUKS1_KEYBITS, DEFAULT_LUKS1_HASH,
DEFAULT_RNG);