From 7f211fb4f43fa706632b5864ae7d7fed22f17b51 Mon Sep 17 00:00:00 2001 From: Kevin Layer Date: Thu, 26 Jul 2018 09:58:44 -0700 Subject: Testing improvements Add a new `test' rule that tests all three combinations (128, 192 and 256). This required the re-ordering of ifdef's in test.c, similar to that in aes.[ch]. test.elf now exits with the number of tests which failed, so the test rule in Makefile will notify properly. Remove the unused variables `buf' and `buf2'. Also, add a .gitignore file. --- Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3b875af..f87a364 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,12 @@ CC = gcc LD = gcc CFLAGS = -Wall -Os -c LDFLAGS = -Wall -Os -Wl,-Map,test.map +ifdef AES192 +CFLAGS += -DAES192=1 +endif +ifdef AES256 +CFLAGS += -DAES256=1 +endif OBJCOPYFLAFS = -j .text -O ihex OBJCOPY = objcopy @@ -24,11 +30,11 @@ test.hex : test.elf $(OBJCOPY) ${OBJCOPYFLAFS} $< $@ test.o : test.c aes.h aes.o - echo [CC] $@ + echo [CC] $@ $(CFLAGS) $(CC) $(CFLAGS) -o $@ $< aes.o : aes.c aes.h - echo [CC] $@ + echo [CC] $@ $(CFLAGS) $(CC) $(CFLAGS) -o $@ $< test.elf : aes.o test.o @@ -39,5 +45,10 @@ test.elf : aes.o test.o clean: rm -f *.OBJ *.LST *.o *.gch *.out *.hex *.map +test: + make clean && make && ./test.elf + make clean && make AES192=1 && ./test.elf + make clean && make AES256=1 && ./test.elf + lint: $(call SPLINT) -- cgit v1.2.3