Update some format magics

This commit is contained in:
topjohnwu 2019-03-08 00:47:15 -05:00
parent 1bde78d121
commit a57a94040e
2 changed files with 8 additions and 6 deletions

View File

@ -31,7 +31,7 @@ format_t check_fmt(const void *buf, size_t len) {
return ELF32; return ELF32;
} else if (MATCH(ELF64_MAGIC)) { } else if (MATCH(ELF64_MAGIC)) {
return ELF64; return ELF64;
} else if (MATCH(GZIP_MAGIC)) { } else if (MATCH(GZIP1_MAGIC) || MATCH(GZIP2_MAGIC)) {
return GZIP; return GZIP;
} else if (MATCH(LZOP_MAGIC)) { } else if (MATCH(LZOP_MAGIC)) {
return LZOP; return LZOP;
@ -42,7 +42,7 @@ format_t check_fmt(const void *buf, size_t len) {
return LZMA; return LZMA;
} else if (MATCH(BZIP_MAGIC)) { } else if (MATCH(BZIP_MAGIC)) {
return BZIP2; return BZIP2;
} else if (MATCH(LZ4_MAGIC)) { } else if (MATCH(LZ41_MAGIC) || MATCH(LZ42_MAGIC)) {
return LZ4; return LZ4;
} else if (MATCH(LZ4_LEG_MAGIC)) { } else if (MATCH(LZ4_LEG_MAGIC)) {
return LZ4_LEGACY; return LZ4_LEGACY;

View File

@ -31,12 +31,14 @@ typedef enum {
#define CHROMEOS_MAGIC "CHROMEOS" #define CHROMEOS_MAGIC "CHROMEOS"
#define ELF32_MAGIC "\x7f""ELF\x01" #define ELF32_MAGIC "\x7f""ELF\x01"
#define ELF64_MAGIC "\x7f""ELF\x02" #define ELF64_MAGIC "\x7f""ELF\x02"
#define GZIP_MAGIC "\x1f\x8b\x08" #define GZIP1_MAGIC "\x1f\x8b"
#define LZOP_MAGIC "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a" #define GZIP2_MAGIC "\x1f\x9e"
#define XZ_MAGIC "\xfd""7zXZ\x00" #define LZOP_MAGIC "\x89""LZO"
#define XZ_MAGIC "\xfd""7zXZ"
#define BZIP_MAGIC "BZh" #define BZIP_MAGIC "BZh"
#define LZ4_MAGIC "\x04\x22\x4d\x18"
#define LZ4_LEG_MAGIC "\x02\x21\x4c\x18" #define LZ4_LEG_MAGIC "\x02\x21\x4c\x18"
#define LZ41_MAGIC "\x03\x21\x4c\x18"
#define LZ42_MAGIC "\x04\x22\x4d\x18"
#define MTK_MAGIC "\x88\x16\x88\x58" #define MTK_MAGIC "\x88\x16\x88\x58"
#define DTB_MAGIC "\xd0\x0d\xfe\xed" #define DTB_MAGIC "\xd0\x0d\xfe\xed"
#define LG_BUMP_MAGIC "\x41\xa9\xe4\x67\x74\x4d\x1d\x1b\xa4\x29\xf2\xec\xea\x65\x52\x79" #define LG_BUMP_MAGIC "\x41\xa9\xe4\x67\x74\x4d\x1d\x1b\xa4\x29\xf2\xec\xea\x65\x52\x79"