From 480e95b0e449863be3e1a5b0bc634a67df28b618 Mon Sep 17 00:00:00 2001
From: Solar <solar@openwall.com>
Date: Thu, 18 Dec 2014 21:24:01 +0100
Subject: [PATCH] Fix a bug in truecrypt for non-x86 archs. Closes #912.

---
 src/truecrypt_fmt_plug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/truecrypt_fmt_plug.c b/src/truecrypt_fmt_plug.c
index 1c95c39..8cef85e 100644
--- a/src/truecrypt_fmt_plug.c
+++ b/src/truecrypt_fmt_plug.c
@@ -310,8 +310,8 @@ static int crypt_all(int *pcount, struct db_salt *salt)
 			pbkdf2_sha512_sse((const unsigned char **)pin, lens, psalt->salt, 64, psalt->num_iterations, &(x.poutc), sizeof(key), 0);
 		}
 #else
-		if (is_sha512)
-			pbkdf2_sha512((const unsigned char*)key_buffer[i], strlen(key_buffer[i]), psalt->salt, 64, num_iterations, key, sizeof(key), 0);
+		if (psalt->hash_type == IS_SHA512)
+			pbkdf2_sha512((const unsigned char*)key_buffer[i], strlen((char*)key_buffer[i]), psalt->salt, 64, psalt->num_iterations, key, sizeof(key), 0);
 #endif
 		else if (psalt->hash_type == IS_RIPEMD160)
 			pbkdf2_ripemd160(key_buffer[i], strlen((char*)(key_buffer[i])), psalt->salt, 64, psalt->num_iterations, key, sizeof(key), 0);