summaryrefslogtreecommitdiffstats
path: root/crypto/cryptfs/cryptfs.c
diff options
context:
space:
mode:
authora3955269 <a3955269>2013-01-08 17:14:56 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-08 21:09:56 +0100
commit6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1 (patch)
tree2617e02d06b317d4f40779131a9e494b163f6651 /crypto/cryptfs/cryptfs.c
parentMerge "Fix up libmincrypt rules for Android 4.2" into jb-wip (diff)
downloadandroid_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.tar
android_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.tar.gz
android_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.tar.bz2
android_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.tar.lz
android_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.tar.xz
android_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.tar.zst
android_bootable_recovery-6ff55cefd060b4c8f6c0fa97d5521516f9ee43f1.zip
Diffstat (limited to 'crypto/cryptfs/cryptfs.c')
-rw-r--r--crypto/cryptfs/cryptfs.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/crypto/cryptfs/cryptfs.c b/crypto/cryptfs/cryptfs.c
new file mode 100644
index 000000000..59e7added
--- /dev/null
+++ b/crypto/cryptfs/cryptfs.c
@@ -0,0 +1,74 @@
+/*
+ * 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;
+};