|
|
@ -482,10 +482,11 @@ static int wait_and_unmount(char *mountpoint)
|
|
|
|
return rc;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int cryptfs_restart(char *crypto_blkdev)
|
|
|
|
int cryptfs_restart(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char fs_type[32];
|
|
|
|
char fs_type[32];
|
|
|
|
char real_blkdev[MAXPATHLEN];
|
|
|
|
char real_blkdev[MAXPATHLEN];
|
|
|
|
|
|
|
|
char crypto_blkdev[MAXPATHLEN];
|
|
|
|
char fs_options[256];
|
|
|
|
char fs_options[256];
|
|
|
|
unsigned long mnt_flags;
|
|
|
|
unsigned long mnt_flags;
|
|
|
|
struct stat statbuf;
|
|
|
|
struct stat statbuf;
|
|
|
@ -516,6 +517,12 @@ static int cryptfs_restart(char *crypto_blkdev)
|
|
|
|
* the tmpfs filesystem, and mount the real one.
|
|
|
|
* 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)) {
|
|
|
|
if (! get_orig_mount_parms("/data", fs_type, real_blkdev, &mnt_flags, fs_options)) {
|
|
|
|
SLOGD("Just got orig mount parms\n");
|
|
|
|
SLOGD("Just got orig mount parms\n");
|
|
|
|
|
|
|
|
|
|
|
@ -622,10 +629,11 @@ static int test_mount_encrypted_fs(char *passwd, char *mount_point)
|
|
|
|
rc = crypt_ftr.failed_decrypt_count;
|
|
|
|
rc = crypt_ftr.failed_decrypt_count;
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/* Woot! Success! Time to do the magic of unmounting the tmpfs
|
|
|
|
/* Woot! Success! Save the name of the crypto block device
|
|
|
|
* disk and mounting the encrypted one.
|
|
|
|
* 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;
|
|
|
|
return rc;
|
|
|
|