]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Allow commit fields to be overridden for testing purposes
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 1 Sep 2017 22:52:15 +0000 (01:52 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 4 Sep 2017 10:32:03 +0000 (13:32 +0300)
The new sae_commit_override=<hexdump> parameter can be used to force
hostapd to override SAE commit message fields for testing purposes. This
is included only in CONFIG_TESTING_OPTIONS=y builds.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd/config_file.c
src/ap/ap_config.c
src/ap/ap_config.h
src/ap/ieee802_11.c

index 7f1965b0643c4b8d2faf46c110a1e8e0afe9c7d8..958fdbf13ea3aeae4f834b3e686f87c855bc61d2 100644 (file)
@@ -3563,6 +3563,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->own_ie_override = tmp;
        } else if (os_strcmp(buf, "sae_reflection_attack") == 0) {
                bss->sae_reflection_attack = atoi(pos);
+       } else if (os_strcmp(buf, "sae_commit_override") == 0) {
+               wpabuf_free(bss->sae_commit_override);
+               bss->sae_commit_override = wpabuf_parse_bin(pos);
 #endif /* CONFIG_TESTING_OPTIONS */
        } else if (os_strcmp(buf, "vendor_elements") == 0) {
                if (parse_wpabuf_hex(line, buf, &bss->vendor_elements, pos))
index 07a13f849af3163fedf703c7d6cad20a3e55d456..b12cb197636820946ee74fe66fccb1f3c5b6e69c 100644 (file)
@@ -617,6 +617,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
 
 #ifdef CONFIG_TESTING_OPTIONS
        wpabuf_free(conf->own_ie_override);
+       wpabuf_free(conf->sae_commit_override);
 #endif /* CONFIG_TESTING_OPTIONS */
 
        os_free(conf->no_probe_resp_if_seen_on);
index 79048de0b06afad8efa29ad52bdd990934464094..28569ede3abed96ebfbed3dee0955d12f4747470 100644 (file)
@@ -589,6 +589,7 @@ struct hostapd_bss_config {
        u8 bss_load_test_set;
        struct wpabuf *own_ie_override;
        int sae_reflection_attack;
+       struct wpabuf *sae_commit_override;
 #endif /* CONFIG_TESTING_OPTIONS */
 
 #define MESH_ENABLED BIT(0)
index e35ed3a0844af55af26060e1f9a7fade59ca3fd7..0be9b49dde11536bd307ab3102e9c87f0c9cba6d 100644 (file)
@@ -797,6 +797,15 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                                auth_transaction, resp, pos, end - pos);
                goto remove_sta;
        }
+
+       if (hapd->conf->sae_commit_override && auth_transaction == 1) {
+               wpa_printf(MSG_DEBUG, "SAE: TESTING - commit override");
+               send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
+                               auth_transaction, resp,
+                               wpabuf_head(hapd->conf->sae_commit_override),
+                               wpabuf_len(hapd->conf->sae_commit_override));
+               goto remove_sta;
+       }
 #endif /* CONFIG_TESTING_OPTIONS */
        if (!sta->sae) {
                if (auth_transaction != 1 ||