Merge "Fix encrypt-and-wipe" into lmp-mr1-dev

gugelfrei
Paul Lawrence 10 years ago committed by Android (Google) Code Review
commit d44a8f59a7

@ -3186,7 +3186,8 @@ int cryptfs_enable_internal(char *howarg, int crypt_type, char *passwd,
}
/* Calculate checksum if we are not finished */
if (!rc && crypt_ftr.encrypted_upto != crypt_ftr.fs_size) {
if (!rc && how == CRYPTO_ENABLE_INPLACE
&& crypt_ftr.encrypted_upto != crypt_ftr.fs_size) {
rc = cryptfs_SHA256_fileblock(crypto_blkdev,
crypt_ftr.hash_first_block);
if (rc) {
@ -3204,7 +3205,8 @@ int cryptfs_enable_internal(char *howarg, int crypt_type, char *passwd,
/* Success */
crypt_ftr.flags &= ~CRYPT_INCONSISTENT_STATE;
if (crypt_ftr.encrypted_upto != crypt_ftr.fs_size) {
if (how == CRYPTO_ENABLE_INPLACE
&& crypt_ftr.encrypted_upto != crypt_ftr.fs_size) {
SLOGD("Encrypted up to sector %lld - will continue after reboot",
crypt_ftr.encrypted_upto);
crypt_ftr.flags |= CRYPT_ENCRYPTION_IN_PROGRESS;
@ -3212,7 +3214,8 @@ int cryptfs_enable_internal(char *howarg, int crypt_type, char *passwd,
put_crypt_ftr_and_key(&crypt_ftr);
if (crypt_ftr.encrypted_upto == crypt_ftr.fs_size) {
if (how == CRYPTO_ENABLE_WIPE
|| crypt_ftr.encrypted_upto == crypt_ftr.fs_size) {
char value[PROPERTY_VALUE_MAX];
property_get("ro.crypto.state", value, "");
if (!strcmp(value, "")) {

Loading…
Cancel
Save