mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'master' into feature/esp32s2beta_merge
This commit is contained in:
@@ -213,7 +213,6 @@ bool esp_wifi_get_sniffer_internal(void);
|
||||
int esp_wifi_set_wps_cb_internal(struct wps_funcs *wps_cb);
|
||||
bool esp_wifi_enable_sta_privacy_internal(void);
|
||||
uint8_t esp_wifi_get_user_init_flag_internal(void);
|
||||
esp_err_t esp_wifi_send_event_internal(system_event_t *evt);
|
||||
esp_err_t esp_wifi_internal_supplicant_header_md5_check(const char *md5);
|
||||
int esp_wifi_sta_update_ap_info_internal(void);
|
||||
uint8_t *esp_wifi_sta_get_ap_info_prof_pmk_internal(void);
|
||||
|
||||
@@ -58,7 +58,7 @@ static struct eap_sm *gEapSm = NULL;
|
||||
static int eap_peer_sm_init(void);
|
||||
static void eap_peer_sm_deinit(void);
|
||||
|
||||
static int wpa2_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid);
|
||||
static int eap_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid);
|
||||
static int wpa2_start_eapol_internal(void);
|
||||
int wpa2_post(uint32_t sig, uint32_t par);
|
||||
|
||||
@@ -216,7 +216,7 @@ void wpa2_task(void *pvParameters )
|
||||
struct wpa2_rx_param *param = NULL;
|
||||
|
||||
while ((param = wpa2_rxq_dequeue()) != NULL){
|
||||
wpa2_sm_rx_eapol_internal(param->sa, param->buf, param->len, param->bssid);
|
||||
eap_sm_rx_eapol_internal(param->sa, param->buf, param->len, param->bssid);
|
||||
os_free(param->buf);
|
||||
os_free(param);
|
||||
}
|
||||
@@ -511,7 +511,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int wpa2_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid)
|
||||
static int eap_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid)
|
||||
{
|
||||
struct eap_sm *sm = gEapSm;
|
||||
|
||||
@@ -541,12 +541,35 @@ static int wpa2_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid)
|
||||
}
|
||||
#else
|
||||
|
||||
return wpa2_sm_rx_eapol_internal(src_addr, buf, len, bssid);
|
||||
return eap_sm_rx_eapol_internal(src_addr, buf, len, bssid);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int wpa2_ent_rx_eapol(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid)
|
||||
{
|
||||
struct ieee802_1x_hdr *hdr;
|
||||
int ret = ESP_OK;
|
||||
|
||||
static int wpa2_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid)
|
||||
hdr = (struct ieee802_1x_hdr *) buf;
|
||||
|
||||
switch (hdr->type) {
|
||||
case IEEE802_1X_TYPE_EAPOL_START:
|
||||
case IEEE802_1X_TYPE_EAP_PACKET:
|
||||
case IEEE802_1X_TYPE_EAPOL_LOGOFF:
|
||||
ret = eap_sm_rx_eapol(src_addr, buf, len, bssid);
|
||||
break;
|
||||
case IEEE802_1X_TYPE_EAPOL_KEY:
|
||||
ret = wpa_sm_rx_eapol(src_addr, buf, len);
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_ERROR, "Unknown EAPOL packet type - %d\n", hdr->type);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int eap_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bssid)
|
||||
{
|
||||
struct eap_sm *sm = gEapSm;
|
||||
u32 plen, data_len;
|
||||
@@ -614,6 +637,12 @@ static int wpa2_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bs
|
||||
#ifdef EAP_PEER_METHOD
|
||||
switch (ehdr->code) {
|
||||
case EAP_CODE_REQUEST:
|
||||
/* Handle EAP-reauthentication case */
|
||||
if (sm->finish_state == WPA2_ENT_EAP_STATE_SUCCESS) {
|
||||
wpa_printf(MSG_INFO, ">>>>>wpa2 EAP Re-authentication in progress\n");
|
||||
wpa2_set_eap_state(WPA2_ENT_EAP_STATE_IN_PROGRESS);
|
||||
}
|
||||
|
||||
req = wpabuf_alloc_copy((u8 *)ehdr, len - sizeof(*hdr));
|
||||
ret = eap_sm_process_request(sm, req);
|
||||
break;
|
||||
@@ -628,6 +657,7 @@ static int wpa2_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bs
|
||||
wpa_printf(MSG_INFO, ">>>>>wpa2 FINISH\n");
|
||||
ret = WPA2_ENT_EAP_STATE_SUCCESS;
|
||||
wpa2_set_eap_state(WPA2_ENT_EAP_STATE_SUCCESS);
|
||||
eap_deinit_prev_method(sm, "EAP Success");
|
||||
} else {
|
||||
wpa_printf(MSG_INFO, ">>>>>wpa2 FAILED, receive EAP_SUCCESS but pmk is empty, potential attack!\n");
|
||||
ret = WPA2_ENT_EAP_STATE_FAIL;
|
||||
@@ -821,7 +851,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable_fn(void *arg)
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
wpa2_cb->wpa2_sm_rx_eapol = wpa2_sm_rx_eapol;
|
||||
wpa2_cb->wpa2_sm_rx_eapol = wpa2_ent_rx_eapol;
|
||||
wpa2_cb->wpa2_start = wpa2_start_eapol;
|
||||
wpa2_cb->wpa2_init = eap_peer_sm_init;
|
||||
wpa2_cb->wpa2_deinit = eap_peer_sm_deinit;
|
||||
|
||||
@@ -413,10 +413,9 @@ struct wps_data *wps_init(void)
|
||||
os_bzero(tmpp, 9);
|
||||
memcpy(tmpp, data->dev_password, 8);
|
||||
wpa_printf(MSG_DEBUG, "WPS PIN [%s]", tmpp);
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_PIN;
|
||||
memcpy(evt.event_info.sta_er_pin.pin_code, data->dev_password, 8);
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
wifi_event_sta_wps_er_pin_t evt;
|
||||
memcpy(evt.pin_code, data->dev_password, 8);
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_PIN, &evt, sizeof(evt), portMAX_DELAY);
|
||||
} while (0);
|
||||
} else if (wps_get_type() == WPS_TYPE_PBC) {
|
||||
data->pbc = 1;
|
||||
@@ -931,7 +930,7 @@ int wps_start_pending(void)
|
||||
return wps_tx_start();
|
||||
}
|
||||
|
||||
int wps_stop_process(system_event_sta_wps_fail_reason_t reason_code)
|
||||
int wps_stop_process(wifi_event_sta_wps_fail_reason_t reason_code)
|
||||
{
|
||||
struct wps_sm *sm = gWpsSm;
|
||||
|
||||
@@ -955,10 +954,8 @@ int wps_stop_process(system_event_sta_wps_fail_reason_t reason_code)
|
||||
esp_wifi_disconnect();
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Write wps_fail_information");
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_FAILED;
|
||||
evt.event_info.sta_er_fail_reason = reason_code;
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, &reason_code, sizeof(reason_code), portMAX_DELAY);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -976,9 +973,7 @@ int wps_finish(void)
|
||||
wifi_config_t *config = (wifi_config_t *)os_zalloc(sizeof(wifi_config_t));
|
||||
|
||||
if (config == NULL) {
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_FAILED;
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, 0, 0, portMAX_DELAY);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -1251,9 +1246,7 @@ out:
|
||||
esp_wifi_disarm_sta_connection_timer_internal();
|
||||
ets_timer_disarm(&sm->wps_timeout_timer);
|
||||
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_FAILED;
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, 0, 0, portMAX_DELAY);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1456,9 +1449,7 @@ wifi_station_wps_timeout_internal(void)
|
||||
|
||||
wps_set_status(WPS_STATUS_DISABLE);
|
||||
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_TIMEOUT;
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_TIMEOUT, 0, 0, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void wifi_station_wps_timeout(void)
|
||||
@@ -1503,9 +1494,7 @@ void wifi_station_wps_msg_timeout(void)
|
||||
|
||||
void wifi_station_wps_success_internal(void)
|
||||
{
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_SUCCESS;
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_SUCCESS, 0, 0, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void wifi_station_wps_success(void)
|
||||
@@ -1780,10 +1769,7 @@ wifi_wps_scan_done(void *arg, STATUS status)
|
||||
} else {
|
||||
wpa_printf(MSG_INFO, "PBC session overlap!");
|
||||
wps_set_status(WPS_STATUS_DISABLE);
|
||||
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_STA_WPS_ER_PBC_OVERLAP;
|
||||
esp_wifi_send_event_internal(&evt);
|
||||
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_PBC_OVERLAP, 0, 0, portMAX_DELAY);
|
||||
}
|
||||
|
||||
wpa_printf(MSG_DEBUG, "wps scan_done discover_ssid_cnt = %d", sm->discover_ssid_cnt);
|
||||
|
||||
@@ -96,23 +96,11 @@ static int wps_validate_response_type(const u8 *response_type, int mandatory)
|
||||
static int valid_config_methods(u16 val, int wps2)
|
||||
{
|
||||
if (wps2) {
|
||||
if ((val & 0x6000) && !(val & WPS_CONFIG_DISPLAY)) {
|
||||
wpa_printf(MSG_INFO, "WPS-STRICT: Physical/Virtual "
|
||||
"Display flag without old Display flag "
|
||||
"set");
|
||||
return 0;
|
||||
}
|
||||
if (!(val & 0x6000) && (val & WPS_CONFIG_DISPLAY)) {
|
||||
wpa_printf(MSG_INFO, "WPS-STRICT: Display flag "
|
||||
"without Physical/Virtual Display flag");
|
||||
return 0;
|
||||
}
|
||||
if ((val & 0x0600) && !(val & WPS_CONFIG_PUSHBUTTON)) {
|
||||
wpa_printf(MSG_INFO, "WPS-STRICT: Physical/Virtual "
|
||||
"PushButton flag without old PushButton "
|
||||
"flag set");
|
||||
return 0;
|
||||
}
|
||||
if (!(val & 0x0600) && (val & WPS_CONFIG_PUSHBUTTON)) {
|
||||
wpa_printf(MSG_INFO, "WPS-STRICT: PushButton flag "
|
||||
"without Physical/Virtual PushButton flag");
|
||||
|
||||
Reference in New Issue
Block a user