SAE: Rename state variables to match IEEE 802.11 standard

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>
This commit is contained in:
Jouni Malinen 2012-12-31 11:05:42 +02:00
parent 47b55a3ef5
commit dd43026a19
3 changed files with 12 additions and 7 deletions

View 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,

View 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];

View 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;
}