diff --git a/cpu/esp32/doc.txt b/cpu/esp32/doc.txt index 55b3280935..e5f8b31fae 100644 --- a/cpu/esp32/doc.txt +++ b/cpu/esp32/doc.txt @@ -1612,16 +1612,16 @@ following configuration parameters have to be defined: Parameter | Default | Description :-------------------|:----------|:------------ -#WIFI_SSID | "RIOT_AP" | SSID of the AP to be used. -ESP_WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication.[1] -ESP_WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication. -ESP_WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication. +#WIFI_SSID | "RIOT_AP" | SSID of the AP to be used. +WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication.[1] +WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication. +WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication. #ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
-[1] If the optional anonymous identy `ESP_WIFI_EAP_ID` is not defined, the user -name `ESP_WIFI_EAP_USER` defined for phase 2 (inner) EAP authentication is used +[1] If the optional anonymous identy `WIFI_EAP_ID` is not defined, the user +name `WIFI_EAP_USER` defined for phase 2 (inner) EAP authentication is used as identity in phase 1. These configuration parameter definitions, as well as enabling the `esp_wifi` @@ -1630,7 +1630,7 @@ line, for example: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USEMODULE=esp_wifi_enterprise \ -CFLAGS='-DWIFI_SSID=\"MySSID\" -DESP_WIFI_EAP_ID=\"anonymous\" -DESP_WIFI_EAP_USER=\"MyUserName\" -DESP_WIFI_EAP_PASS=\"MyPassphrase\"' \ +CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_EAP_ID=\"anonymous\" -DWIFI_EAP_USER=\"MyUserName\" -DWIFI_EAP_PASS=\"MyPassphrase\"' \ make -C examples/gnrc_networking BOARD=... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/cpu/esp_common/esp-wifi/doc.txt b/cpu/esp_common/esp-wifi/doc.txt index 7c877a11f7..16eba4936d 100644 --- a/cpu/esp_common/esp-wifi/doc.txt +++ b/cpu/esp_common/esp-wifi/doc.txt @@ -87,10 +87,10 @@ following configuration parameters have to be defined: Parameter | Default | Description :------------------|:----------|:------------ -WIFI_SSID | "RIOT_AP" | SSID of the AP to be used. -ESP_WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication. If it is not defined, the user name defined for phase 2 (inner) EAP authentication is used as idendity in phase 1. -ESP_WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication. -ESP_WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication. +WIFI_SSID | "RIOT_AP" | SSID of the AP to be used. +WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication. If it is not defined, the user name defined for phase 2 (inner) EAP authentication is used as idendity in phase 1. +WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication. +WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication. ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread. @@ -101,7 +101,7 @@ line, for example: ``` USEMODULE=esp_wifi_enterprise \ -CFLAGS='-DWIFI_SSID=\"MySSID\" -DESP_WIFI_EAP_ID=\"anonymous\" -DESP_WIFI_EAP_USER=\"MyUserName\" -DESP_WIFI_EAP_PASS=\"MyPassphrase\"' \ +CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_EAP_ID=\"anonymous\" -DWIFI_EAP_USER=\"MyUserName\" -DWIFI_EAP_PASS=\"MyPassphrase\"' \ make -C examples/gnrc_networking BOARD=... ``` diff --git a/cpu/esp_common/esp-wifi/esp_wifi_netdev.c b/cpu/esp_common/esp-wifi/esp_wifi_netdev.c index 31c3f93604..c32a828390 100644 --- a/cpu/esp_common/esp-wifi/esp_wifi_netdev.c +++ b/cpu/esp_common/esp-wifi/esp_wifi_netdev.c @@ -947,20 +947,32 @@ void esp_wifi_setup (esp_wifi_netdev_t* dev) #if defined(MODULE_ESP_WIFI_ENTERPRISE) && !defined(MODULE_ESP_WIFI_AP) -#ifdef ESP_WIFI_EAP_ID - esp_wifi_sta_wpa2_ent_set_identity((const unsigned char *)ESP_WIFI_EAP_ID, - strlen(ESP_WIFI_EAP_ID)); -#endif /* ESP_WIFI_EAP_ID */ -#if defined(ESP_WIFI_EAP_USER) && defined(ESP_WIFI_EAP_PASS) +#if !defined(WIFI_EAP_ID) && defined(ESP_WIFI_EAP_ID) +#define WIFI_EAP_ID ESP_WIFI_EAP_ID +#endif + +#if !defined(WIFI_EAP_USER) && defined(ESP_WIFI_EAP_USER) +#define WIFI_EAP_USER ESP_WIFI_EAP_USER +#endif + +#if !defined(WIFI_EAP_PASS) && defined(ESP_WIFI_EAP_PASS) +#define WIFI_EAP_PASS ESP_WIFI_EAP_PASS +#endif + +#ifdef WIFI_EAP_ID + esp_wifi_sta_wpa2_ent_set_identity((const unsigned char *)WIFI_EAP_ID, + strlen(WIFI_EAP_ID)); +#endif /* WIFI_EAP_ID */ +#if defined(WIFI_EAP_USER) && defined(WIFI_EAP_PASS) ESP_WIFI_DEBUG("eap_user=%s eap_pass=%s\n", - ESP_WIFI_EAP_USER, ESP_WIFI_EAP_PASS); - esp_wifi_sta_wpa2_ent_set_username((const unsigned char *)ESP_WIFI_EAP_USER, - strlen(ESP_WIFI_EAP_USER)); - esp_wifi_sta_wpa2_ent_set_password((const unsigned char *)ESP_WIFI_EAP_PASS, - strlen(ESP_WIFI_EAP_PASS)); -#else /* defined(ESP_WIFI_EAP_USER) && defined(ESP_WIFI_EAP_PASS) */ -#error "ESP_WIFI_EAP_USER and ESP_WIFI_EAP_PASS have to be defined for EAP phase 2 authentication" -#endif /* defined(ESP_WIFI_EAP_USER) && defined(ESP_WIFI_EAP_PASS) */ + WIFI_EAP_USER, WIFI_EAP_PASS); + esp_wifi_sta_wpa2_ent_set_username((const unsigned char *)WIFI_EAP_USER, + strlen(WIFI_EAP_USER)); + esp_wifi_sta_wpa2_ent_set_password((const unsigned char *)WIFI_EAP_PASS, + strlen(WIFI_EAP_PASS)); +#else /* defined(WIFI_EAP_USER) && defined(WIFI_EAP_PASS) */ +#error "WIFI_EAP_USER and WIFI_EAP_PASS have to be defined for EAP phase 2 authentication" +#endif /* defined(WIFI_EAP_USER) && defined(WIFI_EAP_PASS) */ esp_wifi_sta_wpa2_ent_enable(); #endif /* defined(MODULE_ESP_WIFI_ENTERPRISE) && !defined(MODULE_ESP_WIFI_AP) */ diff --git a/tests/external_board_dirs/esp-ci-boards/esp32-ci/Makefile.include b/tests/external_board_dirs/esp-ci-boards/esp32-ci/Makefile.include index b4fdf5447b..7095c81c02 100644 --- a/tests/external_board_dirs/esp-ci-boards/esp32-ci/Makefile.include +++ b/tests/external_board_dirs/esp-ci-boards/esp32-ci/Makefile.include @@ -2,9 +2,9 @@ # to also include the main board header INCLUDES += $(addprefix -I,$(wildcard $(RIOTBOARD)/esp32-wrover-kit/include)) -# ESP_WIFI_EAP_USER and ESP_WIFI_EAP_PASS have to be defined to compile the +# WIFI_EAP_USER and WIFI_EAP_PASS have to be defined to compile the # optional module esp_wifi_enterprise in CI -CFLAGS += -DESP_WIFI_EAP_USER=\"riot@riot-os.org\" -CFLAGS += -DESP_WIFI_EAP_PASS=\"riot\" +CFLAGS += -DWIFI_EAP_USER=\"riot@riot-os.org\" +CFLAGS += -DWIFI_EAP_PASS=\"riot\" include $(RIOTBOARD)/esp32-wrover-kit/Makefile.include diff --git a/tests/external_board_dirs/esp-ci-boards/esp32c3-ci/Makefile.include b/tests/external_board_dirs/esp-ci-boards/esp32c3-ci/Makefile.include index c36113cd4a..6405cc20dc 100644 --- a/tests/external_board_dirs/esp-ci-boards/esp32c3-ci/Makefile.include +++ b/tests/external_board_dirs/esp-ci-boards/esp32c3-ci/Makefile.include @@ -2,9 +2,9 @@ # to also include the main board header INCLUDES += $(addprefix -I,$(wildcard $(RIOTBOARD)/esp32c3-devkit/include)) -# ESP_WIFI_EAP_USER and ESP_WIFI_EAP_PASS have to be defined to compile the +# WIFI_EAP_USER and WIFI_EAP_PASS have to be defined to compile the # optional module esp_wifi_enterprise in CI -CFLAGS += -DESP_WIFI_EAP_USER=\"riot@riot-os.org\" -CFLAGS += -DESP_WIFI_EAP_PASS=\"riot\" +CFLAGS += -DWIFI_EAP_USER=\"riot@riot-os.org\" +CFLAGS += -DWIFI_EAP_PASS=\"riot\" include $(RIOTBOARD)/esp32c3-devkit/Makefile.include diff --git a/tests/external_board_dirs/esp-ci-boards/esp32s2-ci/Makefile.include b/tests/external_board_dirs/esp-ci-boards/esp32s2-ci/Makefile.include index 8ef626680a..07302d8382 100644 --- a/tests/external_board_dirs/esp-ci-boards/esp32s2-ci/Makefile.include +++ b/tests/external_board_dirs/esp-ci-boards/esp32s2-ci/Makefile.include @@ -2,9 +2,9 @@ # to also include the main board header INCLUDES += $(addprefix -I,$(wildcard $(RIOTBOARD)/esp32s2-devkit/include)) -# ESP_WIFI_EAP_USER and ESP_WIFI_EAP_PASS have to be defined to compile the +# WIFI_EAP_USER and WIFI_EAP_PASS have to be defined to compile the # optional module esp_wifi_enterprise in CI -CFLAGS += -DESP_WIFI_EAP_USER=\"riot@riot-os.org\" -CFLAGS += -DESP_WIFI_EAP_PASS=\"riot\" +CFLAGS += -DWIFI_EAP_USER=\"riot@riot-os.org\" +CFLAGS += -DWIFI_EAP_PASS=\"riot\" include $(RIOTBOARD)/esp32s2-devkit/Makefile.include diff --git a/tests/external_board_dirs/esp-ci-boards/esp32s3-ci/Makefile.include b/tests/external_board_dirs/esp-ci-boards/esp32s3-ci/Makefile.include index 78a8c61812..857c21f03b 100644 --- a/tests/external_board_dirs/esp-ci-boards/esp32s3-ci/Makefile.include +++ b/tests/external_board_dirs/esp-ci-boards/esp32s3-ci/Makefile.include @@ -2,9 +2,9 @@ # to also include the main board header INCLUDES += $(addprefix -I,$(wildcard $(RIOTBOARD)/esp32s3-devkit/include)) -# ESP_WIFI_EAP_USER and ESP_WIFI_EAP_PASS have to be defined to compile the +# WIFI_EAP_USER and WIFI_EAP_PASS have to be defined to compile the # optional module esp_wifi_enterprise in CI -CFLAGS += -DESP_WIFI_EAP_USER=\"riot@riot-os.org\" -CFLAGS += -DESP_WIFI_EAP_PASS=\"riot\" +CFLAGS += -DWIFI_EAP_USER=\"riot@riot-os.org\" +CFLAGS += -DWIFI_EAP_PASS=\"riot\" include $(RIOTBOARD)/esp32s3-devkit/Makefile.include