]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: WPA2 EAPOL-Key with incorrect type
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 21 Nov 2014 22:16:41 +0000 (00:16 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 21 Nov 2014 22:16:41 +0000 (00:16 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_ap_psk.py

index 5408ada9c73743771c0e6e152fdfa4717cb26a5d..9fc5e473bd11982fdb6fae5ff2a23ad164d1e13d 100644 (file)
@@ -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)