aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Makefile
blob: ee07921a4bf3ee66e30f3fb50d38722846fb3887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
TESTS=test-base64 test-md4 test-milenage \
	test-rsa-sig-ver \
	test-sha1 \
	test-sha256 test-aes test-asn1 test-x509 test-x509v3 test-list test-rc4

all: $(TESTS)

ifdef LIBFUZZER
CC=clang
CFLAGS = -MMD -O2 -Wall -g
CFLAGS += -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
CFLAGS += -DTEST_LIBFUZZER
LDFLAGS += -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
TEST_FUZZ=y
endif

ifndef CC
CC=gcc
endif

ifndef LDO
LDO=$(CC)
endif

ifndef CFLAGS
CFLAGS = -MMD -O2 -Wall -g
endif

ifdef TEST_FUZZ
CFLAGS += -DCONFIG_NO_RANDOM_POOL
CFLAGS += -DTEST_FUZZ
endif

CFLAGS += -DCONFIG_IEEE80211R_AP
CFLAGS += -DCONFIG_IEEE80211R
CFLAGS += -DCONFIG_TDLS

CFLAGS += -I../src
CFLAGS += -I../src/utils

SLIBS = ../src/utils/libutils.a

DLIBS = ../src/crypto/libcrypto.a \
	../src/common/libcommon.a \
	../src/ap/libap.a \
	../src/eapol_auth/libeapol_auth.a \
	../src/eapol_supp/libeapol_supp.a \
	../src/eap_peer/libeap_peer.a \
	../src/eap_server/libeap_server.a \
	../src/eap_common/libeap_common.a \
	../src/radius/libradius.a \
	../src/l2_packet/libl2_packet.a \
	../src/wps/libwps.a \
	../src/rsn_supp/librsn_supp.a \
	../src/tls/libtls.a

LIBS = $(SLIBS) $(DLIBS)
LLIBS = -Wl,--start-group $(DLIBS) -Wl,--end-group $(SLIBS)

# glibc < 2.17 needs -lrt for clock_gettime()
LLIBS += -lrt

../src/utils/libutils.a:
	$(MAKE) -C ../src/utils

../src/common/libcommon.a:
	$(MAKE) -C ../src/common

../src/crypto/libcrypto.a:
	$(MAKE) -C ../src/crypto

../src/tls/libtls.a:
	$(MAKE) -C ../src/tls

../src/ap/libap.a:
	$(MAKE) -C ../src/ap

../src/radius/libradius.a:
	$(MAKE) -C ../src/radius

../src/l2_packet/libl2_packet.a:
	$(MAKE) -C ../src/l2_packet

../src/wps/libwps.a:
	$(MAKE) -C ../src/wps

../src/eap_peer/libeap_peer.a:
	$(MAKE) -C ../src/eap_peer

../src/eap_server/libeap_server.a:
	$(MAKE) -C ../src/eap_server

../src/eap_common/libeap_common.a:
	$(MAKE) -C ../src/eap_common

../src/eapol_auth/libeapol_auth.a:
	$(MAKE) -C ../src/eapol_auth

../src/eapol_supp/libeapol_supp.a:
	$(MAKE) -C ../src/eapol_supp

../src/rsn_supp/librsn_supp.a:
	$(MAKE) -C ../src/rsn_supp


test-aes: test-aes.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-asn1: test-asn1.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-base64: test-base64.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-eapol: test-eapol.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)

test-https: test-https.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)

test-https_server: test-https_server.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)

test-json: test-json.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-list: test-list.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-md4: test-md4.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-milenage: test-milenage.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-rc4: test-rc4.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-rsa-sig-ver: test-rsa-sig-ver.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)

test-sha1: test-sha1.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-sha256: test-sha256.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)

test-tls: test-tls.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)

test-x509: test-x509.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)

test-x509v3: test-x509v3.o $(LIBS)
	$(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)


run-tests: $(TESTS)
	./test-aes
	./test-list
	./test-md4
	./test-milenage
	./test-rsa-sig-ver
	./test-sha1
	./test-sha256
	@echo
	@echo All tests completed successfully.

clean:
	$(MAKE) -C ../src clean
	rm -f $(TESTS) *~ *.o *.d
	rm -f test-eapol
	rm -f test-https
	rm -f test-json
	rm -f test-tls
	rm -f test_x509v3_nist.out.*
	rm -f test_x509v3_nist2.out.*

-include $(OBJS:%.o=%.d)