diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py index 5408ada9c..9fc5e473b 100644 --- a/tests/hwsim/test_ap_psk.py +++ b/tests/hwsim/test_ap_psk.py @@ -674,3 +674,33 @@ def test_ap_wpa2_psk_ext_eapol_retry1d(dev, apdev): raise Exception("ANonce changed") reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck) hapd_connected(hapd) + +def test_ap_wpa2_psk_ext_eapol_type_diff(dev, apdev): + """WPA2 4-way handshake using external EAPOL supplicant""" + (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0]) + + msg = recv_eapol(hapd) + anonce = msg['rsn_key_nonce'] + + (ptk, kck, kek) = pmk_to_ptk(pmk, addr, bssid, snonce, anonce) + + # Incorrect descriptor type (frame dropped) + msg['descr_type'] = 253 + rsn_eapol_key_set(msg, 0x010a, 0, snonce, rsne) + eapol_key_mic(kck, msg) + send_eapol(hapd, addr, build_eapol(msg)) + + # Incorrect descriptor type, but with a workaround (frame processed) + msg['descr_type'] = 254 + rsn_eapol_key_set(msg, 0x010a, 0, snonce, rsne) + eapol_key_mic(kck, msg) + send_eapol(hapd, addr, build_eapol(msg)) + + msg = recv_eapol(hapd) + if anonce != msg['rsn_key_nonce']: + raise Exception("ANonce changed") + logger.info("Replay same data back") + send_eapol(hapd, addr, build_eapol(msg)) + + reply_eapol("4/4", hapd, addr, msg, 0x030a, None, None, kck) + hapd_connected(hapd)