aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhackermnementh <[email protected]>2016-04-27 21:07:11 -0700
committerhackermnementh <[email protected]>2016-04-27 21:07:11 -0700
commita1da379b394856e69ccef91281831f615d3ee5ef (patch)
tree1ab5019b63892e3f6cc7193aa65caea578647ee6 /tests
parent297706a14d4024d0e98bbbcae45ce0dcfbcc5c4c (diff)
parent0fa076c9a0ea7b57900e7ca175e078a9487f944d (diff)
Merge pull request #4 from 0x8000-0000/master
Updates for building on Windows using MinGW-64
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile98
1 files changed, 40 insertions, 58 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 305c78c..8067a1d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -8,78 +8,60 @@
include ../config.mk
+TEST_LIB_FILE:=test_ecc_utils.c
+TEST_SOURCE:=$(filter-out $(TEST_LIB_FILE), $(wildcard test_*.c))
+
+TEST_OBJECTS:=$(TEST_SOURCE:.c=.o)
+TEST_DEPS:=$(TEST_SOURCE:.c=.d)
+TEST_BINARY:=$(TEST_SOURCE:.c=$(DOTEXE))
+
# Edit the 'all' content to add/remove tests needed from TinyCrypt library:
-all: test_aes \
- test_cbc_mode \
- test_ctr_mode \
- test_cmac_mode \
- test_ccm_mode \
- test_ctr_prng \
- test_hmac \
- test_hmac_prng \
- test_sha256 \
- test_ecc_dh \
- test_ecc_dsa
+all: $(TEST_BINARY)
clean:
- -$(RM) *.o *~
- -$(RM) test_aes
- -$(RM) test_cbc_mode
- -$(RM) test_ctr_mode
- -$(RM) test_ctr_prng
- -$(RM) test_hmac
- -$(RM) test_hmac_prng
- -$(RM) test_sha256
- -$(RM) test_ecc_dh
- -$(RM) test_ecc_dsa
- -$(RM) test_cmac_mode
- -$(RM) test_ccm_mode
+ -$(RM) $(TEST_BINARY) $(TEST_OBJECTS) $(TEST_DEPS)
+ -$(RM) *~ *.o *.d
# Dependencies
-test_aes: test_aes.o ../lib/aes_encrypt.o \
- ../lib/aes_decrypt.o ../lib/utils.o
-
-test_cbc_mode: test_cbc_mode.o ../lib/cbc_mode.o \
- ../lib/aes_encrypt.o ../lib/aes_decrypt.o \
- ../lib/utils.o
+test_aes$(DOTEXE): test_aes.o aes_encrypt.o aes_decrypt.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_ctr_mode: test_ctr_mode.o ../lib/ctr_mode.o \
- ../lib/aes_encrypt.o ../lib/utils.o
+test_cbc_mode$(DOTEXE): test_cbc_mode.o cbc_mode.o \
+ aes_encrypt.o aes_decrypt.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_ctr_prng: test_ctr_prng.o ../lib/ctr_prng.o \
- ../lib/aes_encrypt.o ../lib/utils.o
+test_ctr_mode$(DOTEXE): test_ctr_mode.o ctr_mode.o \
+ aes_encrypt.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_cmac_mode: test_cmac_mode.o ../lib/aes_encrypt.o ../lib/utils.o \
- ../lib/cmac_mode.o
+test_ctr_prng$(DOTEXE): test_ctr_prng.o ctr_prng.o \
+ aes_encrypt.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_ccm_mode: test_ccm_mode.o ../lib/aes_encrypt.o \
- ../lib/utils.o ../lib/ccm_mode.o
+test_cmac_mode$(DOTEXE): test_cmac_mode.o aes_encrypt.o utils.o \
+ cmac_mode.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_hmac: test_hmac.o ../lib/hmac.o ../lib/sha256.o \
- ../lib/utils.o
+test_ccm_mode$(DOTEXE): test_ccm_mode.o aes_encrypt.o \
+ utils.o ccm_mode.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_hmac_prng: test_hmac_prng.o ../lib/hmac_prng.o ../lib/hmac.o \
- ../lib/sha256.o ../lib/utils.o
+test_hmac$(DOTEXE): test_hmac.o hmac.o sha256.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_sha256: test_sha256.o ../lib/sha256.o ../lib/utils.o
+test_hmac_prng$(DOTEXE): test_hmac_prng.o hmac_prng.o hmac.o \
+ sha256.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_ecc_dh: test_ecc_dh.o ../lib/ecc.o ../lib/ecc_dh.o test_ecc_utils.o
+test_sha256$(DOTEXE): test_sha256.o sha256.o utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-test_ecc_dsa: test_ecc_dsa.o ../lib/ecc.o ../lib/utils.o ../lib/ecc_dh.o \
- ../lib/ecc_dsa.o ../lib/sha256.o test_ecc_utils.o
+test_ecc_dh$(DOTEXE): test_ecc_dh.o ecc.o ecc_dh.o test_ecc_utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
+test_ecc_dsa$(DOTEXE): test_ecc_dsa.o ecc.o utils.o ecc_dh.o \
+ ecc_dsa.o sha256.o test_ecc_utils.o
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-# Sub-dependencies
-test_aes.o: aes.h constants.h
-test_cbc_mode.o: cbc_mode.h constants.h
-test_ctr_mode.o: ctr_mode.h constants.h
-test_ctr_prng.o: ctr_prng.h constants.h
-test_cmac_mode.o: cmac_mode.h aes.h
-test_ccm_mode.o: ccm_mode.h constants.h
-test_hmac.o: hmac.h sha256.h constants.h
-test_hmac_prng.o: hmac_prng.h constants.h
-test_sha256.o: sha256.h constants.h
-test_ecc_dh.o: ecc.h ecc_dh.h constants.h
-test_ecc_dsa.o: ecc.h sha256.h constants.h
-test_ecc_utils.o: ecc.h ecc_dh.h
+-include $(TEST_DEPS)