sbtools: convert crypto to libtomcrypt.

Replace the use of crypto++ with tomcrypt, which is much smaller and C.
This gets rid of various build issues for systems that don't ship
crypo++ (i.e. everything except Linux.)

Change-Id: Ic0799e17b94935c71b14765cf9a2a7ea2b0adc7a
This commit is contained in:
Dominik Riebeling 2020-08-08 18:46:43 +02:00
parent 815b289cb3
commit 2037b837f8
6 changed files with 50 additions and 64 deletions

View file

@ -3,10 +3,11 @@ CC := gcc
CXX := g++
LD := g++
LIBUSB := $(shell pkg-config --cflags libusb-1.0)
CFLAGS := -O3 -g -std=c99 -Wall $(shell pkg-config --cflags libusb-1.0) $(DEFINES)
CXXFLAGS := -O3 -g -Wall $(pkg-config --cflags libcrypto++) $(DEFINES)
LDFLAGS := $(shell pkg-config --libs libusb-1.0) $(shell pkg-config --libs libcrypto++)
TOMCRYPT_DIR := ../../tomcrypt/
CFLAGS := -O3 -g -std=c99 -Wall $(shell pkg-config --cflags libusb-1.0) $(DEFINES) -I$(TOMCRYPT_DIR)/src/headers
CXXFLAGS := -O3 -g -Wall $(DEFINES) -I$(TOMCRYPT_DIR)/src/headers
LDFLAGS := $(shell pkg-config --libs libusb-1.0)
BINS := elftosb sbtoelf sbloader rsrctool elftosb1
all: $(BINS)
@ -17,10 +18,10 @@ all: $(BINS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
sbtoelf: sbtoelf.o crc.o crypto.o xorcrypt.o dbparser.o elf.o misc.o sb.o sb1.o
sbtoelf: sbtoelf.o crc.o crypto.o xorcrypt.o dbparser.o elf.o misc.o sb.o sb1.o $(TOMCRYPT_DIR)/librbtomcrypt.a
$(LD) -o $@ $^ $(LDFLAGS)
elftosb: elftosb.o crc.o crypto.o elf.o dbparser.o misc.o sb.o
elftosb: elftosb.o crc.o crypto.o elf.o dbparser.o misc.o sb.o $(TOMCRYPT_DIR)/librbtomcrypt.a
$(LD) -o $@ $^ $(LDFLAGS)
elftosb1: elftosb1.o xorcrypt.o elf.o misc.o sb1.o
@ -37,3 +38,7 @@ clean:
veryclean:
rm -rf $(BINS)
$(TOMCRYPT_DIR)/librbtomcrypt.a:
$(MAKE) -C $(TOMCRYPT_DIR)