[PATCH] crypt_plain_hash: Remove dead code

Richard Weinberger <richard-/[email protected]>
Newsgroups gmane.linux.kernel.device-mapper.dm-crypt
Message-ID <[email protected]>
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-/[email protected]>
---
 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
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.