summaryrefslogtreecommitdiff
path: root/src/cryptsetup/cryptsetup.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-11-06 09:49:27 -0500
committerDave Reisner <dreisner@archlinux.org>2012-11-06 09:53:00 -0500
commit65343c749441322d1e65e8bb5d433b6fee8c28bf (patch)
tree17ac67031517e649cbb0d348de50897bafff25da /src/cryptsetup/cryptsetup.c
parentaea54018a5e66a41318afb6c6be745b6aef48d9e (diff)
cryptsetup: hash=plain means don't use a hash
"plain" is a semantic value that cryptsetup(8) uses to describe a plain dm-crypt volume that does not use a hash. Catch this value earlier and ensure that a NULL params.hash is passed to crypt_format to avoid passing an invalid hash type to the libcryptsetup backend. FDO bug #56593.
Diffstat (limited to 'src/cryptsetup/cryptsetup.c')
-rw-r--r--src/cryptsetup/cryptsetup.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 916509ab93..e8ba3f02a3 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -342,7 +342,12 @@ int main(int argc, char *argv[]) {
opt_tries = opt_tries > 0 ? opt_tries : 3;
opt_key_size = (opt_key_size > 0 ? opt_key_size : 256);
- hash = opt_hash ? opt_hash : "ripemd160";
+ if (opt_hash) {
+ /* plain isn't a real hash type. it just means "use no hash" */
+ if (!streq(opt_hash, "plain"))
+ hash = opt_hash;
+ } else
+ hash = "ripemd160";
if (opt_cipher) {
size_t l;
@@ -463,7 +468,7 @@ int main(int argc, char *argv[]) {
opt_keyfile_size,
&params);
- pass_volume_key = streq(hash, "plain");
+ pass_volume_key = !!hash;
}
if (k < 0) {