mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-21 16:08:31 +00:00
parent
8d21988656
commit
03428329ef
@ -5,15 +5,16 @@
|
|||||||
|
|
||||||
#include "magiskboot.h"
|
#include "magiskboot.h"
|
||||||
|
|
||||||
|
#define MATCH(p) else if (strncmp(s + skip, p, sizeof(p) - 1) == 0) skip += (sizeof(p) - 1)
|
||||||
|
|
||||||
static int check_verity_pattern(const char *s) {
|
static int check_verity_pattern(const char *s) {
|
||||||
int skip = 0;
|
int skip = s[0] == ',';
|
||||||
if (s[0] == ',') ++skip;
|
|
||||||
if (strncmp(s + skip, "verify", 6) == 0)
|
if (0) {}
|
||||||
skip += 6;
|
MATCH("verify");
|
||||||
else if (strncmp(s + skip, "avb", 3) == 0)
|
MATCH("avb");
|
||||||
skip += 3;
|
MATCH("support_scfs");
|
||||||
else
|
else return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (s[skip] == '=') {
|
if (s[skip] == '=') {
|
||||||
while (s[skip] != '\0' && s[skip] != ' ' && s[skip] != '\n' && s[skip] != ',')
|
while (s[skip] != '\0' && s[skip] != ' ' && s[skip] != '\n' && s[skip] != ',')
|
||||||
@ -22,14 +23,15 @@ static int check_verity_pattern(const char *s) {
|
|||||||
return skip;
|
return skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef MATCH
|
||||||
|
#define MATCH(p) else if (strncmp(s, p, sizeof(p) - 1) == 0) return (sizeof(p) - 1)
|
||||||
|
|
||||||
static int check_encryption_pattern(const char *s) {
|
static int check_encryption_pattern(const char *s) {
|
||||||
constexpr const char *encrypt_list[] = { "forceencrypt", "forcefdeorfbe" };
|
if (0) {}
|
||||||
for (auto enc : encrypt_list) {
|
MATCH("forceencrypt");
|
||||||
int len = strlen(enc);
|
MATCH("forcefdeorfbe");
|
||||||
if (strncmp(s, enc, len) == 0)
|
MATCH("fileencryption");
|
||||||
return len;
|
else return -1;
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *patch_verity(const void *buf, uint32_t &size, bool inplace) {
|
char *patch_verity(const void *buf, uint32_t &size, bool inplace) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user