From 253368a0726120efa57664cdd1d088af099a3d81 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Tue, 25 Nov 2014 15:00:52 -0600 Subject: Reduce libs needed for decrypt and clean up old decypt files Trim cryptfs.c to remove functions that TWRP does not use for decrypt and remove the need for libfs_mgr from cryptfs.c by passing some items to cryptfs.c from the partition manager. Add support for new fstab flags: encryptable and forceencrypt=/path/to/cryptokey For example: flags=forceencrypt=/dev/block/platform/sdhci-tegra.3/by-name/MD1 Note that "footer" is the default, so you do not need to set this flag on devices that use the footer for the crypto key. Also add mounttodecrypt if you need to mount a partition during the decrypt cycle for firmware of proprietary libs. Clean up decrypt and only support one version Android 5.0 lollipop decrypt should be backwards compatible with older versions so we will only support one version, 1.3 that came with 5.0 lollipop. Remove support for Samsung TouchWiz decrypt. It does not work with the latest versions of Samsung encryption anyway and it has not been updated to work with any AOSP decryption higher than 1.1 Change-Id: I2d9c6e31df50268c91ee642c2fa090f901d9d5c9 --- crypto/cryptfs/cryptfs.c | 74 ------------------------------------------------ 1 file changed, 74 deletions(-) delete mode 100644 crypto/cryptfs/cryptfs.c (limited to 'crypto/cryptfs/cryptfs.c') diff --git a/crypto/cryptfs/cryptfs.c b/crypto/cryptfs/cryptfs.c deleted file mode 100644 index 59e7added..000000000 --- a/crypto/cryptfs/cryptfs.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013 a3955269 all rights reversed, no rights reserved. - */ - -#define TW_INCLUDE_CRYPTO_SAMSUNG -#include "../ics/cryptfs.c" - -int dm_remove_device(const char *name) -{ - int r; - r = delete_crypto_blk_dev(name); - if(!r) - printf("crypto block device '%s' deleted.\n", name); - else - printf("deleting crypto block device '%s' failed. [%d - %s]\n", name, r, strerror(errno)); - return r; -} - -int ecryptfs_test(const char *pw) -{ - char pwbuf[256]; - int r; - - strcpy(pwbuf, pw); - // 0: building options without file encryption filtering. - // 1: building options with media files filtering. - // 2: building options with all new files filtering. - r = mount_ecryptfs_drive(pwbuf, "/emmc", "/emmc", 0); - printf("mount_ecryptfs_drive: %d\n", r); - r = mount("/dev/block/mmcblk1", "/emmc", "vfat", MS_RDONLY, ""); - printf("mount: %d\n", r); - - r = umount("/emmc");///dev/block/mmcblk1"); - printf("umount: %d\n", r); - - //r = unmount_ecryptfs_drive("/emmc"); - //printf("unmount_ecryptfs_drive: %d\n", r); - - return r; -} - -int main(int argc, char* argv[]) -{ - if(argc < 2) - { - printf("no args!\n"); - return 1; - } - - property_set("ro.crypto.state", "encrypted"); - - property_set("ro.crypto.fs_type", CRYPTO_FS_TYPE); - property_set("ro.crypto.fs_real_blkdev", CRYPTO_REAL_BLKDEV); - property_set("ro.crypto.fs_mnt_point", CRYPTO_MNT_POINT); - property_set("ro.crypto.fs_options", CRYPTO_FS_OPTIONS); - property_set("ro.crypto.fs_flags", CRYPTO_FS_FLAGS); - property_set("ro.crypto.keyfile.userdata", CRYPTO_KEY_LOC); - -#ifdef CRYPTO_SD_FS_TYPE - property_set("ro.crypto.sd_fs_type", CRYPTO_SD_FS_TYPE); - property_set("ro.crypto.sd_fs_real_blkdev", CRYPTO_SD_REAL_BLKDEV); - property_set("ro.crypto.sd_fs_mnt_point", EXPAND(TW_INTERNAL_STORAGE_PATH)); -#endif - - property_set("rw.km_fips_status", "ready"); - - delete_crypto_blk_dev("userdata"); - delete_crypto_blk_dev("sdcard"); - delete_crypto_blk_dev("emmc"); - - cryptfs_check_passwd(argv[1]); - - return 0; -}; -- cgit v1.2.3