summaryrefslogtreecommitdiffstats
path: root/crypto/ics/cryptfs.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-02-26 21:00:54 +0100
committerGerrit Code Review <gerrit2@gerrit>2014-02-26 21:00:54 +0100
commit5e73cc7703ef8ed8f08cc6e8704349e1ec374334 (patch)
tree7fe3c75a2fada291c9b5004a08ec54483dbddc9c /crypto/ics/cryptfs.c
parentMerge "Check auto generated backup names for invalid characters" into android-4.4 (diff)
parentCheck crypto footer before offering to decrypt (diff)
downloadandroid_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.tar
android_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.tar.gz
android_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.tar.bz2
android_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.tar.lz
android_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.tar.xz
android_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.tar.zst
android_bootable_recovery-5e73cc7703ef8ed8f08cc6e8704349e1ec374334.zip
Diffstat (limited to 'crypto/ics/cryptfs.c')
-rw-r--r--crypto/ics/cryptfs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/crypto/ics/cryptfs.c b/crypto/ics/cryptfs.c
index 193339ec9..4f3d5d01a 100644
--- a/crypto/ics/cryptfs.c
+++ b/crypto/ics/cryptfs.c
@@ -653,6 +653,28 @@ int cryptfs_crypto_complete(void)
return -1;
}
+int cryptfs_check_footer(void)
+{
+ int rc = -1;
+ char fs_type[PROPERTY_VALUE_MAX];
+ char real_blkdev[MAXPATHLEN];
+ char fs_options[PROPERTY_VALUE_MAX];
+ unsigned long mnt_flags;
+ struct crypt_mnt_ftr crypt_ftr;
+ /* Allocate enough space for a 256 bit key, but we may use less */
+ unsigned char encrypted_master_key[256];
+ unsigned char salt[SALT_LEN];
+
+ if (get_orig_mount_parms(DATA_MNT_POINT, fs_type, real_blkdev, &mnt_flags, fs_options)) {
+ printf("Error reading original mount parms for mount point %s\n", DATA_MNT_POINT);
+ return rc;
+ }
+
+ rc = get_crypt_ftr_and_key(real_blkdev, &crypt_ftr, encrypted_master_key, salt);
+
+ return rc;
+}
+
int cryptfs_check_passwd(const char *passwd)
{
char pwbuf[256];