projects
/
platform
/
upstream
/
cryptsetup.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fails if more device arguments are present for isLuks.
[platform/upstream/cryptsetup.git]
/
src
/
cryptsetup.c
diff --git
a/src/cryptsetup.c
b/src/cryptsetup.c
index
29a96f9
..
5c2b96a
100644
(file)
--- a/
src/cryptsetup.c
+++ b/
src/cryptsetup.c
@@
-4,7
+4,7
@@
* Copyright (C) 2004, Christophe Saout <christophe@saout.de>
* Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
* Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
* Copyright (C) 2004, Christophe Saout <christophe@saout.de>
* Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
* Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-201
2
, Milan Broz
+ * Copyright (C) 2009-201
3
, Milan Broz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@
-475,7
+475,7
@@
static int action_benchmark(void)
{ "twofish", "xts", 64, 16 },
{ NULL, NULL, 0, 0 }
};
{ "twofish", "xts", 64, 16 },
{ NULL, NULL, 0, 0 }
};
- static char *bkdfs[] = {
+ static c
onst c
har *bkdfs[] = {
"sha1", "sha256", "sha512", "ripemd160", "whirlpool", NULL
};
char cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
"sha1", "sha256", "sha512", "ripemd160", "whirlpool", NULL
};
char cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
@@
-508,8
+508,8
@@
static int action_benchmark(void)
key_size / 8, iv_size, buffer_size,
&enc_mbr, &dec_mbr);
if (!r) {
key_size / 8, iv_size, buffer_size,
&enc_mbr, &dec_mbr);
if (!r) {
- log_std(N_("# Algorithm | Key |
Encryption |
Decryption\n"));
- log_std("%8s-%s %4db %
5.1f MiB/s %5
.1f MiB/s\n",
+ log_std(N_("# Algorithm | Key |
Encryption |
Decryption\n"));
+ log_std("%8s-%s %4db %
6.1f MiB/s %6
.1f MiB/s\n",
cipher, cipher_mode, key_size, enc_mbr, dec_mbr);
} else if (r == -ENOENT)
log_err(_("Cipher %s is not available.\n"), opt_cipher);
cipher, cipher_mode, key_size, enc_mbr, dec_mbr);
} else if (r == -ENOENT)
log_err(_("Cipher %s is not available.\n"), opt_cipher);
@@
-530,24
+530,27
@@
static int action_benchmark(void)
if (r == -ENOENT)
skipped++;
if (i == 0)
if (r == -ENOENT)
skipped++;
if (i == 0)
- log_std(N_("# Algorithm | Key |
Encryption |
Decryption\n"));
+ log_std(N_("# Algorithm | Key |
Encryption |
Decryption\n"));
snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
bciphers[i].cipher, bciphers[i].mode);
if (!r)
snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
bciphers[i].cipher, bciphers[i].mode);
if (!r)
- log_std("%12s %4db %
5.1f MiB/s %5
.1f MiB/s\n",
+ log_std("%12s %4db %
6.1f MiB/s %6
.1f MiB/s\n",
cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
else
cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
else
- log_std("%12s %4db %1
2s %12
s\n", cipher,
+ log_std("%12s %4db %1
3s %13
s\n", cipher,
bciphers[i].key_size*8, _("N/A"), _("N/A"));
}
if (skipped && skipped == i)
r = -ENOTSUP;
}
bciphers[i].key_size*8, _("N/A"), _("N/A"));
}
if (skipped && skipped == i)
r = -ENOTSUP;
}
- if (r == -ENOTSUP)
- log_err( _("Required kernel crypto interface not available.\n"
- "Ensure you have algif_skcipher kernel module loaded.\n"));
+ if (r == -ENOTSUP) {
+ log_err(_("Required kernel crypto interface not available.\n"));
+#ifdef ENABLE_AF_ALG
+ log_err( _("Ensure you have algif_skcipher kernel module loaded.\n"));
+#endif
+ }
return r;
}
return r;
}
@@
-654,7
+657,7
@@
static int action_luksFormat(void)
else if (opt_urandom)
crypt_set_rng_type(cd, CRYPT_RNG_URANDOM);
else if (opt_urandom)
crypt_set_rng_type(cd, CRYPT_RNG_URANDOM);
- r = tools_get_key(_("Enter
LUKS
passphrase: "), &password, &passwordLen,
+ r = tools_get_key(_("Enter passphrase: "), &password, &passwordLen,
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout, _verify_passphrase(1), 1, cd);
if (r < 0)
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout, _verify_passphrase(1), 1, cd);
if (r < 0)
@@
-825,7
+828,7
@@
static int action_luksKillSlot(void)
if (!opt_batch_mode) {
r = verify_keyslot(cd, opt_key_slot,
_("This is the last keyslot. Device will become unusable after purging this key."),
if (!opt_batch_mode) {
r = verify_keyslot(cd, opt_key_slot,
_("This is the last keyslot. Device will become unusable after purging this key."),
- _("Enter any remaining
LUKS
passphrase: "),
+ _("Enter any remaining passphrase: "),
opt_key_file, opt_keyfile_offset, opt_keyfile_size);
if (r < 0)
goto out;
opt_key_file, opt_keyfile_offset, opt_keyfile_size);
if (r < 0)
goto out;
@@
-853,7
+856,7
@@
static int action_luksRemoveKey(void)
if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
goto out;
if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
goto out;
- r = tools_get_key(_("Enter
LUKS
passphrase to be deleted: "),
+ r = tools_get_key(_("Enter passphrase to be deleted: "),
&password, &passwordLen,
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout,
&password, &passwordLen,
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout,
@@
-922,7
+925,7
@@
static int action_luksAddKey(void)
opt_key_file, opt_keyfile_size, opt_keyfile_offset,
opt_new_key_file, opt_new_keyfile_size, opt_new_keyfile_offset);
} else {
opt_key_file, opt_keyfile_size, opt_keyfile_offset,
opt_new_key_file, opt_new_keyfile_size, opt_new_keyfile_offset);
} else {
- r = tools_get_key(_("Enter any passphrase: "),
+ r = tools_get_key(_("Enter any
existing
passphrase: "),
&password, &password_size, 0, 0, NULL,
opt_timeout, _verify_passphrase(0), 0, cd);
&password, &password_size, 0, 0, NULL,
opt_timeout, _verify_passphrase(0), 0, cd);
@@
-971,7
+974,7
@@
static int action_luksChangeKey(void)
if (opt_iteration_time)
crypt_set_iteration_time(cd, opt_iteration_time);
if (opt_iteration_time)
crypt_set_iteration_time(cd, opt_iteration_time);
- r = tools_get_key(_("Enter
LUKS
passphrase to be changed: "),
+ r = tools_get_key(_("Enter passphrase to be changed: "),
&password, &password_size,
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout, _verify_passphrase(0), 0, cd);
&password, &password_size,
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout, _verify_passphrase(0), 0, cd);
@@
-985,7
+988,7
@@
static int action_luksChangeKey(void)
if (r < 0)
goto out;
if (r < 0)
goto out;
- r = tools_get_key(_("Enter new
LUKS
passphrase: "),
+ r = tools_get_key(_("Enter new passphrase: "),
&password_new, &password_new_size,
opt_new_keyfile_offset, opt_new_keyfile_size,
opt_new_key_file,
&password_new, &password_new_size,
opt_new_keyfile_offset, opt_new_keyfile_size,
opt_new_key_file,
@@
-1007,6
+1010,12
@@
static int action_isLuks(void)
struct crypt_device *cd = NULL;
int r;
struct crypt_device *cd = NULL;
int r;
+ /* FIXME: argc > max should be checked for other operations as well */
+ if (action_argc > 1) {
+ log_err(_("Only one device argument for isLuks operation is supported.\n"));
+ return -ENODEV;
+ }
+
if ((r = crypt_init(&cd, action_argv[0])))
goto out;
if ((r = crypt_init(&cd, action_argv[0])))
goto out;
@@
-1064,7
+1073,7
@@
static int luksDump_with_volume_key(struct crypt_device *cd)
if (!vk)
return -ENOMEM;
if (!vk)
return -ENOMEM;
- r = tools_get_key(_("Enter
LUKS
passphrase: "), &password, &passwordLen,
+ r = tools_get_key(_("Enter passphrase: "), &password, &passwordLen,
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout, 0, 0, cd);
if (r < 0)
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
opt_timeout, 0, 0, cd);
if (r < 0)
@@
-1497,7
+1506,7
@@
int main(int argc, const char **argv)
usage(popt_context, EXIT_FAILURE, _("Unknown action."),
poptGetInvocationName(popt_context));
usage(popt_context, EXIT_FAILURE, _("Unknown action."),
poptGetInvocationName(popt_context));
- if(action_argc < action->required_action_argc)
+ if
(action_argc < action->required_action_argc)
help_args(action, popt_context);
/* FIXME: rewrite this from scratch */
help_args(action, popt_context);
/* FIXME: rewrite this from scratch */