diff options
authorZbigniew Jędrzejewski-Szmek <>2014-11-24 09:11:12 -0500
committerZbigniew Jędrzejewski-Szmek <>2014-11-24 09:14:18 -0500
commit8a52210c9392887a31fdb2845f65b4c5869e8e66 (patch)
parent056edeb9102c5ba455e1a54af70f282b6138ca33 (diff)
cryptsetup: default to no hash when keyfile is specified
For plain dm-crypt devices, the behavior of cryptsetup package is to ignore the hash algorithm when a key file is provided. It seems wrong to ignore a hash when it is explicitly specified, but we should default to no hash if the keyfile is specified.
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 94570eb82..b9e67fa63 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -400,7 +400,9 @@ static int attach_luks_or_plain(struct crypt_device *cd,
/* plain isn't a real hash type. it just means "use no hash" */
if (!streq(arg_hash, "plain"))
params.hash = arg_hash;
- } else
+ } else if (!key_file)
+ /* for CRYPT_PLAIN, the behaviour of cryptsetup
+ * package is to not hash when a key file is provided */
params.hash = "ripemd160";
if (arg_cipher) {