Fix some minor compilation problems in crypto backends.
[platform/upstream/cryptsetup.git] / src / cryptsetup.c
index 4272d08..d85075e 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * 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>
@@ -265,7 +286,7 @@ static int action_loopaesOpen(int arg)
                .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) {
@@ -276,8 +297,8 @@ static int action_loopaesOpen(int arg)
        if ((r = crypt_init(&cd, action_argv[0])))
                goto out;
 
-       r = crypt_format(cd, CRYPT_LOOPAES, NULL, NULL, NULL, NULL,
-                        key_size, &params);
+       r = crypt_format(cd, CRYPT_LOOPAES, opt_cipher ?: DEFAULT_LOOPAES_CIPHER,
+                        NULL, NULL, NULL, key_size, &params);
        if (r < 0)
                goto out;
 
@@ -698,6 +719,9 @@ static int action_luksChangeKey(int arg)
        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,
@@ -988,8 +1012,10 @@ static void help(poptContext popt_context, enum poptCallbackReason reason,
                        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);