Skip to content

Commit

Permalink
esp_wifi: WPA3 SAE keep default value as h2e and hunting and pecking …
Browse files Browse the repository at this point in the history
…for sae pwe
  • Loading branch information
Shreyas0-7 committed Jul 22, 2022
1 parent 0e87481 commit 341a92a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
12 changes: 10 additions & 2 deletions components/esp_wifi/include/esp_wifi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ typedef struct {
bool required; /**< Advertizes that Protected Management Frame is required. Device will not associate to non-PMF capable devices. */
} wifi_pmf_config_t;

/** Configuration for SAE PWE derivation */
typedef enum {
WPA3_SAE_PWE_UNSPECIFIED,
WPA3_SAE_PWE_HUNT_AND_PECK,
WPA3_SAE_PWE_HASH_TO_ELEMENT,
WPA3_SAE_PWE_BOTH,
} wifi_sae_pwe_method_t;

/** @brief Soft-AP configuration settings for the ESP32 */
typedef struct {
uint8_t ssid[32]; /**< SSID of ESP32 soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
Expand Down Expand Up @@ -254,8 +262,8 @@ typedef struct {
uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection */
uint32_t ft_enabled:1; /**< Whether FT is enabled for the connection */
uint32_t owe_enabled:1; /**< Whether OWE is enabled for the connection */
uint32_t sae_pwe_h2e:2; /**< Whether SAE hash to element is enabled */
uint32_t reserved:25; /**< Reserved for future feature set */
uint32_t reserved:27; /**< Reserved for future feature set */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Whether SAE hash to element is enabled */
} wifi_sta_config_t;

/** @brief Configuration data for ESP32 AP or STA.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ esp_err_t esp_wifi_remain_on_channel(uint8_t ifx, uint8_t type, uint8_t channel,
bool esp_wifi_is_mbo_enabled_internal(uint8_t if_index);
void esp_wifi_get_pmf_config_internal(wifi_pmf_config_t *pmf_cfg, uint8_t ifx);
bool esp_wifi_is_ft_enabled_internal(uint8_t if_index);
uint8_t esp_wifi_get_config_sae_pwe_h2e_internal(void);
uint8_t esp_wifi_get_use_h2e_internal(void);
uint8_t esp_wifi_sta_get_config_sae_pwe_h2e_internal(void);
uint8_t esp_wifi_sta_get_use_h2e_internal(void);

#endif /* _ESP_WIFI_DRIVER_H_ */
2 changes: 1 addition & 1 deletion components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static esp_err_t wpa3_build_sae_commit(u8 *bssid)
u8 own_addr[ETH_ALEN];
const u8 *pw = (const u8 *)esp_wifi_sta_get_prof_password_internal();
struct wifi_ssid *ssid = esp_wifi_sta_get_prof_ssid_internal();
uint8_t use_pt = esp_wifi_get_use_h2e_internal();
uint8_t use_pt = esp_wifi_sta_get_use_h2e_internal();

if (use_pt && !g_sae_pt) {
g_sae_pt = sae_derive_pt(g_allowed_groups, ssid->ssid, ssid->len, pw, strlen((const char *)pw), NULL);
Expand Down
2 changes: 1 addition & 1 deletion components/wpa_supplicant/src/common/wpa_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ int wpa_parse_wpa_ie_rsnxe(const u8 *rsnxe_ie, size_t rsnxe_ie_len,
struct wpa_ie_data *data)
{
uint8_t rsnxe_capa = 0;
uint8_t sae_pwe = esp_wifi_get_config_sae_pwe_h2e_internal();
uint8_t sae_pwe = esp_wifi_sta_get_config_sae_pwe_h2e_internal();
memset(data, 0, sizeof(*data));

if (rsnxe_ie_len < 1) {
Expand Down
2 changes: 1 addition & 1 deletion components/wpa_supplicant/src/rsn_supp/wpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,7 @@ int wpa_sm_set_ap_rsnxe(const u8 *ie, size_t len)
sm->ap_rsnxe_len = len;
}

sm->sae_pwe = esp_wifi_get_config_sae_pwe_h2e_internal();
sm->sae_pwe = esp_wifi_sta_get_config_sae_pwe_h2e_internal();
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void wifi_init_sta(void)
* However these modes are deprecated and not advisable to be used. Incase your Access point
* doesn't support WPA2, these mode can be enabled by commenting below line */
.threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD,
.sae_pwe_h2e = 2,
.sae_pwe_h2e = WPA3_SAE_PWE_BOTH,
},
};
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
Expand Down

0 comments on commit 341a92a

Please sign in to comment.