hostap/tests
Jouni Malinen 421d658a67 tests: Fix ECDSA signature generation
Parsing of the DER encoded signature was unable to handle results that
were shorter than the prime. These need to be zero padded from left to
generate the correct value.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 16:53:05 +02:00
..
ap-mgmt-fuzzer ap-mgmt-fuzzer: Add .gitignore 2017-03-07 12:12:20 +02:00
build tests: Drop testing of the old D-Bus interface 2019-03-09 18:23:09 +02:00
eapol-fuzzer tests: Set PMK length in eapol-fuzzer 2017-12-27 12:27:33 +02:00
hwsim tests: Fix ECDSA signature generation 2019-03-17 16:53:05 +02:00
p2p-fuzzer tests: Add p2p-fuzzer 2015-04-22 11:44:19 +03:00
remote tests: Python coding style cleanup (pylint3 bad-whitespace) 2019-03-16 18:52:09 +02:00
wnm-fuzzer tests: Fix wnm-fuzzer by adding dummy configuration 2019-02-11 02:35:29 +02:00
.gitignore tests: Add a simple HTTPS server for TLS testing 2019-02-10 01:55:39 +02:00
cipher-and-key-mgmt-testing.txt Fix the notes on EAPOL-Key testing procedures 2017-10-20 20:32:36 +03:00
Makefile tests: libFuzzer integration for test-json and test-x509 2019-02-25 19:48:49 +02:00
README tests: libFuzzer integration for test-json and test-x509 2019-02-25 19:48:49 +02:00
test-aes.c tests: Move AES key wrap/unwrap test cases into hwsim framework 2015-01-05 16:35:59 +02:00
test-asn1.c Declare wpa_debug_* variables in src/utils/wpa_debug.h 2013-12-31 19:29:52 +02:00
test-base64.c Remove the GPL notification from files contributed by Jouni Malinen 2012-02-11 19:39:36 +02:00
test-eapol.c tests: EAPOL-Key fuzzing tool 2019-02-11 02:35:29 +02:00
test-https.c Declare wpa_debug_* variables in src/utils/wpa_debug.h 2013-12-31 19:29:52 +02:00
test-https_server.c tests: Add a simple HTTPS server for TLS testing 2019-02-10 01:55:39 +02:00
test-json.c tests: libFuzzer integration for test-json and test-x509 2019-02-25 19:48:49 +02:00
test-list.c Remove the GPL notification from files contributed by Jouni Malinen 2012-02-11 19:39:36 +02:00
test-md4.c Use ARRAY_SIZE() macro 2013-10-26 17:49:05 +03:00
test-milenage.c Declare wpa_debug_* variables in src/utils/wpa_debug.h 2013-12-31 19:29:52 +02:00
test-rc4.c Use ARRAY_SIZE() macro 2013-10-26 17:49:05 +03:00
test-rsa-sig-ver.c tests: Fix resource leak in test-rsa-sig-ver on error paths 2015-07-10 21:10:24 +03:00
test-sha1.c tests: Move SHA1 test cases into hwsim framework 2015-01-05 17:29:00 +02:00
test-sha256.c tests: Move SHA256 test cases into hwsim framework 2015-01-05 17:34:20 +02:00
test-tls.c tests: TLS fuzzing tool 2019-02-11 02:35:29 +02:00
test-x509.c tests: libFuzzer integration for test-json and test-x509 2019-02-25 19:48:49 +02:00
test-x509v3.c Declare wpa_debug_* variables in src/utils/wpa_debug.h 2013-12-31 19:29:52 +02:00
test_x509v3_nist.sh Move test_x509v3 into the new tests subdirectory 2009-12-06 18:10:52 +02:00
test_x509v3_nist2.sh tests: Add 4.16.1 and 4.16.2 from NIST PKITS 2014-05-10 13:13:20 +03:00

hostap.git test tools
---------------------

The tests directory with its subdirectories contain number of tools used
for testing wpa_supplicant and hostapd implementations.

