]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Move related operations next to each other
authorJouni Malinen <j@w1.fi>
Sun, 30 Dec 2012 19:54:16 +0000 (21:54 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 12 Jan 2013 15:51:52 +0000 (17:51 +0200)
There is no need to keep the two SAE steps separated from each other.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/ieee802_11.c

index 76607da5b9a77e2954ffa1369c5640b12d70c0a7..99a89f4fe979b249c37e4ec68eb9b6359942bc52 100644 (file)
@@ -392,7 +392,7 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                            u8 auth_transaction)
 {
        u16 resp = WLAN_STATUS_SUCCESS;
-       struct wpabuf *data;
+       struct wpabuf *data = NULL;
 
        if (!sta->sae) {
                sta->sae = os_zalloc(sizeof(*sta->sae));
@@ -407,8 +407,12 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                resp = handle_sae_commit(hapd, sta, mgmt->u.auth.variable,
                                         ((u8 *) mgmt) + len -
                                         mgmt->u.auth.variable);
-               if (resp == WLAN_STATUS_SUCCESS)
+               if (resp == WLAN_STATUS_SUCCESS) {
                        sta->sae->state = SAE_COMMIT;
+                       data = auth_build_sae_commit(hapd, sta);
+                       if (data == NULL)
+                               resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
+               }
        } else if (auth_transaction == 2) {
                if (sta->sae->state != SAE_COMMIT) {
                        hostapd_logger(hapd, sta->addr,
@@ -428,6 +432,10 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                        wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
                        sta->auth_alg = WLAN_AUTH_SAE;
                        mlme_authenticate_indication(hapd, sta);
+
+                       data = auth_build_sae_confirm(hapd, sta);
+                       if (data == NULL)
+                               resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
                }
        } else {
                hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
@@ -439,16 +447,6 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
 
        sta->auth_alg = WLAN_AUTH_SAE;
 
-       if (resp == WLAN_STATUS_SUCCESS) {
-               if (auth_transaction == 1)
-                       data = auth_build_sae_commit(hapd, sta);
-               else
-                       data = auth_build_sae_confirm(hapd, sta);
-               if (data == NULL)
-                       resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
-       } else
-               data = NULL;
-
        send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
                        auth_transaction, resp,
                        data ? wpabuf_head(data) : (u8 *) "",