PASN: Remove wpa_s dependency for wpas_pasn_auth_tx_status()

This is a step towards allowing the PASN implementation to be used
outside the context of wpa_supplicant.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Vinay Gannevaram 2022-09-18 19:16:04 +05:30 committed by Jouni Malinen
parent de4b73a36a
commit e2e87b90bf

View file

@ -1987,23 +1987,16 @@ void wpas_pasn_auth_trigger(struct wpa_supplicant *wpa_s,
}
int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
const u8 *data, size_t data_len, u8 acked)
static int wpa_pasn_auth_tx_status(struct wpas_pasn *pasn,
const u8 *data, size_t data_len, u8 acked)
{
struct wpas_pasn *pasn = &wpa_s->pasn;
const struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) data;
u16 fc = host_to_le16((WLAN_FC_TYPE_MGMT << 2) |
(WLAN_FC_STYPE_AUTH << 4));
wpa_printf(MSG_DEBUG, "PASN: auth_tx_status: acked=%u", acked);
if (!wpa_s->pasn_auth_work) {
wpa_printf(MSG_DEBUG,
"PASN: auth_tx_status: no work in progress");
return -1;
}
if (!mgmt ||
data_len < offsetof(struct ieee80211_mgmt, u.auth.variable))
return -1;
@ -2046,23 +2039,44 @@ int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
* Either frame was not ACKed or it was ACKed but the trans_seq
* != 1, i.e., not expecting an RX frame, so we are done.
*/
if (!wpa_s->pasn_params) {
wpas_pasn_auth_stop(wpa_s);
return 0;
}
wpas_pasn_set_keys_from_cache(wpa_s, pasn->own_addr,
pasn->bssid, pasn->cipher,
pasn->akmp);
wpas_pasn_auth_stop(wpa_s);
wpas_pasn_auth_work_done(wpa_s, PASN_STATUS_SUCCESS);
return 1;
}
return 0;
}
int wpas_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
const u8 *data, size_t data_len, u8 acked)
{
struct wpas_pasn *pasn = &wpa_s->pasn;
int ret;
if (!wpa_s->pasn_auth_work) {
wpa_printf(MSG_DEBUG,
"PASN: auth_tx_status: no work in progress");
return -1;
}
ret = wpa_pasn_auth_tx_status(pasn, data, data_len, acked);
if (ret != 1)
return ret;
if (!wpa_s->pasn_params) {
wpas_pasn_auth_stop(wpa_s);
return 0;
}
wpas_pasn_set_keys_from_cache(wpa_s, pasn->own_addr, pasn->bssid,
pasn->cipher, pasn->akmp);
wpas_pasn_auth_stop(wpa_s);
wpas_pasn_auth_work_done(wpa_s, PASN_STATUS_SUCCESS);
return 0;
}
int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr,
const u8 *bssid)
{