esp_wifi/supplicant: fix some supplicant bugs

Closes IDFGH-1455
Closes IDF-774
This commit is contained in:
liu zhifu 2019-07-08 16:23:33 +08:00
parent f27527dd78
commit f3f08fa713
8 changed files with 11 additions and 53 deletions

@ -1 +1 @@
Subproject commit 7c7c2e3f978ddaeadb1365a0f8fbbcb423886d97
Subproject commit e214daa325ede0981d0bd380306d4edd5a9fcc80

View File

@ -1,32 +1,5 @@
menu "Supplicant"
config WPA_ENTERPRISE
bool "Enable WPA/WPA2-Enterprise"
default n
help
Select this option to enable WiFi WPA/WPA2-Enterprise authentication.
config WPA_EAP_TLS
bool "Enable EAP-TLS"
depends on WPA_ENTERPRISE
default y
help
Select this option to support EAP-TLS.
config WPA_EAP_TTLS
bool "Enable EAP-TTLS"
depends on WPA_ENTERPRISE
default y
help
Select this option to support EAP-TTLS.
config WPA_EAP_PEAP
bool "Enable EAP-PEAP"
depends on WPA_ENTERPRISE
default y
help
Select this option to support EAP-PEAP.
config WPA_MBEDTLS_CRYPTO
bool "Use MbedTLS crypto API's"
default y

View File

@ -2,4 +2,4 @@ COMPONENT_ADD_INCLUDEDIRS := include port/include include/esp_supplicant
COMPONENT_PRIV_INCLUDEDIRS := src
COMPONENT_SRCDIRS := port src/ap src/common src/crypto src/eap_peer src/rsn_supp src/tls src/utils src/esp_supplicant src/wps
CFLAGS += -DESP_SUPPLICANT -DIEEE8021X_EAPOL -DEAP_PEER_METHOD -DEAP_MSCHAPv2 -DUSE_WPA2_TASK -DCONFIG_WPS2 -DCONFIG_WPS_PIN -DUSE_WPS_TASK -DESPRESSIF_USE -DESP32_WORKAROUND -DCONFIG_ECC -D__ets__ -Wno-strict-aliasing
CFLAGS += -DESP_SUPPLICANT -DIEEE8021X_EAPOL -DEAP_PEER_METHOD -DEAP_TLS -DEAP_TTLS -DEAP_PEAP -DEAP_MSCHAPv2 -DUSE_WPA2_TASK -DCONFIG_WPS2 -DCONFIG_WPS_PIN -DUSE_WPS_TASK -DESPRESSIF_USE -DESP32_WORKAROUND -DCONFIG_ECC -D__ets__ -Wno-strict-aliasing

View File

@ -17,18 +17,6 @@
#include "sdkconfig.h"
#if CONFIG_WPA_EAP_TLS
#define EAP_TLS 1
#endif
#if CONFIG_WPA_EAP_TTLS
#define EAP_TTLS 1
#endif
#if CONFIG_WPA_EAP_PEAP
#define EAP_PEAP 1
#endif
#if CONFIG_WPA_MBEDTLS_CRYPTO
#define USE_MBEDTLS_CRYPTO 1
#endif

View File

@ -168,7 +168,6 @@ struct wifi_ssid *esp_wifi_ap_get_prof_ap_ssid_internal(void);
uint8_t esp_wifi_ap_get_prof_authmode_internal(void);
uint8_t esp_wifi_sta_get_prof_authmode_internal(void);
uint8_t *esp_wifi_ap_get_prof_password_internal(void);
uint8_t *esp_wifi_sta_get_prof_pmk_internal(void);
struct wifi_ssid *esp_wifi_sta_get_prof_ssid_internal(void);
uint8_t esp_wifi_sta_get_reset_param_internal(void);
uint8_t esp_wifi_sta_get_pairwise_cipher_internal(void);
@ -216,5 +215,8 @@ 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);
esp_err_t esp_wifi_set_wps_start_flag_internal(bool start);
#endif /* _ESP_WIFI_DRIVER_H_ */

View File

@ -808,8 +808,6 @@ static void eap_peer_sm_deinit(void)
gEapSm = NULL;
}
uint8_t wpa2_machine_start = 0;
esp_err_t esp_wifi_sta_wpa2_ent_enable_fn(void *arg)
{
struct wpa2_funcs *wpa2_cb;
@ -837,7 +835,6 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable_fn(void *arg)
wpa_printf(MSG_ERROR, "Register EAP Peer methods Failure\n");
}
#endif
wpa2_machine_start = 1;
return ESP_OK;
}
@ -886,7 +883,6 @@ esp_err_t esp_wifi_sta_wpa2_ent_disable_fn(void *param)
eap_peer_unregister_methods();
#endif
wpa2_machine_start = 0;
return ESP_OK;
}

View File

@ -1831,7 +1831,6 @@ void wifi_wps_scan(void)
#endif
}
uint8_t wps_start = 0;
int wifi_station_wps_start(void)
{
struct wps_sm *sm = wps_sm_get();
@ -1862,8 +1861,7 @@ int wifi_station_wps_start(void)
default:
break;
}
wps_start = 1;
esp_wifi_set_wps_start_flag_internal(true);
return ESP_OK;
}
@ -2125,7 +2123,7 @@ int esp_wifi_wps_disable(void)
}
esp_wifi_disconnect();
wps_start = 0;
esp_wifi_set_wps_start_flag_internal(false);
wps_task_deinit();
s_wps_enabled = false;
API_MUTEX_GIVE();

View File

@ -1778,18 +1778,19 @@ wpa_set_passphrase(char * passphrase, u8 *ssid, size_t ssid_len)
if (esp_wifi_sta_get_reset_param_internal() != 0) {
// check it's psk
if (strlen((char *)esp_wifi_sta_get_prof_password_internal()) == 64) {
hexstr2bin((char *)esp_wifi_sta_get_prof_password_internal(), esp_wifi_sta_get_prof_pmk_internal(), PMK_LEN);
hexstr2bin((char *)esp_wifi_sta_get_prof_password_internal(), esp_wifi_sta_get_ap_info_prof_pmk_internal(), PMK_LEN);
} else {
pbkdf2_sha1((char *)esp_wifi_sta_get_prof_password_internal(), (char *)sta_ssid->ssid, (size_t)sta_ssid->len,
4096, esp_wifi_sta_get_prof_pmk_internal(), PMK_LEN);
4096, esp_wifi_sta_get_ap_info_prof_pmk_internal(), PMK_LEN);
}
esp_wifi_sta_update_ap_info_internal();
esp_wifi_sta_set_reset_param_internal(0);
}
if (sm->key_mgmt == WPA_KEY_MGMT_IEEE8021X) {
/* TODO nothing */
} else {
memcpy(sm->pmk, esp_wifi_sta_get_prof_pmk_internal(), PMK_LEN);
memcpy(sm->pmk, esp_wifi_sta_get_ap_info_prof_pmk_internal(), PMK_LEN);
}
sm->pmk_len = PMK_LEN;
}