From fa3e878b8fe5a042ab369407b310d4a5e3c37973 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:43:56 +0100 Subject: [PATCH] rm WPA2 Enterprise AP connect support --- libraries/WiFi/src/WiFiSTA.cpp | 82 ---------------------------------- 1 file changed, 82 deletions(-) diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index 02e930943c3..0a6d13809a8 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -153,88 +153,6 @@ wl_status_t WiFiSTAClass::status() return (wl_status_t)xEventGroupClearBits(_sta_status_group, 0); } -/** - * Start Wifi connection with a WPA2 Enterprise AP - * if passphrase is set the most secure supported mode will be automatically selected - * @param ssid const char* Pointer to the SSID string. - * @param method wpa2_method_t The authentication method of WPA2 (WPA2_AUTH_TLS, WPA2_AUTH_PEAP, WPA2_AUTH_TTLS) - * @param wpa2_identity const char* Pointer to the entity - * @param wpa2_username const char* Pointer to the username - * @param password const char * Pointer to the password. - * @param ca_pem const char* Pointer to a string with the contents of a .pem file with CA cert - * @param client_crt const char* Pointer to a string with the contents of a .crt file with client cert - * @param client_key const char* Pointer to a string with the contants of a .key file with client key - * @param bssid uint8_t[6] Optional. BSSID / MAC of AP - * @param channel Optional. Channel of AP - * @param connect Optional. call connect - * @return - */ -wl_status_t WiFiSTAClass::begin(const char* wpa2_ssid, wpa2_auth_method_t method, const char* wpa2_identity, const char* wpa2_username, const char *wpa2_password, const char* ca_pem, const char* client_crt, const char* client_key, int32_t channel, const uint8_t* bssid, bool connect) -{ - if(!WiFi.enableSTA(true)) { - log_e("STA enable failed!"); - return WL_CONNECT_FAILED; - } - - if(!wpa2_ssid || *wpa2_ssid == 0x00 || strlen(wpa2_ssid) > 32) { - log_e("SSID too long or missing!"); - return WL_CONNECT_FAILED; - } - - if(wpa2_identity && strlen(wpa2_identity) > 64) { - log_e("identity too long!"); - return WL_CONNECT_FAILED; - } - - if(wpa2_username && strlen(wpa2_username) > 64) { - log_e("username too long!"); - return WL_CONNECT_FAILED; - } - - if(wpa2_password && strlen(wpa2_password) > 64) { - log_e("password too long!"); - } - - if(ca_pem) { -#if __has_include ("esp_eap_client.h") - esp_eap_client_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem)); -#else - esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem)); -#endif - } - - if(client_crt) { -#if __has_include ("esp_eap_client.h") - esp_eap_client_set_certificate_and_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0); -#else - esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0); -#endif - } - -#if __has_include ("esp_eap_client.h") - esp_eap_client_set_identity((uint8_t *)wpa2_identity, strlen(wpa2_identity)); -#else - esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)wpa2_identity, strlen(wpa2_identity)); -#endif - if(method == WPA2_AUTH_PEAP || method == WPA2_AUTH_TTLS) { -#if __has_include ("esp_eap_client.h") - esp_eap_client_set_username((uint8_t *)wpa2_username, strlen(wpa2_username)); - esp_eap_client_set_password((uint8_t *)wpa2_password, strlen(wpa2_password)); -#else - esp_wifi_sta_wpa2_ent_set_username((uint8_t *)wpa2_username, strlen(wpa2_username)); - esp_wifi_sta_wpa2_ent_set_password((uint8_t *)wpa2_password, strlen(wpa2_password)); -#endif - } -#if __has_include ("esp_eap_client.h") - esp_wifi_sta_enterprise_enable(); //set config settings to enable function -#else - esp_wifi_sta_wpa2_ent_enable(); //set config settings to enable function -#endif - WiFi.begin(wpa2_ssid); //connect to wifi - - return status(); -} - /** * Start Wifi connection * if passphrase is set the most secure supported mode will be automatically selected