From 3bdf7d7f677693dce014cfb9d5adda9cd218523b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 1 Jan 2014 21:30:57 +0200 Subject: [PATCH] tests: Verify WPS_CHECK_PIN functionality Signed-hostap: Jouni Malinen --- tests/hwsim/test_ap_wps.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index b1fa9894c..36a2bcefc 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -813,3 +813,22 @@ def test_ap_wps_new_version_ap(dev, apdev): hapd.request("SET wps_version_number 0x20") if ev is None: raise Exception("Association with the AP timed out") + +def test_ap_wps_check_pin(dev, apdev): + """Verify PIN checking through control interface""" + hostapd.add_ap(apdev[0]['ifname'], + { "ssid": "wps", "eap_server": "1", "wps_state": "2", + "wpa_passphrase": "12345678", "wpa": "2", + "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }) + hapd = hostapd.Hostapd(apdev[0]['ifname']) + for t in [ ("12345670", "12345670"), + ("12345678", "FAIL-CHECKSUM"), + ("1234-5670", "12345670"), + ("1234 5670", "12345670"), + ("1-2.3:4 5670", "12345670") ]: + res = hapd.request("WPS_CHECK_PIN " + t[0]).rstrip('\n') + res2 = dev[0].request("WPS_CHECK_PIN " + t[0]).rstrip('\n') + if res != res2: + raise Exception("Unexpected difference in WPS_CHECK_PIN responses") + if res != t[1]: + raise Exception("Incorrect WPS_CHECK_PIN response {} (expected {})".format(res, t[1]))