From 874830c52a42d3c8450f6f114dcf80529b7f65b2 Mon Sep 17 00:00:00 2001 From: poyamini <108741504+poyamini@users.noreply.github.com> Date: Wed, 21 Jun 2023 10:53:45 +0530 Subject: [PATCH] [Silabs] Adds support for WPA3 transition mode for 917/916 NCP (#27334) * WPA3 transition support * WPA3 transition mode support * wpa3 transition name changes * Restyled by clang-format * adding the wpa3 transition support for 917 ncp * Restyled by whitespace * Restyled by clang-format * wpa3 transition name changes * wpa3 transition personal * removing wpa3 transition personal * changing comments --------- Co-authored-by: Restyled.io --- examples/platform/silabs/SiWx917/BUILD.gn | 6 ++--- .../platform/silabs/SiWx917/SiWx917/rsi_if.c | 18 ++++++++----- examples/platform/silabs/efr32/BUILD.gn | 7 +++--- .../platform/silabs/efr32/rs911x/rsi_if.c | 25 +++++++++++-------- .../silabs/efr32/rs911x/rsi_wlan_config.h | 18 ++++++------- scripts/examples/gn_silabs_example.sh | 4 +-- .../silabs/efr32/wifi/wfx_host_events.h | 2 +- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index beefb835d64172..2d8ec861663b3a 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -33,7 +33,7 @@ declare_args() { sl_wfx_config_scan = true # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_only = false + rs91x_wpa3_transition = false # use commissionable data for SiWx917 siwx917_commissionable_data = false @@ -219,8 +219,8 @@ config("silabs-wifi-config") { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] } - if (rs91x_wpa3_only) { - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + if (rs91x_wpa3_transition) { + defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] } } diff --git a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c index 9dc57d81636733..6f9afa54e23f8b 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c @@ -355,11 +355,11 @@ static void wfx_rsi_save_ap_info() /* * Scan is done - failed */ -#if WIFI_ENABLE_SECURITY_WPA3 +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION wfx_rsi.sec.security = WFX_SEC_WPA3; -#else /* !WIFI_ENABLE_SECURITY_WPA3 */ +#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ wfx_rsi.sec.security = WFX_SEC_WPA2; -#endif /* WIFI_ENABLE_SECURITY_WPA3 */ +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ SILABS_LOG("%s: warn: failed with status: %02x", __func__, status); return; } @@ -386,9 +386,13 @@ static void wfx_rsi_save_ap_info() case SME_WEP: wfx_rsi.sec.security = WFX_SEC_WEP; break; - case SME_WPA3: case SME_WPA3_TRANSITION: - wfx_rsi.sec.security = WFX_SEC_WPA3; +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION + case SME_WPA3: + wfx_rsi.sec.security = RSI_WPA3; +#else + wfx_rsi.sec.security = WFX_SEC_WPA2; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ break; default: wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; @@ -425,9 +429,11 @@ static void wfx_rsi_do_join(void) case WFX_SEC_WPA2: connect_security_mode = RSI_WPA_WPA2_MIXED; break; +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION case WFX_SEC_WPA3: - connect_security_mode = RSI_WPA3; + connect_security_mode = RSI_WPA3_TRANSITION; break; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANS */ case WFX_SEC_NONE: connect_security_mode = RSI_OPEN; break; diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 860800e7fb8d68..4a7119dbc5398b 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -31,7 +31,7 @@ declare_args() { sl_wfx_config_scan = true # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_only = false + rs91x_wpa3_transition = false #default WiFi SSID chip_default_wifi_ssid = "" @@ -254,10 +254,9 @@ config("silabs-wifi-config") { if (chip_enable_wifi_ipv4) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] } - - if (rs91x_wpa3_only) { + if (rs91x_wpa3_transition) { # TODO: Change this macro once WF200 support is provided - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] } } diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index f29cf010a79e73..d0d5844448d618 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -420,20 +420,17 @@ static void wfx_rsi_save_ap_info() // translation /* * Scan is done - failed */ -#if WIFI_ENABLE_SECURITY_WPA3 +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION wfx_rsi.sec.security = WFX_SEC_WPA3; -#else /* !WIFI_ENABLE_SECURITY_WPA3 */ +#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ wfx_rsi.sec.security = WFX_SEC_WPA2; -#endif /* WIFI_ENABLE_SECURITY_WPA3 */ +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ SILABS_LOG("%s: warn: failed with status: %02x", __func__, status); return; } - else - { - wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; - wfx_rsi.ap_chan = rsp.scan_info->rf_channel; - memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_MAX_STR_LEN); - } + wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; + wfx_rsi.ap_chan = rsp.scan_info->rf_channel; + memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_MAX_STR_LEN); switch (rsp.scan_info->security_mode) { @@ -451,9 +448,13 @@ static void wfx_rsi_save_ap_info() // translation case SME_WEP: wfx_rsi.sec.security = WFX_SEC_WEP; break; - case SME_WPA3: case SME_WPA3_TRANSITION: +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION + case SME_WPA3: wfx_rsi.sec.security = WFX_SEC_WPA3; +#else + wfx_rsi.sec.security = WFX_SEC_WPA2; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ break; default: wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; @@ -492,9 +493,11 @@ static void wfx_rsi_do_join(void) case WFX_SEC_WPA2: connect_security_mode = RSI_WPA_WPA2_MIXED; break; +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION case WFX_SEC_WPA3: - connect_security_mode = RSI_WPA3; + connect_security_mode = RSI_WPA3_TRANSITION; break; +#endif // WIFI_ENABLE_SECURITY_WPA3_TRANSITION case WFX_SEC_NONE: connect_security_mode = RSI_OPEN; break; diff --git a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h index 9fb927adc5631e..96bd71bb80539a 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h +++ b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h @@ -41,20 +41,20 @@ #define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_BYPASS /*| TCP_IP_FEAT_EXTENSION_VALID*/) //! To set Extended custom feature select bit map -#if WIFI_ENABLE_SECURITY_WPA3 +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION #ifdef CHIP_9117 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (EXT_FEAT_448K_M4SS_256K | EXT_FEAT_IEEE_80211W | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE) -#else + (EXT_FEAT_448K_M4SS_256K | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE | EXT_FEAT_IEEE_80211W) +#else /* !CHIP_9117 */ #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (EXT_FEAT_384K_MODE | EXT_FEAT_IEEE_80211W) #endif /* CHIP_9117 */ -#else +#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ #ifdef CHIP_9117 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (EXT_FEAT_448K_M4SS_256K | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE) -#else +#else /* !CHIP_9117 */ #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP EXT_FEAT_384K_MODE #endif /* CHIP_9117 */ -#endif /* WIFI_ENABLE_SECURITY_WPA3 */ +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ //! To set Extended TCPIP feature select bit map #define RSI_EXT_TCPIP_FEATURE_BITMAP (/*EXT_FEAT_HTTP_OTAF_SUPPORT |*/ EXT_TCP_IP_SSL_16K_RECORD) @@ -242,11 +242,11 @@ #define RSI_POWER_LEVEL RSI_POWER_LEVEL_HIGH //! RSI_JOIN_FEAT_STA_BG_ONLY_MODE_ENABLE or RSI_JOIN_FEAT_LISTEN_INTERVAL_VALID -#if WIFI_ENABLE_SECURITY_WPA3 -#define RSI_JOIN_FEAT_BIT_MAP RSI_JOIN_FEAT_MFP_CAPABLE_REQUIRED +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION +#define RSI_JOIN_FEAT_BIT_MAP RSI_JOIN_FEAT_MFP_CAPABLE_ONLY #else #define RSI_JOIN_FEAT_BIT_MAP 0 -#endif +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANS */ #define RSI_LISTEN_INTERVAL 0 diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index 25d181efe26a7d..06f6ee57599c23 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -96,8 +96,8 @@ if [ "$#" == "0" ]; then Use to build the example with pigweed RPC ota_periodic_query_timeout_sec Periodic query timeout variable for OTA in seconds - rs91x_wpa3_only - Support for WPA3 only mode on RS91x + rs91x_wpa3_transition + Support for WPA3 transition mode on RS91x sl_matter_version Use provided software version at build time sl_matter_version_str diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index c0724b7237e808..3c9d12be5dff6e 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -239,7 +239,7 @@ typedef enum WFX_SEC_WEP = 2, WFX_SEC_WPA = 3, WFX_SEC_WPA2 = 4, - WFX_SEC_WPA3 = 5 + WFX_SEC_WPA3 = 5, } wfx_sec_t; typedef struct