]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Rename state variables to match IEEE 802.11 standard
authorJouni Malinen <j@w1.fi>
Mon, 31 Dec 2012 09:05:42 +0000 (11:05 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 12 Jan 2013 15:51:52 +0000 (17:51 +0200)
The enum values for struct sae_data::state now match the protocol
instance states as defined in IEEE Std 802.11-2012, 11.3.8.2.2

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

src/ap/ieee802_11.c
src/common/sae.h
wpa_supplicant/sme.c

index 3ecac91083b5026b61beaae448a7627c26f9f2cd..88825b6ae55d4c883884c48e7c2f8b7e645a4d25 100644 (file)
@@ -376,6 +376,7 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                sta->sae = os_zalloc(sizeof(*sta->sae));
                if (sta->sae == NULL)
                        return;
+               sta->sae->state = SAE_NOTHING;
        }
 
        if (auth_transaction == 1) {
@@ -386,13 +387,14 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                                        ((const u8 *) mgmt) + len -
                                        mgmt->u.auth.variable);
                if (resp == WLAN_STATUS_SUCCESS) {
-                       sta->sae->state = SAE_COMMIT;
                        data = auth_process_sae_commit(hapd, sta);
                        if (data == NULL)
                                resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
+                       else
+                               sta->sae->state = SAE_COMMITTED;
                }
        } else if (auth_transaction == 2) {
-               if (sta->sae->state != SAE_COMMIT) {
+               if (sta->sae->state != SAE_COMMITTED) {
                        hostapd_logger(hapd, sta->addr,
                                       HOSTAPD_MODULE_IEEE80211,
                                       HOSTAPD_LEVEL_DEBUG,
@@ -416,6 +418,8 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                        data = auth_build_sae_confirm(hapd, sta);
                        if (data == NULL)
                                resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
+                       else
+                               sta->sae->state = SAE_ACCEPTED;
                }
        } else {
                hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
index bfefd5da601cb566d40857112f3ded05773e2b1b..2cafd9d651af7fce7bf0101aa0ef2bd990b54657 100644 (file)
@@ -13,7 +13,7 @@
 #define SAE_CONFIRM_MAX_LEN (2 + 32)
 
 struct sae_data {
-       enum { SAE_INIT, SAE_COMMIT, SAE_CONFIRM } state;
+       enum { SAE_NOTHING, SAE_COMMITTED, SAE_CONFIRMED, SAE_ACCEPTED } state;
        u16 send_confirm;
        u8 kck[32];
        u8 pmk[32];
index 043a0a77345144e4637bf290d6e3f0ff33b979f8..814beb75615e42b306344cd45abb78aaa9075274 100644 (file)
@@ -344,7 +344,7 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
                        return;
                params.sae_data = wpabuf_head(resp);
                params.sae_data_len = wpabuf_len(resp);
-               wpa_s->sme.sae.state = start ? SAE_COMMIT : SAE_CONFIRM;
+               wpa_s->sme.sae.state = start ? SAE_COMMITTED : SAE_CONFIRMED;
        }
 #endif /* CONFIG_SAE */
 
@@ -390,7 +390,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
                      struct wpa_bss *bss, struct wpa_ssid *ssid)
 {
 #ifdef CONFIG_SAE
-       wpa_s->sme.sae.state = SAE_INIT;
+       wpa_s->sme.sae.state = SAE_NOTHING;
        wpa_s->sme.sae.send_confirm = 0;
 #endif /* CONFIG_SAE */
        sme_send_authentication(wpa_s, bss, ssid, 1);
@@ -414,7 +414,7 @@ static int sme_sae_auth(struct wpa_supplicant *wpa_s, u16 auth_transaction,
                if (wpa_s->current_bss == NULL ||
                    wpa_s->current_ssid == NULL)
                        return -1;
-               if (wpa_s->sme.sae.state != SAE_COMMIT)
+               if (wpa_s->sme.sae.state != SAE_COMMITTED)
                        return -1;
                if (sae_parse_commit(&wpa_s->sme.sae, data, len) !=
                    WLAN_STATUS_SUCCESS)
@@ -431,10 +431,11 @@ static int sme_sae_auth(struct wpa_supplicant *wpa_s, u16 auth_transaction,
                return 0;
        } else if (auth_transaction == 2) {
                wpa_dbg(wpa_s, MSG_DEBUG, "SME SAE confirm");
-               if (wpa_s->sme.sae.state != SAE_CONFIRM)
+               if (wpa_s->sme.sae.state != SAE_CONFIRMED)
                        return -1;
                if (sae_check_confirm(&wpa_s->sme.sae, data, len) < 0)
                        return -1;
+               wpa_s->sme.sae.state = SAE_ACCEPTED;
                return 1;
        }