diff --git a/components/esp_wifi/Kconfig b/components/esp_wifi/Kconfig index bc42da9f2d..4512074464 100644 --- a/components/esp_wifi/Kconfig +++ b/components/esp_wifi/Kconfig @@ -563,4 +563,13 @@ menu "Wi-Fi" help Select this to enable unity test for DPP. + config ESP_WIFI_ENTERPRISE_SUPPORT + bool "Enable enterprise option" + default y + help + Select this to enable/disable enterprise connection support. + + disabling this will reduce binary size. + disabling this will disable the use of any esp_wifi_sta_wpa2_ent_* (as APIs will be meaningless) + endmenu # Wi-Fi diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c index 552bd0e145..ac378c2a9f 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c @@ -184,9 +184,11 @@ bool wpa_deattach(void) { struct wpa_sm *sm = &gWpaSm; esp_wpa3_free_sae_data(); +#ifdef CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT if (sm->wpa_sm_wpa2_ent_disable) { sm->wpa_sm_wpa2_ent_disable(); } +#endif if (sm->wpa_sm_wps_disable) { sm->wpa_sm_wps_disable(); } diff --git a/components/wpa_supplicant/src/common/defs.h b/components/wpa_supplicant/src/common/defs.h index 2524e5b361..6799370dec 100644 --- a/components/wpa_supplicant/src/common/defs.h +++ b/components/wpa_supplicant/src/common/defs.h @@ -51,6 +51,7 @@ typedef enum { FALSE = 0, TRUE = 1 } Boolean; static inline int wpa_key_mgmt_wpa_ieee8021x(int akm) { +#ifdef CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT return !!(akm & (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_CCKM | @@ -58,6 +59,9 @@ static inline int wpa_key_mgmt_wpa_ieee8021x(int akm) WPA_KEY_MGMT_IEEE8021X_SHA256 | WPA_KEY_MGMT_IEEE8021X_SUITE_B | WPA_KEY_MGMT_IEEE8021X_SUITE_B_192)); +#else + return 0; +#endif } static inline int wpa_key_mgmt_wpa_psk(int akm) diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index 43c1268e14..59c7cf717f 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -170,6 +170,7 @@ unsigned cipher_type_map_public_to_supp(wifi_cipher_type_t cipher) } } +#ifdef CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT static bool is_wpa2_enterprise_connection(void) { uint8_t authmode; @@ -185,6 +186,7 @@ static bool is_wpa2_enterprise_connection(void) return false; } +#endif /** * get_bssid - Get the current BSSID @@ -688,9 +690,11 @@ void wpa_supplicant_process_1_of_4(struct wpa_sm *sm, if (res) goto failed; +#ifdef CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT if (is_wpa2_enterprise_connection()) { pmksa_cache_set_current(sm, NULL, sm->bssid, 0, 0); } +#endif if (sm->renew_snonce) { if (os_get_random(sm->snonce, WPA_NONCE_LEN)) { diff --git a/docs/en/api-guides/performance/size.rst b/docs/en/api-guides/performance/size.rst index 06094b67f4..aea4f849f8 100644 --- a/docs/en/api-guides/performance/size.rst +++ b/docs/en/api-guides/performance/size.rst @@ -411,6 +411,7 @@ The following binary size optimizations apply to a particular component or a fun - Disabling :ref:`CONFIG_ESP_WIFI_ENABLE_WPA3_SAE` will save some Wi-Fi binary size if WPA3 support is not needed. Note that WPA3 is mandatory for new Wi-Fi device certifications. - Disabling :ref:`CONFIG_ESP_WIFI_SOFTAP_SUPPORT` will save some Wi-Fi binary size if soft-AP support is not needed. + - Disabling :ref:`CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT` will save some Wi-Fi binary size if enterprise support is not needed. .. only:: esp32