Fix decrypt of odd number length PIN on hardware crypto
I am not sure if we are really fixing anything other than we are
allowing the decrypt process to continue. On hardware crypto the
password never seems to match what is expected from the data in
the footer, probably because the data is not stored in the footer
and TZ does all the work. Still, if it works, it is hard to fault
the patch.
Change-Id: Ibbb286382e82523bec2064f51fa07194f84820c2
diff --git a/crypto/lollipop/cryptfs.c b/crypto/lollipop/cryptfs.c
index 56f10b9..774eb17 100644
--- a/crypto/lollipop/cryptfs.c
+++ b/crypto/lollipop/cryptfs.c
@@ -1208,8 +1208,8 @@
unsigned char* master_key = convert_hex_ascii_to_key(passwd, &key_size);
if (!master_key) {
- printf("Failed to convert passwd from hex\n");
- return -1;
+ printf("Failed to convert passwd from hex, using passwd instead\n");
+ master_key = strdup(passwd);
}
rc = crypto_scrypt(master_key, key_size, salt, SALT_LEN,