[PATCH] crypt_plain_hash: Remove dead code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since commit 31a4d552a2d9 ("Support keyfile offset and keyfile size option even for plain volumes.")
params.hash is set to NULL when the requested hash function is
"plain". Therfore the code to handle the "plain" hasher in
crypt_plain_hash() is no longer reachable and can be removed.

Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
 lib/crypt_plain.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/lib/crypt_plain.c b/lib/crypt_plain.c
index f89c7747649d..66339bdbf2c9 100644
--- a/lib/crypt_plain.c
+++ b/lib/crypt_plain.c
@@ -99,17 +99,7 @@ int crypt_plain_hash(struct crypt_device *cd,
 		pad_size = 0;
 	}
 
-	/* No hash, copy passphrase directly */
-	if (!strcmp(hash_name_buf, "plain")) {
-		if (passphrase_size < hash_size) {
-			log_dbg(cd, "Too short plain passphrase.");
-			return -EINVAL;
-		}
-		memcpy(key, passphrase, hash_size);
-		r = 0;
-	} else
-		r = hash(hash_name_buf, hash_size, key, passphrase_size, passphrase);
-
+	r = hash(hash_name_buf, hash_size, key, passphrase_size, passphrase);
 	if (r == 0 && pad_size)
 		memset(key + hash_size, 0, pad_size);
 
-- 
2.20.1

_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
https://www.saout.de/mailman/listinfo/dm-crypt



[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux