blob: 7051a6d7b4506f7ebf2176bd76c0205bb46cb8c8 [file] [log] [blame]
Ethan Yonker98661c12018-10-17 08:39:28 -05001#include <stdio.h>
2#include <string.h>
3#include <sys/types.h>
4#include <linux/types.h>
5#include <sys/wait.h>
6#include <sys/stat.h>
7#include <ctype.h>
8#include <fcntl.h>
9#include <inttypes.h>
10#include <unistd.h>
11#include <stdio.h>
12#include <sys/ioctl.h>
13#include <linux/dm-ioctl.h>
14#include <libgen.h>
15#include <stdlib.h>
16#include <sys/param.h>
17#include <string.h>
18#include <sys/mount.h>
19#include <openssl/evp.h>
20#include <errno.h>
21#include <linux/kdev_t.h>
22#include <time.h>
23#include "cryptfs.h"
24#include "cutils/properties.h"
25#include "crypto_scrypt.h"
26
27void usage() {
28 printf(" Usage:\n");
29 printf(" twrpdec /path/to/userdata /path/to/metadata filesystem password\n");
30 printf("\n");
31 printf(" The metadata path is the path to the footer. If no metadata\n");
32 printf(" partition is present then use footer for this argument.\n");
33 printf("\n");
34 printf(" Example:\n");
35 printf(" twrpdec /dev/block/bootdevice/by-name/userdata footer ext4 0000\n");
36}
37
38int main(int argc, char **argv) {
39 if (argc != 5) {
40 usage();
41 return -1;
42 }
43 set_partition_data(argv[1], argv[2], argv[3]);
44 //int ret = cryptfs_check_passwd("30303030");
45 int ret = cryptfs_check_passwd(argv[4]);
46 return 0;
47}