tests: Verify different ways of configuring passphrase/PSK
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
1b56d398a7
commit
c89d9ebbc4
2 changed files with 48 additions and 0 deletions
5
tests/hwsim/hostapd.wpa_psk
Normal file
5
tests/hwsim/hostapd.wpa_psk
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
00:00:00:00:00:00 secret passphrase
|
||||||
|
02:00:00:00:00:00 very secret
|
||||||
|
00:11:22:33:44:55 another passphrase
|
||||||
|
00:22:33:44:55:66 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
||||||
|
00:00:00:00:00:00 another passphrase for all STAs
|
43
tests/hwsim/test_ap_psk.py
Normal file
43
tests/hwsim/test_ap_psk.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# WPA2-Personal tests
|
||||||
|
# Copyright (c) 2014, Qualcomm Atheros, Inc.
|
||||||
|
#
|
||||||
|
# This software may be distributed under the terms of the BSD license.
|
||||||
|
# See README for more details.
|
||||||
|
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
import hostapd
|
||||||
|
|
||||||
|
def test_ap_wpa2_psk(dev, apdev):
|
||||||
|
"""WPA2-PSK AP with PSK instead of passphrase"""
|
||||||
|
ssid = "test-wpa2-psk"
|
||||||
|
passphrase = 'qwertyuiop'
|
||||||
|
psk = '602e323e077bc63bd80307ef4745b754b0ae0a925c2638ecd13a794b9527b9e6'
|
||||||
|
params = hostapd.wpa2_params(ssid=ssid)
|
||||||
|
params['wpa_psk'] = psk
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
dev[0].connect(ssid, raw_psk=psk, scan_freq="2412")
|
||||||
|
dev[1].connect(ssid, psk=passphrase, scan_freq="2412")
|
||||||
|
|
||||||
|
def test_ap_wpa2_psk_file(dev, apdev):
|
||||||
|
"""WPA2-PSK AP with PSK from a file"""
|
||||||
|
ssid = "test-wpa2-psk"
|
||||||
|
passphrase = 'qwertyuiop'
|
||||||
|
psk = '602e323e077bc63bd80307ef4745b754b0ae0a925c2638ecd13a794b9527b9e6'
|
||||||
|
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
|
||||||
|
params['wpa_psk_file'] = 'hostapd.wpa_psk'
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
dev[1].connect(ssid, psk="very secret", scan_freq="2412", wait_connect=False)
|
||||||
|
dev[2].connect(ssid, raw_psk=psk, scan_freq="2412")
|
||||||
|
dev[2].request("REMOVE_NETWORK all")
|
||||||
|
dev[0].connect(ssid, psk="very secret", scan_freq="2412")
|
||||||
|
dev[0].request("REMOVE_NETWORK all")
|
||||||
|
dev[2].connect(ssid, psk="another passphrase for all STAs", scan_freq="2412")
|
||||||
|
dev[0].connect(ssid, psk="another passphrase for all STAs", scan_freq="2412")
|
||||||
|
ev = dev[1].wait_event(["WPA: 4-Way Handshake failed"], timeout=10)
|
||||||
|
if ev is None:
|
||||||
|
raise Exception("Timed out while waiting for failure report")
|
||||||
|
dev[1].request("REMOVE_NETWORK all")
|
Loading…
Reference in a new issue