system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1.
The function PKCS5_PBKDF2_HMAC_SHA1 can fail for a number of reasons and
thus its return value should be checked and handled.
Change-Id: I0f0d8f74b58940a34df16b88434a085760822075
diff --git a/cryptfs.c b/cryptfs.c
index a905ff6..1d1a585 100644
--- a/cryptfs.c
+++ b/cryptfs.c
@@ -1253,11 +1253,9 @@
SLOGI("Using pbkdf2 for cryptfs KDF");
/* Turn the password into a key and IV that can decrypt the master key */
- PKCS5_PBKDF2_HMAC_SHA1(passwd, strlen(passwd),
- salt, SALT_LEN,
- HASH_COUNT, KEY_LEN_BYTES+IV_LEN_BYTES, ikey);
-
- return 0;
+ return PKCS5_PBKDF2_HMAC_SHA1(passwd, strlen(passwd), salt, SALT_LEN,
+ HASH_COUNT, KEY_LEN_BYTES + IV_LEN_BYTES,
+ ikey) != 1;
}
static int scrypt(const char *passwd, const unsigned char *salt,