From 35f875eb6cd80f057c5dba0d811a8b957bb95e1d Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 11 Aug 2011 10:16:55 +0200 Subject: [PATCH] add support for crypting l0dables in Makefile --- firmware/l0dable/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/firmware/l0dable/Makefile b/firmware/l0dable/Makefile index 121c4f5..dfffde4 100644 --- a/firmware/l0dable/Makefile +++ b/firmware/l0dable/Makefile @@ -24,9 +24,13 @@ LDSRCFILE=ram.ld LDFILE=loadable.ld CFLAGS+=-mlong-calls -fno-toplevel-reorder -CRYPT=cp +DOCRYPT=0 +CRYPT=../../tools/crypto/xxtea CRYPTFLAGS=-p +skey=`cd .. && ./getkey.pl l0dable_sign` +ekey=`cd .. && ./getkey.pl l0dable_crypt` + all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int debug.int $(LDFILE): @@ -47,7 +51,13 @@ $(LDFILE): $(OBJCOPY) $(OCFLAGS) -O binary $< $@ %.c0d: %.bin - $(CRYPT) $(CRYPTFLAGS) $< $@ +ifeq "$(DOCRYPT)" "1" + $(CRYPT) -e -k $(ekey) -o $<.tmp $< + $(CRYPT) -s -k $(skey) -o $@ $<.tmp + rm -f $<.tmp +else + cp $< $@ +endif %.nik: .PHONY @a=$@;a=nick_$${a%.nik}.c0d;echo mv $$a $@;mv $$a $@