mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
Support file based encryption and several small updates
This commit is contained in:
parent
3ec9ff7467
commit
20903784a4
@ -243,12 +243,11 @@ static void cpio_dmverity(struct vector *v) {
|
|||||||
static void cpio_forceencrypt(struct vector *v) {
|
static void cpio_forceencrypt(struct vector *v) {
|
||||||
cpio_file *f;
|
cpio_file *f;
|
||||||
size_t read, write;
|
size_t read, write;
|
||||||
#define ENCRYPT_LIST_SIZE 2
|
const char *ENCRYPT_LIST[] = { "forceencrypt", "forcefdeorfbe", "fileencryptioninline", NULL };
|
||||||
const char *ENCRYPT_LIST[ENCRYPT_LIST_SIZE] = { "forceencrypt", "forcefdeorfbe" };
|
|
||||||
vec_for_each(v, f) {
|
vec_for_each(v, f) {
|
||||||
if (strstr(f->filename, "fstab") != NULL && S_ISREG(f->mode)) {
|
if (strstr(f->filename, "fstab") != NULL && S_ISREG(f->mode)) {
|
||||||
for (read = 0, write = 0; read < f->filesize; ++read, ++write) {
|
for (read = 0, write = 0; read < f->filesize; ++read, ++write) {
|
||||||
for (int i = 0 ; i < ENCRYPT_LIST_SIZE; ++i) {
|
for (int i = 0 ; ENCRYPT_LIST[i]; ++i) {
|
||||||
if (strncmp(f->data + read, ENCRYPT_LIST[i], strlen(ENCRYPT_LIST[i])) == 0) {
|
if (strncmp(f->data + read, ENCRYPT_LIST[i], strlen(ENCRYPT_LIST[i])) == 0) {
|
||||||
memcpy(f->data + write, "encryptable", 11);
|
memcpy(f->data + write, "encryptable", 11);
|
||||||
printf("Replace [%s] with [%s] in [%s]\n", ENCRYPT_LIST[i], "encryptable", f->filename);
|
printf("Replace [%s] with [%s] in [%s]\n", ENCRYPT_LIST[i], "encryptable", f->filename);
|
||||||
|
@ -132,8 +132,5 @@ void repack(const char* orig_image, const char* out_image) {
|
|||||||
print_info();
|
print_info();
|
||||||
|
|
||||||
munmap(orig, size);
|
munmap(orig, size);
|
||||||
if (lseek(fd, 0, SEEK_END) > size) {
|
|
||||||
LOGE(2, "Boot partition too small!\n");
|
|
||||||
}
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,6 @@ void cleanup() {
|
|||||||
unlink(RAMDISK_FILE ".unsupport");
|
unlink(RAMDISK_FILE ".unsupport");
|
||||||
unlink(SECOND_FILE);
|
unlink(SECOND_FILE);
|
||||||
unlink(DTB_FILE);
|
unlink(DTB_FILE);
|
||||||
unlink(NEW_BOOT);
|
|
||||||
for (int i = 0; SUP_EXT_LIST[i]; ++i) {
|
for (int i = 0; SUP_EXT_LIST[i]; ++i) {
|
||||||
sprintf(name, "%s.%s", RAMDISK_FILE, SUP_EXT_LIST[i]);
|
sprintf(name, "%s.%s", RAMDISK_FILE, SUP_EXT_LIST[i]);
|
||||||
unlink(name);
|
unlink(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user