mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(esp_wifi): Fix some wifi bugs
1. Fix issues related to mgmt packets encryption in GCMP 2. Fix issue of wrong decryption of mgmt packets when PMF is enabled 3. Fix frame subtype in send_mgmt_frame 4. Fix issue of wrong Rx control information of espnow packets for esp32 and esp32s2 5. Fix send mgmt err when eapol process
This commit is contained in:
parent
7fd73ede7f
commit
af72ce1f75
@ -1865,8 +1865,8 @@ ieee80211_decap = 0x40001ffc;
|
|||||||
ieee80211_set_tx_pti = 0x40002000;
|
ieee80211_set_tx_pti = 0x40002000;
|
||||||
wifi_is_started = 0x40002004;
|
wifi_is_started = 0x40002004;
|
||||||
ieee80211_gettid = 0x40002008;
|
ieee80211_gettid = 0x40002008;
|
||||||
ieee80211_ccmp_decrypt = 0x4000200c;
|
/* ieee80211_ccmp_decrypt = 0x4000200c; */
|
||||||
ieee80211_ccmp_encrypt = 0x40002010;
|
/* ieee80211_ccmp_encrypt = 0x40002010; */
|
||||||
ccmp_encap = 0x40002014;
|
ccmp_encap = 0x40002014;
|
||||||
ccmp_decap = 0x40002018;
|
ccmp_decap = 0x40002018;
|
||||||
tkip_encap = 0x4000201c;
|
tkip_encap = 0x4000201c;
|
||||||
@ -1920,7 +1920,7 @@ ieee80211_crypto_aes_128_cmac_encrypt = 0x40002100;
|
|||||||
ieee80211_alloc_tx_buf = 0x40002108;
|
ieee80211_alloc_tx_buf = 0x40002108;
|
||||||
/* ieee80211_output_do = 0x4000210c; */
|
/* ieee80211_output_do = 0x4000210c; */
|
||||||
/* ieee80211_send_nulldata = 0x40002110; */
|
/* ieee80211_send_nulldata = 0x40002110; */
|
||||||
ieee80211_setup_robust_mgmtframe = 0x40002114;
|
/* ieee80211_setup_robust_mgmtframe = 0x40002114; */
|
||||||
ieee80211_encap_null_data = 0x4000211c;
|
ieee80211_encap_null_data = 0x4000211c;
|
||||||
ieee80211_send_deauth = 0x40002120;
|
ieee80211_send_deauth = 0x40002120;
|
||||||
ieee80211_alloc_deauth = 0x40002124;
|
ieee80211_alloc_deauth = 0x40002124;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 87ac448921a733c73ea0a3903cc5711f8629a000
|
Subproject commit ca20e894399e28aabb8c9f87bf70883fccad9ba0
|
@ -778,10 +778,10 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
req->ifx = WIFI_IF_STA;
|
req->ifx = WIFI_IF_STA;
|
||||||
req->subtype = WLAN_FC_STYPE_ACTION;
|
req->subtype = (WLAN_FC_STYPE_ACTION << 4);
|
||||||
req->data_len = data_len;
|
req->data_len = data_len;
|
||||||
os_memcpy(req->data, data, req->data_len);
|
os_memcpy(req->data, data, req->data_len);
|
||||||
|
|
||||||
if (esp_wifi_send_mgmt_frm_internal(req) != 0) {
|
if (esp_wifi_send_mgmt_frm_internal(req) != 0) {
|
||||||
wpa_printf(MSG_ERROR, "action frame sending failed");
|
wpa_printf(MSG_ERROR, "action frame sending failed");
|
||||||
|
@ -124,7 +124,7 @@ struct wpa_funcs {
|
|||||||
bool (*wpa_sta_in_4way_handshake)(void);
|
bool (*wpa_sta_in_4way_handshake)(void);
|
||||||
void *(*wpa_ap_init)(void);
|
void *(*wpa_ap_init)(void);
|
||||||
bool (*wpa_ap_deinit)(void *data);
|
bool (*wpa_ap_deinit)(void *data);
|
||||||
bool (*wpa_ap_join)(void **sm, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, bool *pmf_enable);
|
bool (*wpa_ap_join)(void **sm, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, bool *pmf_enable, uint8_t *pairwise_cipher);
|
||||||
bool (*wpa_ap_remove)(void *sm);
|
bool (*wpa_ap_remove)(void *sm);
|
||||||
uint8_t *(*wpa_ap_get_wpa_ie)(uint8_t *len);
|
uint8_t *(*wpa_ap_get_wpa_ie)(uint8_t *len);
|
||||||
bool (*wpa_ap_rx_eapol)(void *hapd_data, void *sm, u8 *data, size_t data_len);
|
bool (*wpa_ap_rx_eapol)(void *hapd_data, void *sm, u8 *data, size_t data_len);
|
||||||
|
@ -302,7 +302,7 @@ static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_i
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, bool *pmf_enable)
|
static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, bool *pmf_enable, uint8_t *pairwise_cipher)
|
||||||
{
|
{
|
||||||
struct sta_info *sta_info;
|
struct sta_info *sta_info;
|
||||||
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
||||||
@ -326,7 +326,7 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len, bo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wpa_ap_join(sta_info, bssid, wpa_ie, wpa_ie_len, pmf_enable)) {
|
if (wpa_ap_join(sta_info, bssid, wpa_ie, wpa_ie_len, pmf_enable, pairwise_cipher)) {
|
||||||
*sta = sta_info;
|
*sta = sta_info;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ struct hostapd_config {
|
|||||||
char country[3]; /* first two octets: country code as described in
|
char country[3]; /* first two octets: country code as described in
|
||||||
* ISO/IEC 3166-1. Third octet:
|
* ISO/IEC 3166-1. Third octet:
|
||||||
* ' ' (ascii 32): all environments
|
* ' ' (ascii 32): all environments
|
||||||
* 'O': Outdoor environemnt only
|
* 'O': Outdoor environment only
|
||||||
* 'I': Indoor environment only
|
* 'I': Indoor environment only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
|
|||||||
const u8 *addr, const u8 *prev_psk);
|
const u8 *addr, const u8 *prev_psk);
|
||||||
int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
|
int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
|
||||||
struct sta_info;
|
struct sta_info;
|
||||||
bool wpa_ap_join(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie, uint8_t wpa_ie_len, bool *pmf_enable);
|
bool wpa_ap_join(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie, uint8_t wpa_ie_len, bool *pmf_enable, uint8_t *pairwise_cipher);
|
||||||
bool wpa_ap_remove(void* sta_info);
|
bool wpa_ap_remove(void* sta_info);
|
||||||
|
|
||||||
#endif /* HOSTAPD_CONFIG_H */
|
#endif /* HOSTAPD_CONFIG_H */
|
||||||
|
@ -2375,7 +2375,7 @@ static int wpa_sm_step(struct wpa_state_machine *sm)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wpa_ap_join(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie, uint8_t wpa_ie_len, bool *pmf_enable)
|
bool wpa_ap_join(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie, uint8_t wpa_ie_len, bool *pmf_enable, uint8_t *pairwise_cipher)
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = (struct hostapd_data*)esp_wifi_get_hostap_private_internal();
|
struct hostapd_data *hapd = (struct hostapd_data*)esp_wifi_get_hostap_private_internal();
|
||||||
|
|
||||||
@ -2402,6 +2402,7 @@ bool wpa_ap_join(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie, uint8_t
|
|||||||
|
|
||||||
//Check whether AP uses Management Frame Protection for this connection
|
//Check whether AP uses Management Frame Protection for this connection
|
||||||
*pmf_enable = wpa_auth_uses_mfp(sta->wpa_sm);
|
*pmf_enable = wpa_auth_uses_mfp(sta->wpa_sm);
|
||||||
|
*pairwise_cipher = GET_BIT_POSITION(sta->wpa_sm->pairwise);
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);
|
wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);
|
||||||
|
@ -222,7 +222,7 @@ u8 * ccmp_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen,
|
|||||||
wpa_hexdump(MSG_MSGDUMP, "CCMP AAD", aad, aad_len);
|
wpa_hexdump(MSG_MSGDUMP, "CCMP AAD", aad, aad_len);
|
||||||
wpa_hexdump(MSG_MSGDUMP, "CCMP nonce", nonce, 13);
|
wpa_hexdump(MSG_MSGDUMP, "CCMP nonce", nonce, 13);
|
||||||
|
|
||||||
if (aes_ccm_ae(tk, 16, nonce, 8, frame + hdrlen, plen, aad, aad_len,
|
if (aes_ccm_ae(tk, 16, nonce, 8, frame + hdrlen + 8, plen, aad, aad_len,
|
||||||
pos, pos + plen) < 0) {
|
pos, pos + plen) < 0) {
|
||||||
wpa_printf(MSG_ERROR, "aes ccm ae failed");
|
wpa_printf(MSG_ERROR, "aes ccm ae failed");
|
||||||
os_free(crypt);
|
os_free(crypt);
|
||||||
|
@ -335,6 +335,10 @@ void perror(const char *s);
|
|||||||
#define BIT(x) (1U << (x))
|
#define BIT(x) (1U << (x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GET_BIT_POSITION
|
||||||
|
#define GET_BIT_POSITION(value) (__builtin_ffs(value) - 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definitions for sparse validation
|
* Definitions for sparse validation
|
||||||
* (http://kernel.org/pub/linux/kernel/people/josh/sparse/)
|
* (http://kernel.org/pub/linux/kernel/people/josh/sparse/)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user