Merge changes If22008be,Id0049ce6

* changes:
  Make encryption configurable
  Provide a way to select force encryption from vendor partition
This commit is contained in:
Paul Lawrence 2015-01-28 21:14:09 +00:00 committed by Gerrit Code Review
commit 07dcb12e3e
4 changed files with 17 additions and 2 deletions

View File

@ -258,6 +258,15 @@ static int device_is_secure() {
return strcmp(value, "0") ? 1 : 0;
}
static int device_is_force_encrypted() {
int ret = -1;
char value[PROP_VALUE_MAX];
ret = __system_property_get("ro.vold.forceencryption", value);
if (ret < 0)
return 0;
return strcmp(value, "1") ? 0 : 1;
}
/*
* Tries to mount any of the consecutive fstab entries that match
* the mountpoint of the one given by fstab->recs[start_idx].
@ -468,7 +477,7 @@ int fs_mgr_mount_all(struct fstab *fstab)
/* Deal with encryptability. */
if (!mret) {
/* If this is encryptable, need to trigger encryption */
if ((fstab->recs[attempted_idx].fs_mgr_flags & MF_FORCECRYPT)) {
if (fs_mgr_is_encryptable(&fstab->recs[attempted_idx])) {
if (umount(fstab->recs[attempted_idx].mount_point) == 0) {
if (encryptable == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
ERROR("Will try to encrypt %s %s\n", fstab->recs[attempted_idx].mount_point,

View File

@ -428,6 +428,11 @@ int fs_mgr_is_encryptable(struct fstab_rec *fstab)
return fstab->fs_mgr_flags & (MF_CRYPT | MF_FORCECRYPT);
}
int fs_mgr_is_force_encrypted(struct fstab_rec *fstab)
{
return fstab->fs_mgr_flags & MF_FORCECRYPT;
}
int fs_mgr_is_noemulatedsd(struct fstab_rec *fstab)
{
return fstab->fs_mgr_flags & MF_NOEMULATEDSD;

View File

@ -83,6 +83,7 @@ int fs_mgr_is_voldmanaged(struct fstab_rec *fstab);
int fs_mgr_is_nonremovable(struct fstab_rec *fstab);
int fs_mgr_is_verified(struct fstab_rec *fstab);
int fs_mgr_is_encryptable(struct fstab_rec *fstab);
int fs_mgr_is_force_encrypted(struct fstab_rec *fstab);
int fs_mgr_is_noemulatedsd(struct fstab_rec *fstab);
int fs_mgr_swapon_all(struct fstab *fstab);
#ifdef __cplusplus

View File

@ -581,7 +581,7 @@ service defaultcrypto /system/bin/vdc --wait cryptfs mountdefaultencrypted
# encryption) or trigger_restart_min_framework (other encryption)
# One shot invocation to encrypt unencrypted volumes
service encrypt /system/bin/vdc --wait cryptfs enablecrypto inplace default
service encrypt /system/bin/vdc --wait cryptfs maybeenabledefaultcrypto
disabled
oneshot
# vold will set vold.decrypt to trigger_restart_framework (default