From 63653307df2dc4bd6b3429cbc63278da1f4def44 Mon Sep 17 00:00:00 2001 From: Tanmay Garg Date: Mon, 18 May 2020 15:52:44 +0530 Subject: [PATCH] Add support for indicating missing driver AKM capability flags Add support for missing driver AKM capability flags from the list of RSN_AUTH_KEY_MGMT_* flags and make these available through the 'GET_CAPABILITY key_mgmt' control interface command. Signed-off-by: Jouni Malinen --- src/drivers/driver.h | 7 ++++ src/drivers/driver_nl80211_capa.c | 21 ++++++++++ wpa_supplicant/ctrl_iface.c | 66 +++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 1e2e332a6..350c1cb57 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1747,6 +1747,13 @@ struct wpa_driver_capa { #define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256 0x00004000 #define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384 0x00008000 #define WPA_DRIVER_CAPA_KEY_MGMT_SAE 0x00010000 +#define WPA_DRIVER_CAPA_KEY_MGMT_802_1X_SHA256 0x00020000 +#define WPA_DRIVER_CAPA_KEY_MGMT_PSK_SHA256 0x00040000 +#define WPA_DRIVER_CAPA_KEY_MGMT_TPK_HANDSHAKE 0x00080000 +#define WPA_DRIVER_CAPA_KEY_MGMT_FT_SAE 0x00100000 +#define WPA_DRIVER_CAPA_KEY_MGMT_FT_802_1X_SHA384 0x00200000 +#define WPA_DRIVER_CAPA_KEY_MGMT_CCKM 0x00400000 +#define WPA_DRIVER_CAPA_KEY_MGMT_OSEN 0x00800000 /** Bitfield of supported key management suites */ unsigned int key_mgmt; unsigned int key_mgmt_iftype[WPA_IF_MAX]; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index a3341a088..3e8dcef2a 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -281,6 +281,27 @@ static unsigned int get_akm_suites_info(struct nlattr *tb) case RSN_AUTH_KEY_MGMT_FT_PSK: key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK; break; + case RSN_AUTH_KEY_MGMT_802_1X_SHA256: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_802_1X_SHA256; + break; + case RSN_AUTH_KEY_MGMT_PSK_SHA256: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_PSK_SHA256; + break; + case RSN_AUTH_KEY_MGMT_TPK_HANDSHAKE: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_TPK_HANDSHAKE; + break; + case RSN_AUTH_KEY_MGMT_FT_SAE: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FT_SAE; + break; + case RSN_AUTH_KEY_MGMT_FT_802_1X_SHA384: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FT_802_1X_SHA384; + break; + case RSN_AUTH_KEY_MGMT_CCKM: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_CCKM; + break; + case RSN_AUTH_KEY_MGMT_OSEN: + key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_OSEN; + break; case RSN_AUTH_KEY_MGMT_802_1X_SUITE_B: key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B; break; diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 79b5e8054..298f3c442 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -4221,6 +4221,27 @@ static int ctrl_iface_get_capability_key_mgmt(int res, bool strict, pos += ret; } + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK) { + ret = os_snprintf(pos, end - pos, " WAPI-PSK"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } + + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_TPK_HANDSHAKE) { + ret = os_snprintf(pos, end - pos, " TPK-HANDSHAKE"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } + + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_CCKM) { + ret = os_snprintf(pos, end - pos, " CCKM"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } + #ifdef CONFIG_SUITEB if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B) { ret = os_snprintf(pos, end - pos, " WPA-EAP-SUITE-B"); @@ -4288,6 +4309,28 @@ static int ctrl_iface_get_capability_key_mgmt(int res, bool strict, return pos - buf; pos += ret; } + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT) { + ret = os_snprintf(pos, end - pos, " FT-EAP"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } +#ifdef CONFIG_SAE + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT_SAE) { + ret = os_snprintf(pos, end - pos, " FT-SAE"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } +#endif /* CONFIG_SAE */ +#ifdef CONFIG_SHA384 + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT_802_1X_SHA384) { + ret = os_snprintf(pos, end - pos, " FT-EAP-SHA384"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } +#endif /* CONFIG_SHA384 */ #endif /* CONFIG_IEEE80211R */ #ifdef CONFIG_SAE if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_SAE) { @@ -4297,6 +4340,29 @@ static int ctrl_iface_get_capability_key_mgmt(int res, bool strict, pos += ret; } #endif /* CONFIG_SAE */ +#ifdef CONFIG_SHA256 + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_802_1X_SHA256) { + ret = os_snprintf(pos, end - pos, " WPA-EAP-SHA256"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } + + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_PSK_SHA256) { + ret = os_snprintf(pos, end - pos, " WPA-PSK-SHA256"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } +#endif /* CONFIG_SHA256 */ +#ifdef CONFIG_HS20 + if (key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_OSEN) { + ret = os_snprintf(pos, end - pos, " OSEN"); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } +#endif /* CONFIG_HS20 */ return pos - buf; }