Просмотр исходного кода

Merge branch 'feature/configurable_wpa2_ent' into 'master'

esp_wifi: Make enterprise support configurable to save binary size.

Closes WIFI-3597

See merge request espressif/esp-idf!24345
Jiang Jiang Jian 2 лет назад
Родитель
Сommit
5933779f2d

+ 9 - 0
components/esp_wifi/Kconfig

@@ -572,4 +572,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

+ 2 - 0
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();
     }

+ 4 - 0
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)

+ 4 - 0
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)) {

+ 1 - 0
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