49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Host-side tests for the Wi-Fi crypto and the WPA supplicant.
|
|
#
|
|
# These compile the real kernel sources (Libraries/Crypto.cpp and
|
|
# Drivers/Net/Wifi/Wpa.cpp) for the host against the small shim in shim/, so
|
|
# what is exercised is the code that ships, not a copy of it.
|
|
#
|
|
# Requires: g++ with C++20, python3 with the `cryptography` package.
|
|
#
|
|
# Copyright (c) 2026 Daniel Hammer
|
|
|
|
set -euo pipefail
|
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
root="$(cd "$here/../.." && pwd)"
|
|
src="$root/kernel/src"
|
|
out="$(mktemp -d)"
|
|
trap 'rm -rf "$out"' EXIT
|
|
|
|
CXX="${CXX:-g++}"
|
|
CXXFLAGS="-O1 -std=c++20 -Wall -I$here/shim -I$src"
|
|
|
|
echo "== crypto primitives against published vectors =="
|
|
$CXX $CXXFLAGS -o "$out/crypto_vectors" \
|
|
"$here/crypto_vectors.cpp" "$src/Libraries/Crypto.cpp"
|
|
"$out/crypto_vectors"
|
|
|
|
echo
|
|
echo "== supplicant against an independent authenticator =="
|
|
$CXX $CXXFLAGS -o "$out/supplicant" \
|
|
"$here/supplicant_harness.cpp" \
|
|
"$src/Drivers/Net/Wifi/Wpa.cpp" "$src/Libraries/Crypto.cpp"
|
|
|
|
python3 "$here/ap_handshake.py" "$out/supplicant"
|
|
python3 "$here/ap_rekey_and_rsn.py" "$out/supplicant"
|
|
|
|
echo
|
|
echo "== MLME and data path against a simulated access point =="
|
|
$CXX $CXXFLAGS -o "$out/mlme" \
|
|
"$here/mlme_harness.cpp" \
|
|
"$src/Drivers/Net/Wifi/IwxConnect.cpp" \
|
|
"$src/Drivers/Net/Wifi/Wpa.cpp" "$src/Libraries/Crypto.cpp"
|
|
|
|
python3 "$here/ap_mlme.py" "$out/mlme"
|
|
|
|
echo
|
|
echo "All Wi-Fi host tests passed."
|