libnm/utils: add SAE security type

https://github.com/NetworkManager/NetworkManager/pull/354
This commit is contained in:
Lubomir Rintel 2019-10-04 11:37:45 +02:00
parent 597e4b2d1e
commit 0ff1cb556c
2 changed files with 27 additions and 1 deletions

View file

@ -1119,6 +1119,7 @@ nm_utils_ap_mode_security_valid (NMUtilsSecurityType type,
case NMU_SEC_STATIC_WEP:
case NMU_SEC_WPA_PSK:
case NMU_SEC_WPA2_PSK:
case NMU_SEC_SAE:
return TRUE;
default:
break;
@ -1276,6 +1277,29 @@ nm_utils_security_valid (NMUtilsSecurityType type,
return FALSE;
}
break;
case NMU_SEC_SAE:
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_RSN))
return FALSE;
if (have_ap) {
if (adhoc) {
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_IBSS_RSN))
return FALSE;
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_CCMP)
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
return TRUE;
} else {
if (ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_SAE) {
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_TKIP)
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
return TRUE;
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_CCMP)
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
return TRUE;
}
}
return FALSE;
}
break;
default:
good = FALSE;
break;

View file

@ -50,6 +50,7 @@ char * nm_utils_ssid_to_utf8 (const guint8 *ssid, gsize len);
* @NMU_SEC_WPA_ENTERPRISE: WPA1 is used with 802.1x authentication
* @NMU_SEC_WPA2_PSK: WPA2/RSN is used with Pre-Shared Keys (PSK)
* @NMU_SEC_WPA2_ENTERPRISE: WPA2 is used with 802.1x authentication
* @NMU_SEC_SAE: is used with WPA3 Enterprise
*
* Describes generic security mechanisms that 802.11 access points may offer.
* Used with nm_utils_security_valid() for checking whether a given access
@ -64,7 +65,8 @@ typedef enum {
NMU_SEC_WPA_PSK,
NMU_SEC_WPA_ENTERPRISE,
NMU_SEC_WPA2_PSK,
NMU_SEC_WPA2_ENTERPRISE
NMU_SEC_WPA2_ENTERPRISE,
NMU_SEC_SAE,
} NMUtilsSecurityType;
gboolean nm_utils_security_valid (NMUtilsSecurityType type,