3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 05:32:48 +01:00

common: put all PSK AKM's into macro

The list of PSK/8021x AKM's in security_determine was getting long,
and difficult to keep under 80 characters. This moves them all into
two new macros, AKM_IS_PSK/AKM_IS_8021X.
This commit is contained in:
James Prestwood 2019-04-04 14:28:14 -07:00 committed by Denis Kenzior
parent ea56b9b41f
commit 9b83f3d2db

View File

@ -64,19 +64,33 @@ bool security_from_str(const char *str, enum security *security)
return true; return true;
} }
#define AKM_IS_PSK(akm) \
( \
akm & (IE_RSN_AKM_SUITE_PSK | \
IE_RSN_AKM_SUITE_FT_USING_PSK | \
IE_RSN_AKM_SUITE_FT_USING_PSK | \
IE_RSN_AKM_SUITE_SAE_SHA256 | \
IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256) \
)
#define AKM_IS_8021X(akm) \
( \
akm & (IE_RSN_AKM_SUITE_8021X | \
IE_RSN_AKM_SUITE_8021X_SHA256 | \
IE_RSN_AKM_SUITE_FT_OVER_8021X | \
IE_RSN_AKM_SUITE_FILS_SHA256 | \
IE_RSN_AKM_SUITE_FILS_SHA384 | \
IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256 | \
IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384) \
)
enum security security_determine(uint16_t bss_capability, enum security security_determine(uint16_t bss_capability,
const struct ie_rsn_info *info) const struct ie_rsn_info *info)
{ {
if (info && (info->akm_suites & IE_RSN_AKM_SUITE_PSK || if (info && AKM_IS_PSK(info->akm_suites))
info->akm_suites & IE_RSN_AKM_SUITE_PSK_SHA256 ||
info->akm_suites & IE_RSN_AKM_SUITE_FT_USING_PSK ||
info->akm_suites & IE_RSN_AKM_SUITE_SAE_SHA256 ||
info->akm_suites & IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256))
return SECURITY_PSK; return SECURITY_PSK;
if (info && (info->akm_suites & IE_RSN_AKM_SUITE_8021X || if (info && AKM_IS_8021X(info->akm_suites))
info->akm_suites & IE_RSN_AKM_SUITE_8021X_SHA256 ||
info->akm_suites & IE_RSN_AKM_SUITE_FT_OVER_8021X))
return SECURITY_8021X; return SECURITY_8021X;
if (info && (info->akm_suites & IE_RSN_AKM_SUITE_OWE)) if (info && (info->akm_suites & IE_RSN_AKM_SUITE_OWE))