|
8 | 8 |
|
9 | 9 | include ../config.mk
|
10 | 10 |
|
| 11 | +TEST_LIB_FILE:=test_ecc_utils.c |
| 12 | +TEST_SOURCE:=$(filter-out $(TEST_LIB_FILE), $(wildcard test_*.c)) |
| 13 | + |
| 14 | +TEST_OBJECTS:=$(TEST_SOURCE:.c=.o) |
| 15 | +TEST_DEPS:=$(TEST_SOURCE:.c=.d) |
| 16 | +TEST_BINARY:=$(TEST_SOURCE:.c=$(DOTEXE)) |
| 17 | + |
11 | 18 | # Edit the 'all' content to add/remove tests needed from TinyCrypt library:
|
12 |
| -all: test_aes \ |
13 |
| - test_cbc_mode \ |
14 |
| - test_ctr_mode \ |
15 |
| - test_cmac_mode \ |
16 |
| - test_ccm_mode \ |
17 |
| - test_ctr_prng \ |
18 |
| - test_hmac \ |
19 |
| - test_hmac_prng \ |
20 |
| - test_sha256 \ |
21 |
| - test_ecc_dh \ |
22 |
| - test_ecc_dsa |
| 19 | +all: $(TEST_BINARY) |
23 | 20 |
|
24 | 21 | clean:
|
25 |
| - -$(RM) *.o *~ |
26 |
| - -$(RM) test_aes |
27 |
| - -$(RM) test_cbc_mode |
28 |
| - -$(RM) test_ctr_mode |
29 |
| - -$(RM) test_ctr_prng |
30 |
| - -$(RM) test_hmac |
31 |
| - -$(RM) test_hmac_prng |
32 |
| - -$(RM) test_sha256 |
33 |
| - -$(RM) test_ecc_dh |
34 |
| - -$(RM) test_ecc_dsa |
35 |
| - -$(RM) test_cmac_mode |
36 |
| - -$(RM) test_ccm_mode |
| 22 | + -$(RM) $(TEST_BINARY) $(TEST_OBJECTS) $(TEST_DEPS) |
| 23 | + -$(RM) *~ *.o *.d |
37 | 24 |
|
38 | 25 | # Dependencies
|
39 |
| -test_aes: test_aes.o ../lib/aes_encrypt.o \ |
40 |
| - ../lib/aes_decrypt.o ../lib/utils.o |
41 |
| - |
42 |
| -test_cbc_mode: test_cbc_mode.o ../lib/cbc_mode.o \ |
43 |
| - ../lib/aes_encrypt.o ../lib/aes_decrypt.o \ |
44 |
| - ../lib/utils.o |
| 26 | +test_aes$(DOTEXE): test_aes.o aes_encrypt.o aes_decrypt.o utils.o |
| 27 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
45 | 28 |
|
46 |
| -test_ctr_mode: test_ctr_mode.o ../lib/ctr_mode.o \ |
47 |
| - ../lib/aes_encrypt.o ../lib/utils.o |
| 29 | +test_cbc_mode$(DOTEXE): test_cbc_mode.o cbc_mode.o \ |
| 30 | + aes_encrypt.o aes_decrypt.o utils.o |
| 31 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
48 | 32 |
|
49 |
| -test_ctr_prng: test_ctr_prng.o ../lib/ctr_prng.o \ |
50 |
| - ../lib/aes_encrypt.o ../lib/utils.o |
| 33 | +test_ctr_mode$(DOTEXE): test_ctr_mode.o ctr_mode.o \ |
| 34 | + aes_encrypt.o utils.o |
| 35 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
51 | 36 |
|
52 |
| -test_cmac_mode: test_cmac_mode.o ../lib/aes_encrypt.o ../lib/utils.o \ |
53 |
| - ../lib/cmac_mode.o |
| 37 | +test_ctr_prng$(DOTEXE): test_ctr_prng.o ctr_prng.o \ |
| 38 | + aes_encrypt.o utils.o |
| 39 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
54 | 40 |
|
55 |
| -test_ccm_mode: test_ccm_mode.o ../lib/aes_encrypt.o \ |
56 |
| - ../lib/utils.o ../lib/ccm_mode.o |
| 41 | +test_cmac_mode$(DOTEXE): test_cmac_mode.o aes_encrypt.o utils.o \ |
| 42 | + cmac_mode.o |
| 43 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
57 | 44 |
|
58 |
| -test_hmac: test_hmac.o ../lib/hmac.o ../lib/sha256.o \ |
59 |
| - ../lib/utils.o |
| 45 | +test_ccm_mode$(DOTEXE): test_ccm_mode.o aes_encrypt.o \ |
| 46 | + utils.o ccm_mode.o |
| 47 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
60 | 48 |
|
61 |
| -test_hmac_prng: test_hmac_prng.o ../lib/hmac_prng.o ../lib/hmac.o \ |
62 |
| - ../lib/sha256.o ../lib/utils.o |
| 49 | +test_hmac$(DOTEXE): test_hmac.o hmac.o sha256.o utils.o |
| 50 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
63 | 51 |
|
64 |
| -test_sha256: test_sha256.o ../lib/sha256.o ../lib/utils.o |
| 52 | +test_hmac_prng$(DOTEXE): test_hmac_prng.o hmac_prng.o hmac.o \ |
| 53 | + sha256.o utils.o |
| 54 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
65 | 55 |
|
66 |
| -test_ecc_dh: test_ecc_dh.o ../lib/ecc.o ../lib/ecc_dh.o test_ecc_utils.o |
| 56 | +test_sha256$(DOTEXE): test_sha256.o sha256.o utils.o |
| 57 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
67 | 58 |
|
68 |
| -test_ecc_dsa: test_ecc_dsa.o ../lib/ecc.o ../lib/utils.o ../lib/ecc_dh.o \ |
69 |
| - ../lib/ecc_dsa.o ../lib/sha256.o test_ecc_utils.o |
| 59 | +test_ecc_dh$(DOTEXE): test_ecc_dh.o ecc.o ecc_dh.o test_ecc_utils.o |
| 60 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
70 | 61 |
|
| 62 | +test_ecc_dsa$(DOTEXE): test_ecc_dsa.o ecc.o utils.o ecc_dh.o \ |
| 63 | + ecc_dsa.o sha256.o test_ecc_utils.o |
| 64 | + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
71 | 65 |
|
72 |
| -# Sub-dependencies |
73 |
| -test_aes.o: aes.h constants.h |
74 |
| -test_cbc_mode.o: cbc_mode.h constants.h |
75 |
| -test_ctr_mode.o: ctr_mode.h constants.h |
76 |
| -test_ctr_prng.o: ctr_prng.h constants.h |
77 |
| -test_cmac_mode.o: cmac_mode.h aes.h |
78 |
| -test_ccm_mode.o: ccm_mode.h constants.h |
79 |
| -test_hmac.o: hmac.h sha256.h constants.h |
80 |
| -test_hmac_prng.o: hmac_prng.h constants.h |
81 |
| -test_sha256.o: sha256.h constants.h |
82 |
| -test_ecc_dh.o: ecc.h ecc_dh.h constants.h |
83 |
| -test_ecc_dsa.o: ecc.h sha256.h constants.h |
84 |
| -test_ecc_utils.o: ecc.h ecc_dh.h |
85 | 66 |
|
| 67 | +-include $(TEST_DEPS) |
0 commit comments