return 0;
}
rc = cryptfs_check_passwd(argv[2]);
+ } else if (!strcmp(argv[1], "restart")) {
+ if (argc != 2) {
+ cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: cryptfs restart", false);
+ return 0;
+ }
+ rc = cryptfs_restart();
} else if (!strcmp(argv[1], "enablecrypto")) {
if ( (argc != 4) || (strcmp(argv[2], "wipe") && strcmp(argv[2], "inplace")) ) {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: cryptfs enablecrypto <wipe|inplace> <passwd>", false);
return rc;
}
-static int cryptfs_restart(char *crypto_blkdev)
+int cryptfs_restart(void)
{
char fs_type[32];
char real_blkdev[MAXPATHLEN];
+ char crypto_blkdev[MAXPATHLEN];
char fs_options[256];
unsigned long mnt_flags;
struct stat statbuf;
* the tmpfs filesystem, and mount the real one.
*/
+ property_get("ro.crypto.fs_crypto_blkdev", crypto_blkdev, "");
+ if (strlen(crypto_blkdev) == 0) {
+ SLOGE("fs_crypto_blkdev not set\n");
+ return -1;
+ }
+
if (! get_orig_mount_parms("/data", fs_type, real_blkdev, &mnt_flags, fs_options)) {
SLOGD("Just got orig mount parms\n");
rc = crypt_ftr.failed_decrypt_count;
} else {
- /* Woot! Success! Time to do the magic of unmounting the tmpfs
- * disk and mounting the encrypted one.
+ /* Woot! Success! Save the name of the crypto block device
+ * so we can mount it when restarting the framework.
*/
- rc = cryptfs_restart(crypto_blkdev);
+ property_set("ro.crypto.fs_crypto_blkdev", crypto_blkdev);
+ rc = 0;
}
return rc;
extern "C" {
#endif
int cryptfs_check_passwd(char *pw);
+ int cryptfs_restart(void);
int cryptfs_enable(char *flag, char *passwd);
#ifdef __cplusplus
}