fix(esp_wifi): Cosmetic changes for wpa_supplicant

This commit is contained in:
Shreyas Sheth
2025-03-19 15:36:12 +05:30
committed by Kapil Gupta
parent f7e886bfed
commit 35e73c0147

View File

@@ -1462,7 +1462,7 @@ static int wpa_supplicant_activate_ptk(struct wpa_sm *sm)
static int wpa_supplicant_send_4_of_4_txcallback(struct wpa_sm *sm) static int wpa_supplicant_send_4_of_4_txcallback(struct wpa_sm *sm)
{ {
u16 key_info=sm->key_info; u16 key_info = sm->key_info;
if (sm->key_install && key_info & WPA_KEY_INFO_INSTALL) { if (sm->key_install && key_info & WPA_KEY_INFO_INSTALL) {
if (sm->use_ext_key_id) { if (sm->use_ext_key_id) {
@@ -1947,8 +1947,7 @@ int wpa_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len)
hdr = (struct ieee802_1x_hdr *) tmp; hdr = (struct ieee802_1x_hdr *) tmp;
key = (struct wpa_eapol_key *) (hdr + 1); key = (struct wpa_eapol_key *) (hdr + 1);
key192 = (struct wpa_eapol_key_192 *) key192 = (struct wpa_eapol_key_192 *)(tmp + sizeof(struct ieee802_1x_hdr));
(tmp + sizeof(struct ieee802_1x_hdr));
if (mic_len == 24) if (mic_len == 24)
key_data = (u8 *) (key192 + 1); key_data = (u8 *) (key192 + 1);
else else
@@ -2604,6 +2603,17 @@ int wpa_set_bss(uint8_t *macddr, uint8_t *bssid, u8 pairwise_cipher, u8 group_ci
} }
esp_set_assoc_ie(bssid, assoc_ie, assoc_ie_len, true); esp_set_assoc_ie(bssid, assoc_ie, assoc_ie_len, true);
if (sm->ap_rsnxe != NULL) {
#ifdef CONFIG_SAE_PK
const u8 *pw = (const u8 *)esp_wifi_sta_get_prof_password_internal();
if (esp_wifi_sta_get_config_sae_pk_internal() != WPA3_SAE_PK_MODE_DISABLED &&
sae_pk_valid_password((const char*)pw)) {
sm->sae_pk = true;
}
#endif /* CONFIG_SAE_PK */
}
os_memset(sm->ssid, 0, sizeof(sm->ssid)); os_memset(sm->ssid, 0, sizeof(sm->ssid));
os_memcpy(sm->ssid, ssid, ssid_len); os_memcpy(sm->ssid, ssid, ssid_len);
sm->ssid_len = ssid_len; sm->ssid_len = ssid_len;
@@ -2622,8 +2632,7 @@ int wpa_set_bss(uint8_t *macddr, uint8_t *bssid, u8 pairwise_cipher, u8 group_ci
/* /*
* Call after set ssid since we calc pmk inside this routine directly * Call after set ssid since we calc pmk inside this routine directly
*/ */
void void wpa_set_passphrase(char * passphrase, u8 *ssid, size_t ssid_len)
wpa_set_passphrase(char * passphrase, u8 *ssid, size_t ssid_len)
{ {
struct wifi_ssid *sta_ssid = esp_wifi_sta_get_prof_ssid_internal(); struct wifi_ssid *sta_ssid = esp_wifi_sta_get_prof_ssid_internal();
struct wpa_sm *sm = &gWpaSm; struct wpa_sm *sm = &gWpaSm;
@@ -2668,15 +2677,14 @@ wpa_set_passphrase(char * passphrase, u8 *ssid, size_t ssid_len)
#endif /* CONFIG_IEEE80211R */ #endif /* CONFIG_IEEE80211R */
} }
void void set_assoc_ie(u8 * assoc_buf)
set_assoc_ie(u8 * assoc_buf)
{ {
struct wpa_sm *sm = &gWpaSm; struct wpa_sm *sm = &gWpaSm;
sm->assoc_wpa_ie = assoc_buf + 2; sm->assoc_wpa_ie = assoc_buf + 2;
//wpa_ie insert OUI 4 byte before ver, but RSN have 2 bytes of RSN capability, //wpa_ie insert OUI 4 byte before ver, but RSN have 2 bytes of RSN capability,
// so wpa_ie have two more bytes than rsn_ie // so wpa_ie have two more bytes than rsn_ie
if ( sm->proto == WPA_PROTO_WPA) if (sm->proto == WPA_PROTO_WPA)
sm->assoc_wpa_ie_len = ASSOC_IE_LEN; sm->assoc_wpa_ie_len = ASSOC_IE_LEN;
else else
sm->assoc_wpa_ie_len = ASSOC_IE_LEN - 2; sm->assoc_wpa_ie_len = ASSOC_IE_LEN - 2;