]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
TDLS: Add test mode for MIC failure testing
authorJouni Malinen <j@w1.fi>
Sat, 5 Apr 2014 16:04:07 +0000 (19:04 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 5 Apr 2014 17:42:12 +0000 (20:42 +0300)
"SET tdls_testing 0x800" can be used to enable a special test mode that
forces the FTIE MIC in TDLS setup messages to be incorrect.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/rsn_supp/tdls.c

index 62a2a591ce4cf07fa4d4786d0d87c45c889c5fc9..ea293699d3d983a3bbe770d3f4dd6d1896b86f2b 100644 (file)
@@ -33,6 +33,7 @@
 #define TDLS_TESTING_NO_TPK_EXPIRATION BIT(8)
 #define TDLS_TESTING_DECLINE_RESP BIT(9)
 #define TDLS_TESTING_IGNORE_AP_PROHIBIT BIT(10)
+#define TDLS_TESTING_WRONG_MIC BIT(11)
 unsigned int tdls_testing = 0;
 #endif /* CONFIG_TDLS_TESTING */
 
@@ -1213,6 +1214,12 @@ static int wpa_tdls_send_tpk_m2(struct wpa_sm *sm,
        /* compute MIC before sending */
        wpa_tdls_ftie_mic(peer->tpk.kck, 2, (u8 *) lnkid, peer->rsnie_p,
                          (u8 *) &timeoutie, (u8 *) ftie, ftie->mic);
+#ifdef CONFIG_TDLS_TESTING
+       if (tdls_testing & TDLS_TESTING_WRONG_MIC) {
+               wpa_printf(MSG_DEBUG, "TDLS: Testing - use wrong MIC");
+               ftie->mic[0] ^= 0x01;
+       }
+#endif /* CONFIG_TDLS_TESTING */
 
 skip_ies:
        status = wpa_tdls_tpk_send(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE,
@@ -1296,6 +1303,12 @@ static int wpa_tdls_send_tpk_m3(struct wpa_sm *sm,
        /* compute MIC before sending */
        wpa_tdls_ftie_mic(peer->tpk.kck, 3, (u8 *) lnkid, peer->rsnie_p,
                          (u8 *) &timeoutie, (u8 *) ftie, ftie->mic);
+#ifdef CONFIG_TDLS_TESTING
+       if (tdls_testing & TDLS_TESTING_WRONG_MIC) {
+               wpa_printf(MSG_DEBUG, "TDLS: Testing - use wrong MIC");
+               ftie->mic[0] ^= 0x01;
+       }
+#endif /* CONFIG_TDLS_TESTING */
 
        if (peer->vht_capabilities)
                peer_capab |= TDLS_PEER_VHT;