]> git.ipfire.org Git - thirdparty/hostap.git/blame - tests/README
tests: Fix ap-mgmt-fuzzer build configuration to match libap.a
[thirdparty/hostap.git] / tests / README
CommitLineData
b6236342
JM
1hostap.git test tools
2---------------------
3
4The tests directory with its subdirectories contain number of tools used
5for testing wpa_supplicant and hostapd implementations.
6
7hwsim directory contains the test setup for full system testing of
8wpa_supplicant and hostapd with a simulated radio (mac80211_hwsim). See
9hwsim/READM and hwsim/vm/README for more details.
10
11
12Build testing
13-------------
14
15wpa_supplicant and hostapd support number of build option
16combinations. The test scripts in the build subdirectory can be used to
17verify that various combinations do not break the builds. More
18configuration examples can be added there
19(build-{hostapd,wpa_supplicant}-*.config) to get them included in test
20builds.
21
22# Example
23cd build
24./run-build-tests.h
25
26
27Fuzz testing
28------------
29
30Number of the test tools here can be used for fuzz testing with tools
31like American fuzzy lop (afl-fuzz) that are designed to modify an
32external file for program input. ap-mgmt-fuzzer, eapol-fuzzer,
33test-eapol, test-json, test-tls, and test-x509 are examples of such
34tools that expose hostap.git module functionality with input from a file
35specified on the command line.
36
37Here are some examples of how fuzzing can be performed:
38
39##### JSON parser
40make clean
41CC=afl-gcc make test-json
42mkdir json-examples
43cat > json-examples/1.json <<EOF
44{"a":[[]],"b":1,"c":"q","d":{"e":[{}]}}
45EOF
46afl-fuzz -i json-examples -o json-findings -- $PWD/test-json @@
47
f3e67159
JM
48Alternatively, using libFuzzer from LLVM:
49make clean
50make test-json LIBFUZZER=y
51mkdir json-examples
52cat > json-examples/1.json <<EOF
53{"a":[[]],"b":1,"c":"q","d":{"e":[{}]}}
54EOF
55./test-json json-examples
56
b6236342
JM
57##### EAPOL-Key Supplicant
58make clean
59CC=afl-gcc make test-eapol TEST_FUZZ=y
60mkdir eapol-auth-examples
61./test-eapol auth write eapol-auth-examples/auth.msg
62afl-fuzz -i eapol-auth-examples -o eapol-auth-findings -- $PWD/test-eapol auth read @@
63
64##### EAPOL-Key Authenticator
65make clean
66CC=afl-gcc make test-eapol TEST_FUZZ=y
67mkdir eapol-supp-examples
68./test-eapol supp write eapol-supp-examples/supp.msg
69afl-fuzz -i eapol-supp-examples -o eapol-supp-findings -- $PWD/test-eapol supp read @@
70
71##### TLS client
72make clean
73CC=afl-gcc make test-tls TEST_FUZZ=y
74mkdir tls-server-examples
75./test-tls server write tls-server-examples/server.msg
76afl-fuzz -i tls-server-examples -o tls-server-findings -- $PWD/test-tls server read @@
77
78##### TLS server
79make clean
80CC=afl-gcc make test-tls TEST_FUZZ=y
81mkdir tls-client-examples
82./test-tls client write tls-client-examples/client.msg
83afl-fuzz -i tls-client-examples -o tls-client-findings -- $PWD/test-tls client read @@
84
85##### AP management frame processing
86cd ap-mgmt-fuzzer
87make clean
88CC=afl-gcc make
89mkdir multi-examples
90cp multi.dat multi-examples
91afl-fuzz -i multi-examples -o multi-findings -- $PWD/ap-mgmt-fuzzer -m @@
92
93##### EAPOL-Key Supplicant (separate)
94cd eapol-fuzzer
95make clean
96CC=afl-gcc make
97mkdir eapol-examples
98cp *.dat eapol-examples
99afl-fuzz -i eapol-examples -o eapol-findings -- $PWD/eapol-fuzzer @@
100
101##### P2P
102cd p2p-fuzzer
103make clean
104CC=afl-gcc make
105mkdir p2p-proberesp-examples
106cp proberesp*.dat p2p-proberesp-examples
107afl-fuzz -i p2p-proberesp-examples -o p2p-proberesp-findings -- $PWD/p2p-fuzzer proberesp @@
108mkdir p2p-action-examples
109cp go*.dat inv*.dat p2ps*.dat p2p-action-examples
110afl-fuzz -i p2p-action-examples -o p2p-action-findings -- $PWD/p2p-fuzzer action @@
111
112##### WNM
113cd wnm-fuzzer
114make clean
115CC=afl-gcc make
116mkdir wnm-examples
117cp *.dat wnm-examples
118afl-fuzz -i wnm-examples -o wnm-findings -- $PWD/wnm-fuzzer @@