hwsim directory contains the test setup for full system testing of
wpa_supplicant and hostapd with a simulated radio (mac80211_hwsim). See
hwsim/READM and hwsim/vm/README for more details.


Build testing
-------------

wpa_supplicant and hostapd support number of build option
combinations. The test scripts in the build subdirectory can be used to
verify that various combinations do not break the builds. More
configuration examples can be added there
(build-{hostapd,wpa_supplicant}-*.config) to get them included in test
builds.

# Example
cd build
./run-build-tests.h


Fuzz testing
------------

Number of the test tools here can be used for fuzz testing with tools
like American fuzzy lop (afl-fuzz) that are designed to modify an
external file for program input. ap-mgmt-fuzzer, eapol-fuzzer,
test-eapol, test-json, test-tls, and test-x509 are examples of such
tools that expose hostap.git module functionality with input from a file
specified on the command line.

Here are some examples of how fuzzing can be performed:

##### JSON parser
make clean
CC=afl-gcc make test-json
mkdir json-examples
cat > json-examples/1.json <<EOF
{"a":[[]],"b":1,"c":"q","d":{"e":[{}]}}
EOF
afl-fuzz -i json-examples -o json-findings -- $PWD/test-json @@

Alternatively, using libFuzzer from LLVM:
make clean
make test-json LIBFUZZER=y
mkdir json-examples
cat > json-examples/1.json <<EOF
{"a":[[]],"b":1,"c":"q","d":{"e":[{}]}}
EOF
./test-json json-examples

##### EAPOL-Key Supplicant
make clean
CC=afl-gcc make test-eapol TEST_FUZZ=y
mkdir eapol-auth-examples
./test-eapol auth write eapol-auth-examples/auth.msg
afl-fuzz -i eapol-auth-examples -o eapol-auth-findings -- $PWD/test-eapol auth read @@

##### EAPOL-Key Authenticator
make clean
CC=afl-gcc make test-eapol TEST_FUZZ=y
mkdir eapol-supp-examples
./test-eapol supp write eapol-supp-examples/supp.msg
afl-fuzz -i eapol-supp-examples -o eapol-supp-findings -- $PWD/test-eapol supp read @@

##### TLS client
make clean
CC=afl-gcc make test-tls TEST_FUZZ=y
mkdir tls-server-examples
./test-tls server write tls-server-examples/server.msg
afl-fuzz -i tls-server-examples -o tls-server-findings -- $PWD/test-tls server read @@

##### TLS server
make clean
CC=afl-gcc make test-tls TEST_FUZZ=y
mkdir tls-client-examples
./test-tls client write tls-client-examples/client.msg
afl-fuzz -i tls-client-examples -o tls-client-findings -- $PWD/test-tls client read @@

##### AP management frame processing
cd ap-mgmt-fuzzer
make clean
CC=afl-gcc make
mkdir multi-examples
cp multi.dat multi-examples
afl-fuzz -i multi-examples -o multi-findings -- $PWD/ap-mgmt-fuzzer -m @@

##### EAPOL-Key Supplicant (separate)
cd eapol-fuzzer
make clean
CC=afl-gcc make
mkdir eapol-examples
cp *.dat eapol-examples
afl-fuzz -i eapol-examples -o eapol-findings -- $PWD/eapol-fuzzer @@

##### P2P
cd p2p-fuzzer
make clean
CC=afl-gcc make
mkdir p2p-proberesp-examples
cp proberesp*.dat p2p-proberesp-examples
afl-fuzz -i p2p-proberesp-examples -o p2p-proberesp-findings -- $PWD/p2p-fuzzer proberesp @@
mkdir p2p-action-examples
cp go*.dat inv*.dat p2ps*.dat p2p-action-examples
afl-fuzz -i p2p-action-examples -o p2p-action-findings -- $PWD/p2p-fuzzer action @@

##### WNM
cd wnm-fuzzer
make clean
CC=afl-gcc make
mkdir wnm-examples
cp *.dat wnm-examples
afl-fuzz -i wnm-examples -o wnm-findings -- $PWD/wnm-fuzzer @@