From: Jouni Malinen Date: Fri, 1 Sep 2017 22:52:15 +0000 (+0300) Subject: SAE: Allow commit fields to be overridden for testing purposes X-Git-Tag: hostap_2_7~1147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3648d8a1854a403b3674ec55681c76bb713ee77a;p=thirdparty%2Fhostap.git SAE: Allow commit fields to be overridden for testing purposes The new sae_commit_override= 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 --- diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 7f1965b06..958fdbf13 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -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)) diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 07a13f849..b12cb1976 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -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); diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 79048de0b..28569ede3 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -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) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index e35ed3a08..0be9b49dd 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -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 ||