blob: 59e7added19f46ce17bb2389c27d0556fd0b6801 [file] [log] [blame]
a39552696ff55ce2013-01-08 16:14:56 +00001/*
2 * Copyright (c) 2013 a3955269 all rights reversed, no rights reserved.
3 */
4
5#define TW_INCLUDE_CRYPTO_SAMSUNG
6#include "../ics/cryptfs.c"
7
8int dm_remove_device(const char *name)
9{
10 int r;
11 r = delete_crypto_blk_dev(name);
12 if(!r)
13 printf("crypto block device '%s' deleted.\n", name);
14 else
15 printf("deleting crypto block device '%s' failed. [%d - %s]\n", name, r, strerror(errno));
16 return r;
17}
18
19int ecryptfs_test(const char *pw)
20{
21 char pwbuf[256];
22 int r;
23
24 strcpy(pwbuf, pw);
25 // 0: building options without file encryption filtering.
26 // 1: building options with media files filtering.
27 // 2: building options with all new files filtering.
28 r = mount_ecryptfs_drive(pwbuf, "/emmc", "/emmc", 0);
29 printf("mount_ecryptfs_drive: %d\n", r);
30 r = mount("/dev/block/mmcblk1", "/emmc", "vfat", MS_RDONLY, "");
31 printf("mount: %d\n", r);
32
33 r = umount("/emmc");///dev/block/mmcblk1");
34 printf("umount: %d\n", r);
35
36 //r = unmount_ecryptfs_drive("/emmc");
37 //printf("unmount_ecryptfs_drive: %d\n", r);
38
39 return r;
40}
41
42int main(int argc, char* argv[])
43{
44 if(argc < 2)
45 {
46 printf("no args!\n");
47 return 1;
48 }
49
50 property_set("ro.crypto.state", "encrypted");
51
52 property_set("ro.crypto.fs_type", CRYPTO_FS_TYPE);
53 property_set("ro.crypto.fs_real_blkdev", CRYPTO_REAL_BLKDEV);
54 property_set("ro.crypto.fs_mnt_point", CRYPTO_MNT_POINT);
55 property_set("ro.crypto.fs_options", CRYPTO_FS_OPTIONS);
56 property_set("ro.crypto.fs_flags", CRYPTO_FS_FLAGS);
57 property_set("ro.crypto.keyfile.userdata", CRYPTO_KEY_LOC);
58
59#ifdef CRYPTO_SD_FS_TYPE
60 property_set("ro.crypto.sd_fs_type", CRYPTO_SD_FS_TYPE);
61 property_set("ro.crypto.sd_fs_real_blkdev", CRYPTO_SD_REAL_BLKDEV);
62 property_set("ro.crypto.sd_fs_mnt_point", EXPAND(TW_INTERNAL_STORAGE_PATH));
63#endif
64
65 property_set("rw.km_fips_status", "ready");
66
67 delete_crypto_blk_dev("userdata");
68 delete_crypto_blk_dev("sdcard");
69 delete_crypto_blk_dev("emmc");
70
71 cryptfs_check_passwd(argv[1]);
72
73 return 0;
74};