mknkboot/beastpatcher: implement basic firmware validation

This imports the MD5 code used by other utilities and creates
a function for checking the provided NK.bin against known original
firmware checksums. Integration into mknkboot and beastpatcher is
also added.

For the sake of consistency with beastpatcher, mknkboot had its
printf statements rewrote to print to stderr like beastpatcher
does.

Change-Id: I0e52271d8d627a5b02302ab5cd1da2815b7cec1e
This commit is contained in:
James Buren 2021-06-12 06:25:25 +00:00
parent fe9bcd0468
commit a90ef8195b
6 changed files with 329 additions and 14 deletions

View file

@ -33,9 +33,9 @@ CC = $(CROSS)gcc
all: $(OUTPUT)
SOURCES = beastpatcher.c bootimg.c mknkboot.c main.c
HEADERS = beastpatcher.h mtp_common.h bootimg.h mknkboot.h
OBJS = beastpatcher.o bootimg.o mknkboot.o main.o mtp_libmtp.o
SOURCES = beastpatcher.c bootimg.c mknkboot.c md5.c main.c
HEADERS = beastpatcher.h mtp_common.h bootimg.h mknkboot.h md5.h
OBJS = beastpatcher.o bootimg.o mknkboot.o md5.o main.o mtp_libmtp.o
MTPSRCS_W32 = mtp_win32.c
MTPSRCS_MTP = mtp_libmtp.c
@ -71,7 +71,7 @@ bin2c: ../../../rbutil/tools/bin2c.c
bootimg.c: bootloader.bin bin2c
./bin2c bootloader.bin bootimg
mknkboot: mknkboot.c
mknkboot: mknkboot.c md5.c
$(SILENT)$(NATIVECC) $(CFLAGS) $+ -o $@
clean:
rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h mknkboot *~ *.o beastpatcher.dmg