SAE: Use wpa_key_mgmt_sae() helper

Use the existing helper function instead of maintaining multiple copies
of lists of SAE key management suites.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-07-24 18:43:21 +03:00 committed by Jouni Malinen
parent 5456b0f260
commit 5c8a714b18
3 changed files with 7 additions and 11 deletions

View file

@ -4834,8 +4834,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
#endif /* CONFIG_IEEE80211AX */
#ifdef CONFIG_SAE
if (((params->key_mgmt_suites & WPA_KEY_MGMT_SAE) ||
(params->key_mgmt_suites & WPA_KEY_MGMT_FT_SAE)) &&
if (wpa_key_mgmt_sae(params->key_mgmt_suites) &&
nl80211_put_sae_pwe(msg, params->sae_pwe) < 0)
goto fail;
#endif /* CONFIG_SAE */
@ -6389,8 +6388,7 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
nl80211_put_fils_connect_params(drv, params, msg) != 0)
return -1;
if ((params->key_mgmt_suite == WPA_KEY_MGMT_SAE ||
params->key_mgmt_suite == WPA_KEY_MGMT_FT_SAE) &&
if (wpa_key_mgmt_sae(params->key_mgmt_suite) &&
(!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) &&
nla_put_flag(msg, NL80211_ATTR_EXTERNAL_AUTH_SUPPORT))
return -1;
@ -6440,8 +6438,7 @@ static int wpa_driver_nl80211_try_connect(
goto fail;
#ifdef CONFIG_SAE
if ((params->key_mgmt_suite == WPA_KEY_MGMT_SAE ||
params->key_mgmt_suite == WPA_KEY_MGMT_FT_SAE) &&
if (wpa_key_mgmt_sae(params->key_mgmt_suite) &&
nl80211_put_sae_pwe(msg, params->sae_pwe) < 0)
goto fail;
#endif /* CONFIG_SAE */
@ -6549,8 +6546,7 @@ static int wpa_driver_nl80211_associate(
if (wpa_driver_nl80211_set_mode(priv, nlmode) < 0)
return -1;
if (params->key_mgmt_suite == WPA_KEY_MGMT_SAE ||
params->key_mgmt_suite == WPA_KEY_MGMT_FT_SAE)
if (wpa_key_mgmt_sae(params->key_mgmt_suite))
bss->use_nl_connect = 1;
else
bss->use_nl_connect = 0;

View file

@ -3089,7 +3089,7 @@ static u8 * wpas_populate_assoc_ies(
#endif /* CONFIG_FILS */
#endif /* IEEE8021X_EAPOL */
#ifdef CONFIG_SAE
if (wpa_s->key_mgmt & (WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE))
if (wpa_key_mgmt_sae(wpa_s->key_mgmt))
algs = WPA_AUTH_ALG_SAE;
#endif /* CONFIG_SAE */

View file

@ -1312,7 +1312,7 @@ static void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
#ifdef CONFIG_SAE
if ((bitmap & TRANSITION_DISABLE_WPA3_PERSONAL) &&
wpa_key_mgmt_sae(wpa_s->key_mgmt) &&
(ssid->key_mgmt & (WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE)) &&
wpa_key_mgmt_sae(ssid->key_mgmt) &&
(ssid->ieee80211w != MGMT_FRAME_PROTECTION_REQUIRED ||
(ssid->group_cipher & WPA_CIPHER_TKIP))) {
wpa_printf(MSG_DEBUG,
@ -1327,7 +1327,7 @@ static void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
wpa_s->sme.sae.state == SAE_ACCEPTED &&
wpa_s->sme.sae.pk &&
#endif /* CONFIG_SME */
(ssid->key_mgmt & (WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE)) &&
wpa_key_mgmt_sae(ssid->key_mgmt) &&
(ssid->sae_pk != SAE_PK_MODE_ONLY ||
ssid->ieee80211w != MGMT_FRAME_PROTECTION_REQUIRED ||
(ssid->group_cipher & WPA_CIPHER_TKIP))) {