PASN: Use allocated memory for RSNXE and allow its contents to be set

This will be needed for P2P2 cases.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
This commit is contained in:
Shivani Baranwal 2024-08-05 02:43:59 +05:30 committed by Jouni Malinen
parent d582f8ce9b
commit 8426e5274f
3 changed files with 10 additions and 3 deletions

View file

@ -28,6 +28,9 @@ struct pasn_data * pasn_data_init(void)
void pasn_data_deinit(struct pasn_data *pasn)
{
if (!pasn)
return;
os_free(pasn->rsnxe_ie);
bin_clear_free(pasn, sizeof(struct pasn_data));
}
@ -157,7 +160,7 @@ void pasn_set_rsnxe_ie(struct pasn_data *pasn, const u8 *rsnxe_ie)
{
if (!pasn || !rsnxe_ie)
return;
pasn->rsnxe_ie = rsnxe_ie;
pasn->rsnxe_ie = os_memdup(rsnxe_ie, 2 + rsnxe_ie[1]);
}

View file

@ -54,7 +54,7 @@ struct pasn_data {
int wpa_key_mgmt;
int rsn_pairwise;
u16 rsnxe_capab;
const u8 *rsnxe_ie;
u8 *rsnxe_ie;
bool custom_pmkid_valid;
u8 custom_pmkid[PMKID_LEN];

View file

@ -646,7 +646,10 @@ static struct wpabuf * wpas_pasn_build_auth_1(struct pasn_data *pasn,
if (wpa_pasn_add_wrapped_data(buf, wrapped_data_buf) < 0)
goto fail;
wpa_pasn_add_rsnxe(buf, pasn->rsnxe_capab);
if (pasn->rsnxe_ie)
wpabuf_put_data(buf, pasn->rsnxe_ie, 2 + pasn->rsnxe_ie[1]);
else
wpa_pasn_add_rsnxe(buf, pasn->rsnxe_capab);
wpa_pasn_add_extra_ies(buf, pasn->extra_ies, pasn->extra_ies_len);
@ -806,6 +809,7 @@ void wpa_pasn_reset(struct pasn_data *pasn)
pasn->derive_kdk = false;
pasn->rsn_ie = NULL;
pasn->rsn_ie_len = 0;
os_free(pasn->rsnxe_ie);
pasn->rsnxe_ie = NULL;
pasn->custom_pmkid_valid = false;