WPA auth: Convert Boolean to C99 bool

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-04-23 23:52:12 +03:00 committed by Jouni Malinen
parent 4d9c313f2a
commit 56024a233a
6 changed files with 136 additions and 136 deletions

View file

@ -82,7 +82,7 @@ static void rsn_preauth_receive(void *ctx, const u8 *src_addr,
sta = NULL; sta = NULL;
} else { } else {
sta->eapol_sm->radius_identifier = -1; sta->eapol_sm->radius_identifier = -1;
sta->eapol_sm->portValid = TRUE; sta->eapol_sm->portValid = true;
sta->eapol_sm->flags |= EAPOL_SM_PREAUTH; sta->eapol_sm->flags |= EAPOL_SM_PREAUTH;
} }
} }

View file

@ -317,9 +317,9 @@ static void wpa_rekey_gtk(void *eloop_ctx, void *timeout_ctx)
while (group) { while (group) {
wpa_group_get(wpa_auth, group); wpa_group_get(wpa_auth, group);
group->GTKReKey = TRUE; group->GTKReKey = true;
do { do {
group->changed = FALSE; group->changed = false;
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
} while (group->changed); } while (group->changed);
@ -420,7 +420,7 @@ static struct wpa_group * wpa_group_init(struct wpa_authenticator *wpa_auth,
if (!group) if (!group)
return NULL; return NULL;
group->GTKAuthenticator = TRUE; group->GTKAuthenticator = true;
group->vlan_id = vlan_id; group->vlan_id = vlan_id;
group->GTK_len = wpa_cipher_key_len(wpa_auth->conf.wpa_group); group->GTK_len = wpa_cipher_key_len(wpa_auth->conf.wpa_group);
@ -442,14 +442,14 @@ static struct wpa_group * wpa_group_init(struct wpa_authenticator *wpa_auth,
return NULL; return NULL;
} }
group->GInit = TRUE; group->GInit = true;
if (delay_init) { if (delay_init) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: Delay group state machine start until Beacon frames have been configured"); "WPA: Delay group state machine start until Beacon frames have been configured");
/* Initialization is completed in wpa_init_keys(). */ /* Initialization is completed in wpa_init_keys(). */
} else { } else {
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
group->GInit = FALSE; group->GInit = false;
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
} }
@ -546,7 +546,7 @@ int wpa_init_keys(struct wpa_authenticator *wpa_auth)
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: Start group state machine to set initial keys"); "WPA: Start group state machine to set initial keys");
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
group->GInit = FALSE; group->GInit = false;
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
if (group->wpa_group_state == WPA_GROUP_FATAL_FAILURE) if (group->wpa_group_state == WPA_GROUP_FATAL_FAILURE)
return -1; return -1;
@ -616,9 +616,9 @@ int wpa_reconfig(struct wpa_authenticator *wpa_auth,
*/ */
group = wpa_auth->group; group = wpa_auth->group;
group->GTK_len = wpa_cipher_key_len(wpa_auth->conf.wpa_group); group->GTK_len = wpa_cipher_key_len(wpa_auth->conf.wpa_group);
group->GInit = TRUE; group->GInit = true;
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
group->GInit = FALSE; group->GInit = false;
wpa_group_sm_step(wpa_auth, group); wpa_group_sm_step(wpa_auth, group);
return 0; return 0;
@ -661,7 +661,7 @@ int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
"FT authentication already completed - do not start 4-way handshake"); "FT authentication already completed - do not start 4-way handshake");
/* Go to PTKINITDONE state to allow GTK rekeying */ /* Go to PTKINITDONE state to allow GTK rekeying */
sm->wpa_ptk_state = WPA_PTK_PTKINITDONE; sm->wpa_ptk_state = WPA_PTK_PTKINITDONE;
sm->Pair = TRUE; sm->Pair = true;
return 0; return 0;
} }
#endif /* CONFIG_IEEE80211R_AP */ #endif /* CONFIG_IEEE80211R_AP */
@ -672,14 +672,14 @@ int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
"FILS authentication already completed - do not start 4-way handshake"); "FILS authentication already completed - do not start 4-way handshake");
/* Go to PTKINITDONE state to allow GTK rekeying */ /* Go to PTKINITDONE state to allow GTK rekeying */
sm->wpa_ptk_state = WPA_PTK_PTKINITDONE; sm->wpa_ptk_state = WPA_PTK_PTKINITDONE;
sm->Pair = TRUE; sm->Pair = true;
return 0; return 0;
} }
#endif /* CONFIG_FILS */ #endif /* CONFIG_FILS */
if (sm->started) { if (sm->started) {
os_memset(&sm->key_replay, 0, sizeof(sm->key_replay)); os_memset(&sm->key_replay, 0, sizeof(sm->key_replay));
sm->ReAuthenticationRequest = TRUE; sm->ReAuthenticationRequest = true;
return wpa_sm_step(sm); return wpa_sm_step(sm);
} }
@ -687,11 +687,11 @@ int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
"start authentication"); "start authentication");
sm->started = 1; sm->started = 1;
sm->Init = TRUE; sm->Init = true;
if (wpa_sm_step(sm) == 1) if (wpa_sm_step(sm) == 1)
return 1; /* should not really happen */ return 1; /* should not really happen */
sm->Init = FALSE; sm->Init = false;
sm->AuthenticationRequest = TRUE; sm->AuthenticationRequest = true;
return wpa_sm_step(sm); return wpa_sm_step(sm);
} }
@ -726,7 +726,7 @@ static void wpa_free_sta_sm(struct wpa_state_machine *sm)
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
if (sm->GUpdateStationKeys) { if (sm->GUpdateStationKeys) {
sm->group->GKeyDoneStations--; sm->group->GKeyDoneStations--;
sm->GUpdateStationKeys = FALSE; sm->GUpdateStationKeys = false;
} }
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP
os_free(sm->assoc_resp_ftie); os_free(sm->assoc_resp_ftie);
@ -788,14 +788,14 @@ static void wpa_request_new_ptk(struct wpa_state_machine *sm)
wpa_printf(MSG_INFO, wpa_printf(MSG_INFO,
"WPA: PTK0 rekey not allowed, disconnect " MACSTR, "WPA: PTK0 rekey not allowed, disconnect " MACSTR,
MAC2STR(sm->addr)); MAC2STR(sm->addr));
sm->Disconnect = TRUE; sm->Disconnect = true;
/* Try to encourage the STA to reconnect */ /* Try to encourage the STA to reconnect */
sm->disconnect_reason = sm->disconnect_reason =
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA; WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA;
} else { } else {
if (sm->use_ext_key_id) if (sm->use_ext_key_id)
sm->keyidx_active ^= 1; /* flip Key ID */ sm->keyidx_active ^= 1; /* flip Key ID */
sm->PTKRequest = TRUE; sm->PTKRequest = true;
sm->PTK_valid = 0; sm->PTK_valid = 0;
} }
} }
@ -825,7 +825,7 @@ static void wpa_replay_counter_mark_invalid(struct wpa_key_replay_counter *ctr,
(!replay_counter || (!replay_counter ||
os_memcmp(replay_counter, ctr[i].counter, os_memcmp(replay_counter, ctr[i].counter,
WPA_REPLAY_COUNTER_LEN) == 0)) WPA_REPLAY_COUNTER_LEN) == 0))
ctr[i].valid = FALSE; ctr[i].valid = false;
} }
} }
@ -976,7 +976,7 @@ static int wpa_try_alt_snonce(struct wpa_state_machine *sm, u8 *data,
os_memcpy(sm->SNonce, sm->alt_SNonce, WPA_NONCE_LEN); os_memcpy(sm->SNonce, sm->alt_SNonce, WPA_NONCE_LEN);
os_memcpy(&sm->PTK, &PTK, sizeof(PTK)); os_memcpy(&sm->PTK, &PTK, sizeof(PTK));
forced_memzero(&PTK, sizeof(PTK)); forced_memzero(&PTK, sizeof(PTK));
sm->PTK_valid = TRUE; sm->PTK_valid = true;
return 0; return 0;
} }
@ -1146,7 +1146,7 @@ void wpa_receive(struct wpa_authenticator *wpa_auth,
"Process SNonce update from STA based on retransmitted EAPOL-Key 1/4"); "Process SNonce update from STA based on retransmitted EAPOL-Key 1/4");
sm->update_snonce = 1; sm->update_snonce = 1;
os_memcpy(sm->alt_SNonce, sm->SNonce, WPA_NONCE_LEN); os_memcpy(sm->alt_SNonce, sm->SNonce, WPA_NONCE_LEN);
sm->alt_snonce_valid = TRUE; sm->alt_snonce_valid = true;
os_memcpy(sm->alt_replay_counter, os_memcpy(sm->alt_replay_counter,
sm->key_replay[0].counter, sm->key_replay[0].counter,
WPA_REPLAY_COUNTER_LEN); WPA_REPLAY_COUNTER_LEN);
@ -1278,7 +1278,7 @@ continue_processing:
} }
#endif /* CONFIG_FILS */ #endif /* CONFIG_FILS */
sm->MICVerified = FALSE; sm->MICVerified = false;
if (sm->PTK_valid && !sm->update_snonce) { if (sm->PTK_valid && !sm->update_snonce) {
if (mic_len && if (mic_len &&
wpa_verify_key_mic(sm->wpa_key_mgmt, sm->pmk_len, &sm->PTK, wpa_verify_key_mic(sm->wpa_key_mgmt, sm->pmk_len, &sm->PTK,
@ -1311,7 +1311,7 @@ continue_processing:
#ifdef TEST_FUZZ #ifdef TEST_FUZZ
continue_fuzz: continue_fuzz:
#endif /* TEST_FUZZ */ #endif /* TEST_FUZZ */
sm->MICVerified = TRUE; sm->MICVerified = true;
eloop_cancel_timeout(wpa_send_eapol_timeout, wpa_auth, sm); eloop_cancel_timeout(wpa_send_eapol_timeout, wpa_auth, sm);
sm->pending_1_of_4_timeout = 0; sm->pending_1_of_4_timeout = 0;
} }
@ -1385,7 +1385,7 @@ continue_processing:
sm->last_rx_eapol_key_len = data_len; sm->last_rx_eapol_key_len = data_len;
sm->rx_eapol_key_secure = !!(key_info & WPA_KEY_INFO_SECURE); sm->rx_eapol_key_secure = !!(key_info & WPA_KEY_INFO_SECURE);
sm->EAPOLKeyReceived = TRUE; sm->EAPOLKeyReceived = true;
sm->EAPOLKeyPairwise = !!(key_info & WPA_KEY_INFO_KEY_TYPE); sm->EAPOLKeyPairwise = !!(key_info & WPA_KEY_INFO_KEY_TYPE);
sm->EAPOLKeyRequest = !!(key_info & WPA_KEY_INFO_REQUEST); sm->EAPOLKeyRequest = !!(key_info & WPA_KEY_INFO_REQUEST);
os_memcpy(sm->SNonce, key->key_nonce, WPA_NONCE_LEN); os_memcpy(sm->SNonce, key->key_nonce, WPA_NONCE_LEN);
@ -1448,7 +1448,7 @@ static void wpa_send_eapol_timeout(void *eloop_ctx, void *timeout_ctx)
sm->pending_1_of_4_timeout = 0; sm->pending_1_of_4_timeout = 0;
wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG, "EAPOL-Key timeout"); wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG, "EAPOL-Key timeout");
sm->TimeoutEvt = TRUE; sm->TimeoutEvt = true;
wpa_sm_step(sm); wpa_sm_step(sm);
} }
@ -1548,7 +1548,7 @@ void __wpa_send_eapol(struct wpa_authenticator *wpa_auth,
WPA_REPLAY_COUNTER_LEN); WPA_REPLAY_COUNTER_LEN);
wpa_hexdump(MSG_DEBUG, "WPA: Replay Counter", wpa_hexdump(MSG_DEBUG, "WPA: Replay Counter",
key->replay_counter, WPA_REPLAY_COUNTER_LEN); key->replay_counter, WPA_REPLAY_COUNTER_LEN);
sm->key_replay[0].valid = TRUE; sm->key_replay[0].valid = true;
if (nonce) if (nonce)
os_memcpy(key->key_nonce, nonce, WPA_NONCE_LEN); os_memcpy(key->key_nonce, nonce, WPA_NONCE_LEN);
@ -1735,7 +1735,7 @@ static int wpa_verify_key_mic(int akmp, size_t pmk_len, struct wpa_ptk *PTK,
void wpa_remove_ptk(struct wpa_state_machine *sm) void wpa_remove_ptk(struct wpa_state_machine *sm)
{ {
sm->PTK_valid = FALSE; sm->PTK_valid = false;
os_memset(&sm->PTK, 0, sizeof(sm->PTK)); os_memset(&sm->PTK, 0, sizeof(sm->PTK));
if (wpa_auth_set_key(sm->wpa_auth, 0, WPA_ALG_NONE, sm->addr, 0, NULL, if (wpa_auth_set_key(sm->wpa_auth, 0, WPA_ALG_NONE, sm->addr, 0, NULL,
0, KEY_FLAG_PAIRWISE)) 0, KEY_FLAG_PAIRWISE))
@ -1746,7 +1746,7 @@ void wpa_remove_ptk(struct wpa_state_machine *sm)
0, KEY_FLAG_PAIRWISE)) 0, KEY_FLAG_PAIRWISE))
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"RSN: PTK Key ID 1 removal from the driver failed"); "RSN: PTK Key ID 1 removal from the driver failed");
sm->pairwise_set = FALSE; sm->pairwise_set = false;
eloop_cancel_timeout(wpa_rekey_ptk, sm->wpa_auth, sm); eloop_cancel_timeout(wpa_rekey_ptk, sm->wpa_auth, sm);
} }
@ -1775,7 +1775,7 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
break; break;
case WPA_DEAUTH: case WPA_DEAUTH:
case WPA_DISASSOC: case WPA_DISASSOC:
sm->DeauthenticationRequest = TRUE; sm->DeauthenticationRequest = true;
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP
os_memset(sm->PMK, 0, sizeof(sm->PMK)); os_memset(sm->PMK, 0, sizeof(sm->PMK));
sm->pmk_len = 0; sm->pmk_len = 0;
@ -1798,11 +1798,11 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA state machine had not been started - initialize now"); "WPA state machine had not been started - initialize now");
sm->started = 1; sm->started = 1;
sm->Init = TRUE; sm->Init = true;
if (wpa_sm_step(sm) == 1) if (wpa_sm_step(sm) == 1)
return 1; /* should not really happen */ return 1; /* should not really happen */
sm->Init = FALSE; sm->Init = false;
sm->AuthenticationRequest = TRUE; sm->AuthenticationRequest = true;
break; break;
} }
@ -1811,7 +1811,7 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
wpa_printf(MSG_INFO, wpa_printf(MSG_INFO,
"WPA: PTK0 rekey not allowed, disconnect " "WPA: PTK0 rekey not allowed, disconnect "
MACSTR, MAC2STR(sm->addr)); MACSTR, MAC2STR(sm->addr));
sm->Disconnect = TRUE; sm->Disconnect = true;
/* Try to encourage the STA to reconnect */ /* Try to encourage the STA to reconnect */
sm->disconnect_reason = sm->disconnect_reason =
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA; WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA;
@ -1827,10 +1827,10 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
* update for this STA. * update for this STA.
*/ */
sm->group->GKeyDoneStations--; sm->group->GKeyDoneStations--;
sm->GUpdateStationKeys = FALSE; sm->GUpdateStationKeys = false;
sm->PtkGroupInit = TRUE; sm->PtkGroupInit = true;
} }
sm->ReAuthenticationRequest = TRUE; sm->ReAuthenticationRequest = true;
break; break;
case WPA_ASSOC_FT: case WPA_ASSOC_FT:
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP
@ -1856,7 +1856,7 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
break; break;
#endif /* CONFIG_FILS */ #endif /* CONFIG_FILS */
case WPA_DRV_STA_REMOVED: case WPA_DRV_STA_REMOVED:
sm->tk_already_set = FALSE; sm->tk_already_set = false;
return 0; return 0;
} }
@ -1873,7 +1873,7 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
#endif /* CONFIG_FILS */ #endif /* CONFIG_FILS */
if (remove_ptk) { if (remove_ptk) {
sm->PTK_valid = FALSE; sm->PTK_valid = false;
os_memset(&sm->PTK, 0, sizeof(sm->PTK)); os_memset(&sm->PTK, 0, sizeof(sm->PTK));
if (event != WPA_REAUTH_EAPOL) if (event != WPA_REAUTH_EAPOL)
@ -1885,7 +1885,7 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)
* wpa_sm_step() is already running - avoid recursive call to * wpa_sm_step() is already running - avoid recursive call to
* it by making the existing loop process the new update. * it by making the existing loop process the new update.
*/ */
sm->changed = TRUE; sm->changed = true;
return 0; return 0;
} }
return wpa_sm_step(sm); return wpa_sm_step(sm);
@ -1898,18 +1898,18 @@ SM_STATE(WPA_PTK, INITIALIZE)
if (sm->Init) { if (sm->Init) {
/* Init flag is not cleared here, so avoid busy /* Init flag is not cleared here, so avoid busy
* loop by claiming nothing changed. */ * loop by claiming nothing changed. */
sm->changed = FALSE; sm->changed = false;
} }
sm->keycount = 0; sm->keycount = 0;
if (sm->GUpdateStationKeys) if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; sm->group->GKeyDoneStations--;
sm->GUpdateStationKeys = FALSE; sm->GUpdateStationKeys = false;
if (sm->wpa == WPA_VERSION_WPA) if (sm->wpa == WPA_VERSION_WPA)
sm->PInitAKeys = FALSE; sm->PInitAKeys = false;
if (1 /* Unicast cipher supported AND (ESS OR ((IBSS or WDS) and if (1 /* Unicast cipher supported AND (ESS OR ((IBSS or WDS) and
* Local AA > Remote AA)) */) { * Local AA > Remote AA)) */) {
sm->Pair = TRUE; sm->Pair = true;
} }
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portEnabled, 0); wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portEnabled, 0);
wpa_remove_ptk(sm); wpa_remove_ptk(sm);
@ -1929,7 +1929,7 @@ SM_STATE(WPA_PTK, DISCONNECT)
u16 reason = sm->disconnect_reason; u16 reason = sm->disconnect_reason;
SM_ENTRY_MA(WPA_PTK, DISCONNECT, wpa_ptk); SM_ENTRY_MA(WPA_PTK, DISCONNECT, wpa_ptk);
sm->Disconnect = FALSE; sm->Disconnect = false;
sm->disconnect_reason = 0; sm->disconnect_reason = 0;
if (!reason) if (!reason)
reason = WLAN_REASON_PREV_AUTH_NOT_VALID; reason = WLAN_REASON_PREV_AUTH_NOT_VALID;
@ -1940,7 +1940,7 @@ SM_STATE(WPA_PTK, DISCONNECT)
SM_STATE(WPA_PTK, DISCONNECTED) SM_STATE(WPA_PTK, DISCONNECTED)
{ {
SM_ENTRY_MA(WPA_PTK, DISCONNECTED, wpa_ptk); SM_ENTRY_MA(WPA_PTK, DISCONNECTED, wpa_ptk);
sm->DeauthenticationRequest = FALSE; sm->DeauthenticationRequest = false;
} }
@ -1948,11 +1948,11 @@ SM_STATE(WPA_PTK, AUTHENTICATION)
{ {
SM_ENTRY_MA(WPA_PTK, AUTHENTICATION, wpa_ptk); SM_ENTRY_MA(WPA_PTK, AUTHENTICATION, wpa_ptk);
os_memset(&sm->PTK, 0, sizeof(sm->PTK)); os_memset(&sm->PTK, 0, sizeof(sm->PTK));
sm->PTK_valid = FALSE; sm->PTK_valid = false;
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portControl_Auto, wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portControl_Auto,
1); 1);
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portEnabled, 1); wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portEnabled, 1);
sm->AuthenticationRequest = FALSE; sm->AuthenticationRequest = false;
} }
@ -1973,18 +1973,18 @@ static void wpa_group_ensure_init(struct wpa_authenticator *wpa_auth,
if (random_pool_ready() != 1) { if (random_pool_ready() != 1) {
wpa_printf(MSG_INFO, wpa_printf(MSG_INFO,
"WPA: Not enough entropy in random pool to proceed - reject first 4-way handshake"); "WPA: Not enough entropy in random pool to proceed - reject first 4-way handshake");
group->reject_4way_hs_for_entropy = TRUE; group->reject_4way_hs_for_entropy = true;
} else { } else {
group->first_sta_seen = TRUE; group->first_sta_seen = true;
group->reject_4way_hs_for_entropy = FALSE; group->reject_4way_hs_for_entropy = false;
} }
if (wpa_group_init_gmk_and_counter(wpa_auth, group) < 0 || if (wpa_group_init_gmk_and_counter(wpa_auth, group) < 0 ||
wpa_gtk_update(wpa_auth, group) < 0 || wpa_gtk_update(wpa_auth, group) < 0 ||
wpa_group_config_group_keys(wpa_auth, group) < 0) { wpa_group_config_group_keys(wpa_auth, group) < 0) {
wpa_printf(MSG_INFO, "WPA: GMK/GTK setup failed"); wpa_printf(MSG_INFO, "WPA: GMK/GTK setup failed");
group->first_sta_seen = FALSE; group->first_sta_seen = false;
group->reject_4way_hs_for_entropy = TRUE; group->reject_4way_hs_for_entropy = true;
} }
} }
@ -1994,7 +1994,7 @@ SM_STATE(WPA_PTK, AUTHENTICATION2)
SM_ENTRY_MA(WPA_PTK, AUTHENTICATION2, wpa_ptk); SM_ENTRY_MA(WPA_PTK, AUTHENTICATION2, wpa_ptk);
wpa_group_ensure_init(sm->wpa_auth, sm->group); wpa_group_ensure_init(sm->wpa_auth, sm->group);
sm->ReAuthenticationRequest = FALSE; sm->ReAuthenticationRequest = false;
/* /*
* Definition of ANonce selection in IEEE Std 802.11i-2004 is somewhat * Definition of ANonce selection in IEEE Std 802.11i-2004 is somewhat
@ -2008,7 +2008,7 @@ SM_STATE(WPA_PTK, AUTHENTICATION2)
if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) { if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) {
wpa_printf(MSG_ERROR, wpa_printf(MSG_ERROR,
"WPA: Failed to get random data for ANonce."); "WPA: Failed to get random data for ANonce.");
sm->Disconnect = TRUE; sm->Disconnect = true;
return; return;
} }
wpa_hexdump(MSG_DEBUG, "WPA: Assign ANonce", sm->ANonce, wpa_hexdump(MSG_DEBUG, "WPA: Assign ANonce", sm->ANonce,
@ -2026,7 +2026,7 @@ static int wpa_auth_sm_ptk_update(struct wpa_state_machine *sm)
if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) { if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) {
wpa_printf(MSG_ERROR, wpa_printf(MSG_ERROR,
"WPA: Failed to get random data for ANonce"); "WPA: Failed to get random data for ANonce");
sm->Disconnect = TRUE; sm->Disconnect = true;
return -1; return -1;
} }
wpa_hexdump(MSG_DEBUG, "WPA: Assign new ANonce", sm->ANonce, wpa_hexdump(MSG_DEBUG, "WPA: Assign new ANonce", sm->ANonce,
@ -2053,7 +2053,7 @@ SM_STATE(WPA_PTK, INITPMK)
} else if (sm->wpa_key_mgmt == WPA_KEY_MGMT_DPP) { } else if (sm->wpa_key_mgmt == WPA_KEY_MGMT_DPP) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"DPP: No PMKSA cache entry for STA - reject connection"); "DPP: No PMKSA cache entry for STA - reject connection");
sm->Disconnect = TRUE; sm->Disconnect = true;
sm->disconnect_reason = WLAN_REASON_INVALID_PMKID; sm->disconnect_reason = WLAN_REASON_INVALID_PMKID;
return; return;
#endif /* CONFIG_DPP */ #endif /* CONFIG_DPP */
@ -2071,7 +2071,7 @@ SM_STATE(WPA_PTK, INITPMK)
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: MSK not long enough (%zu) to create PMK (%u)", "WPA: MSK not long enough (%zu) to create PMK (%u)",
len, pmk_len); len, pmk_len);
sm->Disconnect = TRUE; sm->Disconnect = true;
return; return;
} }
os_memcpy(sm->PMK, msk, pmk_len); os_memcpy(sm->PMK, msk, pmk_len);
@ -2090,21 +2090,21 @@ SM_STATE(WPA_PTK, INITPMK)
} else { } else {
wpa_printf(MSG_DEBUG, "WPA: Could not get PMK, get_msk: %p", wpa_printf(MSG_DEBUG, "WPA: Could not get PMK, get_msk: %p",
sm->wpa_auth->cb->get_msk); sm->wpa_auth->cb->get_msk);
sm->Disconnect = TRUE; sm->Disconnect = true;
return; return;
} }
forced_memzero(msk, sizeof(msk)); forced_memzero(msk, sizeof(msk));
sm->req_replay_counter_used = 0; sm->req_replay_counter_used = 0;
/* IEEE 802.11i does not set keyRun to FALSE, but not doing this /* IEEE 802.11i does not set keyRun to false, but not doing this
* will break reauthentication since EAPOL state machines may not be * will break reauthentication since EAPOL state machines may not be
* get into AUTHENTICATING state that clears keyRun before WPA state * get into AUTHENTICATING state that clears keyRun before WPA state
* machine enters AUTHENTICATION2 state and goes immediately to INITPMK * machine enters AUTHENTICATION2 state and goes immediately to INITPMK
* state and takes PMK from the previously used AAA Key. This will * state and takes PMK from the previously used AAA Key. This will
* eventually fail in 4-Way Handshake because Supplicant uses PMK * eventually fail in 4-Way Handshake because Supplicant uses PMK
* derived from the new AAA Key. Setting keyRun = FALSE here seems to * derived from the new AAA Key. Setting keyRun = false here seems to
* be good workaround for this issue. */ * be good workaround for this issue. */
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_keyRun, 0); wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_keyRun, false);
} }
@ -2145,9 +2145,9 @@ SM_STATE(WPA_PTK, PTKSTART)
size_t pmkid_len = 0; size_t pmkid_len = 0;
SM_ENTRY_MA(WPA_PTK, PTKSTART, wpa_ptk); SM_ENTRY_MA(WPA_PTK, PTKSTART, wpa_ptk);
sm->PTKRequest = FALSE; sm->PTKRequest = false;
sm->TimeoutEvt = FALSE; sm->TimeoutEvt = false;
sm->alt_snonce_valid = FALSE; sm->alt_snonce_valid = false;
sm->TimeoutCtr++; sm->TimeoutCtr++;
if (sm->TimeoutCtr > sm->wpa_auth->conf.wpa_pairwise_update_count) { if (sm->TimeoutCtr > sm->wpa_auth->conf.wpa_pairwise_update_count) {
@ -2312,8 +2312,8 @@ int fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk,
fils_ft, &fils_ft_len); fils_ft, &fils_ft_len);
if (res < 0) if (res < 0)
return res; return res;
sm->PTK_valid = TRUE; sm->PTK_valid = true;
sm->tk_already_set = FALSE; sm->tk_already_set = false;
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP
if (fils_ft_len) { if (fils_ft_len) {
@ -2811,7 +2811,7 @@ int fils_set_tk(struct wpa_state_machine *sm)
wpa_printf(MSG_DEBUG, "FILS: Failed to set TK to the driver"); wpa_printf(MSG_DEBUG, "FILS: Failed to set TK to the driver");
return -1; return -1;
} }
sm->tk_already_set = TRUE; sm->tk_already_set = true;
return 0; return 0;
} }
@ -2882,8 +2882,8 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
int owe_ptk_workaround = !!wpa_auth->conf.owe_ptk_workaround; int owe_ptk_workaround = !!wpa_auth->conf.owe_ptk_workaround;
SM_ENTRY_MA(WPA_PTK, PTKCALCNEGOTIATING, wpa_ptk); SM_ENTRY_MA(WPA_PTK, PTKCALCNEGOTIATING, wpa_ptk);
sm->EAPOLKeyReceived = FALSE; sm->EAPOLKeyReceived = false;
sm->update_snonce = FALSE; sm->update_snonce = false;
os_memset(&PTK, 0, sizeof(PTK)); os_memset(&PTK, 0, sizeof(PTK));
mic_len = wpa_mic_len(sm->wpa_key_mgmt, sm->pmk_len); mic_len = wpa_mic_len(sm->wpa_key_mgmt, sm->pmk_len);
@ -3117,11 +3117,11 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
sm->pmk_len = PMK_LEN; sm->pmk_len = PMK_LEN;
} }
sm->MICVerified = TRUE; sm->MICVerified = true;
os_memcpy(&sm->PTK, &PTK, sizeof(PTK)); os_memcpy(&sm->PTK, &PTK, sizeof(PTK));
forced_memzero(&PTK, sizeof(PTK)); forced_memzero(&PTK, sizeof(PTK));
sm->PTK_valid = TRUE; sm->PTK_valid = true;
} }
@ -3274,7 +3274,7 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING)
struct wpa_auth_config *conf = &sm->wpa_auth->conf; struct wpa_auth_config *conf = &sm->wpa_auth->conf;
SM_ENTRY_MA(WPA_PTK, PTKINITNEGOTIATING, wpa_ptk); SM_ENTRY_MA(WPA_PTK, PTKINITNEGOTIATING, wpa_ptk);
sm->TimeoutEvt = FALSE; sm->TimeoutEvt = false;
sm->TimeoutCtr++; sm->TimeoutCtr++;
if (conf->wpa_disable_eapol_key_retries && sm->TimeoutCtr > 1) { if (conf->wpa_disable_eapol_key_retries && sm->TimeoutCtr > 1) {
@ -3509,7 +3509,7 @@ done:
SM_STATE(WPA_PTK, PTKINITDONE) SM_STATE(WPA_PTK, PTKINITDONE)
{ {
SM_ENTRY_MA(WPA_PTK, PTKINITDONE, wpa_ptk); SM_ENTRY_MA(WPA_PTK, PTKINITDONE, wpa_ptk);
sm->EAPOLKeyReceived = FALSE; sm->EAPOLKeyReceived = false;
if (sm->Pair) { if (sm->Pair) {
enum wpa_alg alg = wpa_cipher_to_alg(sm->pairwise); enum wpa_alg alg = wpa_cipher_to_alg(sm->pairwise);
int klen = wpa_cipher_key_len(sm->pairwise); int klen = wpa_cipher_key_len(sm->pairwise);
@ -3529,7 +3529,7 @@ SM_STATE(WPA_PTK, PTKINITDONE)
return; return;
} }
/* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */ /* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */
sm->pairwise_set = TRUE; sm->pairwise_set = true;
wpa_auth_set_ptk_rekey_timer(sm); wpa_auth_set_ptk_rekey_timer(sm);
@ -3551,12 +3551,13 @@ SM_STATE(WPA_PTK, PTKINITDONE)
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portValid, wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_portValid,
1); 1);
} }
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_keyAvailable, 0); wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_keyAvailable,
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_keyDone, 1); false);
wpa_auth_set_eapol(sm->wpa_auth, sm->addr, WPA_EAPOL_keyDone, true);
if (sm->wpa == WPA_VERSION_WPA) if (sm->wpa == WPA_VERSION_WPA)
sm->PInitAKeys = TRUE; sm->PInitAKeys = true;
else else
sm->has_GTK = TRUE; sm->has_GTK = true;
wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_INFO, wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_INFO,
"pairwise key handshake completed (%s)", "pairwise key handshake completed (%s)",
sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN"); sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN");
@ -3606,7 +3607,7 @@ SM_STEP(WPA_PTK)
case WPA_PTK_AUTHENTICATION2: case WPA_PTK_AUTHENTICATION2:
if (wpa_key_mgmt_wpa_ieee8021x(sm->wpa_key_mgmt) && if (wpa_key_mgmt_wpa_ieee8021x(sm->wpa_key_mgmt) &&
wpa_auth_get_eapol(wpa_auth, sm->addr, wpa_auth_get_eapol(wpa_auth, sm->addr,
WPA_EAPOL_keyRun) > 0) WPA_EAPOL_keyRun))
SM_ENTER(WPA_PTK, INITPMK); SM_ENTER(WPA_PTK, INITPMK);
else if (wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt) || else if (wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt) ||
sm->wpa_key_mgmt == WPA_KEY_MGMT_OWE sm->wpa_key_mgmt == WPA_KEY_MGMT_OWE
@ -3617,7 +3618,7 @@ SM_STEP(WPA_PTK)
break; break;
case WPA_PTK_INITPMK: case WPA_PTK_INITPMK:
if (wpa_auth_get_eapol(wpa_auth, sm->addr, if (wpa_auth_get_eapol(wpa_auth, sm->addr,
WPA_EAPOL_keyAvailable) > 0) { WPA_EAPOL_keyAvailable)) {
SM_ENTER(WPA_PTK, PTKSTART); SM_ENTER(WPA_PTK, PTKSTART);
#ifdef CONFIG_DPP #ifdef CONFIG_DPP
} else if (sm->wpa_key_mgmt == WPA_KEY_MGMT_DPP && sm->pmksa) { } else if (sm->wpa_key_mgmt == WPA_KEY_MGMT_DPP && sm->pmksa) {
@ -3700,7 +3701,7 @@ SM_STATE(WPA_PTK_GROUP, IDLE)
if (sm->Init) { if (sm->Init) {
/* Init flag is not cleared here, so avoid busy /* Init flag is not cleared here, so avoid busy
* loop by claiming nothing changed. */ * loop by claiming nothing changed. */
sm->changed = FALSE; sm->changed = false;
} }
sm->GTimeoutCtr = 0; sm->GTimeoutCtr = 0;
} }
@ -3730,8 +3731,8 @@ SM_STATE(WPA_PTK_GROUP, REKEYNEGOTIATING)
} }
if (sm->wpa == WPA_VERSION_WPA) if (sm->wpa == WPA_VERSION_WPA)
sm->PInitAKeys = FALSE; sm->PInitAKeys = false;
sm->TimeoutEvt = FALSE; sm->TimeoutEvt = false;
/* Send EAPOL(1, 1, 1, !Pair, G, RSC, GNonce, MIC(PTK), GTK[GN]) */ /* Send EAPOL(1, 1, 1, !Pair, G, RSC, GNonce, MIC(PTK), GTK[GN]) */
os_memset(rsc, 0, WPA_KEY_RSC_LEN); os_memset(rsc, 0, WPA_KEY_RSC_LEN);
if (gsm->wpa_group_state == WPA_GROUP_SETKEYSDONE) if (gsm->wpa_group_state == WPA_GROUP_SETKEYSDONE)
@ -3797,7 +3798,7 @@ SM_STATE(WPA_PTK_GROUP, REKEYESTABLISHED)
#endif /* CONFIG_OCV */ #endif /* CONFIG_OCV */
SM_ENTRY_MA(WPA_PTK_GROUP, REKEYESTABLISHED, wpa_ptk_group); SM_ENTRY_MA(WPA_PTK_GROUP, REKEYESTABLISHED, wpa_ptk_group);
sm->EAPOLKeyReceived = FALSE; sm->EAPOLKeyReceived = false;
#ifdef CONFIG_OCV #ifdef CONFIG_OCV
mic_len = wpa_mic_len(sm->wpa_key_mgmt, sm->pmk_len); mic_len = wpa_mic_len(sm->wpa_key_mgmt, sm->pmk_len);
@ -3849,13 +3850,13 @@ SM_STATE(WPA_PTK_GROUP, REKEYESTABLISHED)
if (sm->GUpdateStationKeys) if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; sm->group->GKeyDoneStations--;
sm->GUpdateStationKeys = FALSE; sm->GUpdateStationKeys = false;
sm->GTimeoutCtr = 0; sm->GTimeoutCtr = 0;
/* FIX: MLME.SetProtection.Request(TA, Tx_Rx) */ /* FIX: MLME.SetProtection.Request(TA, Tx_Rx) */
wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_INFO, wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_INFO,
"group key handshake completed (%s)", "group key handshake completed (%s)",
sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN"); sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN");
sm->has_GTK = TRUE; sm->has_GTK = true;
} }
@ -3864,8 +3865,8 @@ SM_STATE(WPA_PTK_GROUP, KEYERROR)
SM_ENTRY_MA(WPA_PTK_GROUP, KEYERROR, wpa_ptk_group); SM_ENTRY_MA(WPA_PTK_GROUP, KEYERROR, wpa_ptk_group);
if (sm->GUpdateStationKeys) if (sm->GUpdateStationKeys)
sm->group->GKeyDoneStations--; sm->group->GKeyDoneStations--;
sm->GUpdateStationKeys = FALSE; sm->GUpdateStationKeys = false;
sm->Disconnect = TRUE; sm->Disconnect = true;
wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_INFO, wpa_auth_vlogger(sm->wpa_auth, sm->addr, LOGGER_INFO,
"group key handshake failed (%s) after %u tries", "group key handshake failed (%s) after %u tries",
sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN", sm->wpa == WPA_VERSION_WPA ? "WPA" : "RSN",
@ -3877,7 +3878,7 @@ SM_STEP(WPA_PTK_GROUP)
{ {
if (sm->Init || sm->PtkGroupInit) { if (sm->Init || sm->PtkGroupInit) {
SM_ENTER(WPA_PTK_GROUP, IDLE); SM_ENTER(WPA_PTK_GROUP, IDLE);
sm->PtkGroupInit = FALSE; sm->PtkGroupInit = false;
} else switch (sm->wpa_ptk_group_state) { } else switch (sm->wpa_ptk_group_state) {
case WPA_PTK_GROUP_IDLE: case WPA_PTK_GROUP_IDLE:
if (sm->GUpdateStationKeys || if (sm->GUpdateStationKeys ||
@ -3957,7 +3958,7 @@ static void wpa_group_gtk_init(struct wpa_authenticator *wpa_auth,
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: group state machine entering state GTK_INIT (VLAN-ID %d)", "WPA: group state machine entering state GTK_INIT (VLAN-ID %d)",
group->vlan_id); group->vlan_id);
group->changed = FALSE; /* GInit is not cleared here; avoid loop */ group->changed = false; /* GInit is not cleared here; avoid loop */
group->wpa_group_state = WPA_GROUP_GTK_INIT; group->wpa_group_state = WPA_GROUP_GTK_INIT;
/* GTK[0..N] = 0 */ /* GTK[0..N] = 0 */
@ -3981,7 +3982,7 @@ static int wpa_group_update_sta(struct wpa_state_machine *sm, void *ctx)
if (sm->wpa_ptk_state != WPA_PTK_PTKINITDONE) { if (sm->wpa_ptk_state != WPA_PTK_PTKINITDONE) {
wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG, wpa_auth_logger(sm->wpa_auth, sm->addr, LOGGER_DEBUG,
"Not in PTKINITDONE; skip Group Key update"); "Not in PTKINITDONE; skip Group Key update");
sm->GUpdateStationKeys = FALSE; sm->GUpdateStationKeys = false;
return 0; return 0;
} }
if (sm->GUpdateStationKeys) { if (sm->GUpdateStationKeys) {
@ -3999,7 +4000,7 @@ static int wpa_group_update_sta(struct wpa_state_machine *sm, void *ctx)
return 0; return 0;
sm->group->GKeyDoneStations++; sm->group->GKeyDoneStations++;
sm->GUpdateStationKeys = TRUE; sm->GUpdateStationKeys = true;
wpa_sm_step(sm); wpa_sm_step(sm);
return 0; return 0;
@ -4125,9 +4126,9 @@ static void wpa_group_setkeys(struct wpa_authenticator *wpa_auth,
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: group state machine entering state SETKEYS (VLAN-ID %d)", "WPA: group state machine entering state SETKEYS (VLAN-ID %d)",
group->vlan_id); group->vlan_id);
group->changed = TRUE; group->changed = true;
group->wpa_group_state = WPA_GROUP_SETKEYS; group->wpa_group_state = WPA_GROUP_SETKEYS;
group->GTKReKey = FALSE; group->GTKReKey = false;
tmp = group->GM; tmp = group->GM;
group->GM = group->GN; group->GM = group->GN;
group->GN = tmp; group->GN = tmp;
@ -4199,7 +4200,7 @@ static int wpa_group_disconnect_cb(struct wpa_state_machine *sm, void *ctx)
wpa_printf(MSG_DEBUG, "WPA: Mark STA " MACSTR wpa_printf(MSG_DEBUG, "WPA: Mark STA " MACSTR
" for disconnection due to fatal failure", " for disconnection due to fatal failure",
MAC2STR(sm->addr)); MAC2STR(sm->addr));
sm->Disconnect = TRUE; sm->Disconnect = true;
} }
return 0; return 0;
@ -4211,7 +4212,7 @@ static void wpa_group_fatal_failure(struct wpa_authenticator *wpa_auth,
{ {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: group state machine entering state FATAL_FAILURE"); "WPA: group state machine entering state FATAL_FAILURE");
group->changed = TRUE; group->changed = true;
group->wpa_group_state = WPA_GROUP_FATAL_FAILURE; group->wpa_group_state = WPA_GROUP_FATAL_FAILURE;
wpa_auth_for_each_sta(wpa_auth, wpa_group_disconnect_cb, group); wpa_auth_for_each_sta(wpa_auth, wpa_group_disconnect_cb, group);
} }
@ -4223,7 +4224,7 @@ static int wpa_group_setkeysdone(struct wpa_authenticator *wpa_auth,
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"WPA: group state machine entering state SETKEYSDONE (VLAN-ID %d)", "WPA: group state machine entering state SETKEYSDONE (VLAN-ID %d)",
group->vlan_id); group->vlan_id);
group->changed = TRUE; group->changed = true;
group->wpa_group_state = WPA_GROUP_SETKEYSDONE; group->wpa_group_state = WPA_GROUP_SETKEYSDONE;
if (wpa_group_config_group_keys(wpa_auth, group) < 0) { if (wpa_group_config_group_keys(wpa_auth, group) < 0) {
@ -4275,8 +4276,8 @@ static int wpa_sm_step(struct wpa_state_machine *sm)
if (sm->pending_deinit) if (sm->pending_deinit)
break; break;
sm->changed = FALSE; sm->changed = false;
sm->wpa_auth->group->changed = FALSE; sm->wpa_auth->group->changed = false;
SM_STEP_RUN(WPA_PTK); SM_STEP_RUN(WPA_PTK);
if (sm->pending_deinit) if (sm->pending_deinit)

View file

@ -2799,8 +2799,8 @@ void wpa_ft_install_ptk(struct wpa_state_machine *sm, int retry)
return; return;
/* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */ /* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */
sm->pairwise_set = TRUE; sm->pairwise_set = true;
sm->tk_already_set = TRUE; sm->tk_already_set = true;
} }
@ -3157,8 +3157,8 @@ pmk_r1_derived:
return WLAN_STATUS_UNSPECIFIED_FAILURE; return WLAN_STATUS_UNSPECIFIED_FAILURE;
sm->pairwise = pairwise; sm->pairwise = pairwise;
sm->PTK_valid = TRUE; sm->PTK_valid = true;
sm->tk_already_set = FALSE; sm->tk_already_set = false;
wpa_ft_install_ptk(sm, 0); wpa_ft_install_ptk(sm, 0);
if (wpa_ft_set_vlan(sm->wpa_auth, sm->addr, &vlan) < 0) { if (wpa_ft_set_vlan(sm->wpa_auth, sm->addr, &vlan) < 0) {

View file

@ -277,16 +277,15 @@ static void hostapd_wpa_auth_set_eapol(void *ctx, const u8 *addr,
break; break;
case WPA_EAPOL_keyRun: case WPA_EAPOL_keyRun:
if (sta->eapol_sm) if (sta->eapol_sm)
sta->eapol_sm->keyRun = value ? TRUE : FALSE; sta->eapol_sm->keyRun = value;
break; break;
case WPA_EAPOL_keyAvailable: case WPA_EAPOL_keyAvailable:
if (sta->eapol_sm) if (sta->eapol_sm)
sta->eapol_sm->eap_if->eapKeyAvailable = sta->eapol_sm->eap_if->eapKeyAvailable = value;
value ? TRUE : FALSE;
break; break;
case WPA_EAPOL_keyDone: case WPA_EAPOL_keyDone:
if (sta->eapol_sm) if (sta->eapol_sm)
sta->eapol_sm->keyDone = value ? TRUE : FALSE; sta->eapol_sm->keyDone = value;
break; break;
case WPA_EAPOL_inc_EapolFramesTx: case WPA_EAPOL_inc_EapolFramesTx:
if (sta->eapol_sm) if (sta->eapol_sm)

View file

@ -39,20 +39,20 @@ struct wpa_state_machine {
WPA_PTK_GROUP_KEYERROR WPA_PTK_GROUP_KEYERROR
} wpa_ptk_group_state; } wpa_ptk_group_state;
Boolean Init; bool Init;
Boolean DeauthenticationRequest; bool DeauthenticationRequest;
Boolean AuthenticationRequest; bool AuthenticationRequest;
Boolean ReAuthenticationRequest; bool ReAuthenticationRequest;
Boolean Disconnect; bool Disconnect;
u16 disconnect_reason; /* specific reason code to use with Disconnect */ u16 disconnect_reason; /* specific reason code to use with Disconnect */
u32 TimeoutCtr; u32 TimeoutCtr;
u32 GTimeoutCtr; u32 GTimeoutCtr;
Boolean TimeoutEvt; bool TimeoutEvt;
Boolean EAPOLKeyReceived; bool EAPOLKeyReceived;
Boolean EAPOLKeyPairwise; bool EAPOLKeyPairwise;
Boolean EAPOLKeyRequest; bool EAPOLKeyRequest;
Boolean MICVerified; bool MICVerified;
Boolean GUpdateStationKeys; bool GUpdateStationKeys;
u8 ANonce[WPA_NONCE_LEN]; u8 ANonce[WPA_NONCE_LEN];
u8 SNonce[WPA_NONCE_LEN]; u8 SNonce[WPA_NONCE_LEN];
u8 alt_SNonce[WPA_NONCE_LEN]; u8 alt_SNonce[WPA_NONCE_LEN];
@ -62,21 +62,21 @@ struct wpa_state_machine {
u8 pmkid[PMKID_LEN]; /* valid if pmkid_set == 1 */ u8 pmkid[PMKID_LEN]; /* valid if pmkid_set == 1 */
struct wpa_ptk PTK; struct wpa_ptk PTK;
u8 keyidx_active; u8 keyidx_active;
Boolean use_ext_key_id; bool use_ext_key_id;
Boolean PTK_valid; bool PTK_valid;
Boolean pairwise_set; bool pairwise_set;
Boolean tk_already_set; bool tk_already_set;
int keycount; int keycount;
Boolean Pair; bool Pair;
struct wpa_key_replay_counter { struct wpa_key_replay_counter {
u8 counter[WPA_REPLAY_COUNTER_LEN]; u8 counter[WPA_REPLAY_COUNTER_LEN];
Boolean valid; bool valid;
} key_replay[RSNA_MAX_EAPOL_RETRIES], } key_replay[RSNA_MAX_EAPOL_RETRIES],
prev_key_replay[RSNA_MAX_EAPOL_RETRIES]; prev_key_replay[RSNA_MAX_EAPOL_RETRIES];
Boolean PInitAKeys; /* WPA only, not in IEEE 802.11i */ bool PInitAKeys; /* WPA only, not in IEEE 802.11i */
Boolean PTKRequest; /* not in IEEE 802.11i state machine */ bool PTKRequest; /* not in IEEE 802.11i state machine */
Boolean has_GTK; bool has_GTK;
Boolean PtkGroupInit; /* init request for PTK Group state machine */ bool PtkGroupInit; /* init request for PTK Group state machine */
u8 *last_rx_eapol_key; /* starting from IEEE 802.1X header */ u8 *last_rx_eapol_key; /* starting from IEEE 802.1X header */
size_t last_rx_eapol_key_len; size_t last_rx_eapol_key_len;
@ -174,12 +174,12 @@ struct wpa_group {
struct wpa_group *next; struct wpa_group *next;
int vlan_id; int vlan_id;
Boolean GInit; bool GInit;
int GKeyDoneStations; int GKeyDoneStations;
Boolean GTKReKey; bool GTKReKey;
int GTK_len; int GTK_len;
int GN, GM; int GN, GM;
Boolean GTKAuthenticator; bool GTKAuthenticator;
u8 Counter[WPA_NONCE_LEN]; u8 Counter[WPA_NONCE_LEN];
enum { enum {
@ -191,9 +191,9 @@ struct wpa_group {
u8 GMK[WPA_GMK_LEN]; u8 GMK[WPA_GMK_LEN];
u8 GTK[2][WPA_GTK_MAX_LEN]; u8 GTK[2][WPA_GTK_MAX_LEN];
u8 GNonce[WPA_NONCE_LEN]; u8 GNonce[WPA_NONCE_LEN];
Boolean changed; bool changed;
Boolean first_sta_seen; bool first_sta_seen;
Boolean reject_4way_hs_for_entropy; bool reject_4way_hs_for_entropy;
u8 IGTK[2][WPA_IGTK_MAX_LEN]; u8 IGTK[2][WPA_IGTK_MAX_LEN];
u8 BIGTK[2][WPA_IGTK_MAX_LEN]; u8 BIGTK[2][WPA_IGTK_MAX_LEN];
int GN_igtk, GM_igtk; int GN_igtk, GM_igtk;

View file

@ -950,7 +950,7 @@ wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
if (conf->extended_key_id && sm->wpa == WPA_VERSION_WPA2 && if (conf->extended_key_id && sm->wpa == WPA_VERSION_WPA2 &&
sm->pairwise != WPA_CIPHER_TKIP && sm->pairwise != WPA_CIPHER_TKIP &&
(data.capabilities & WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST)) { (data.capabilities & WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST)) {
sm->use_ext_key_id = TRUE; sm->use_ext_key_id = true;
if (conf->extended_key_id == 2 && if (conf->extended_key_id == 2 &&
!wpa_key_mgmt_ft(sm->wpa_key_mgmt) && !wpa_key_mgmt_ft(sm->wpa_key_mgmt) &&
!wpa_key_mgmt_fils(sm->wpa_key_mgmt)) !wpa_key_mgmt_fils(sm->wpa_key_mgmt))
@ -961,7 +961,7 @@ wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
"RSN: Extended Key ID supported (start with %d)", "RSN: Extended Key ID supported (start with %d)",
sm->keyidx_active); sm->keyidx_active);
} else { } else {
sm->use_ext_key_id = FALSE; sm->use_ext_key_id = false;
} }
if (sm->wpa_ie == NULL || sm->wpa_ie_len < wpa_ie_len) { if (sm->wpa_ie == NULL || sm->wpa_ie_len < wpa_ie_len) {