]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FILS: Advertize FILS capability based on driver capability
authorVidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>
Thu, 22 Jun 2017 13:30:15 +0000 (19:00 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 7 Jul 2017 10:39:05 +0000 (13:39 +0300)
Add changes to control interface command get_capability to advertize
FILS capability, FILS AKMs suites, and FILS Authentication algorithms
based on the driver capabilities.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/drivers/driver.h
src/drivers/driver_nl80211_capa.c
wpa_supplicant/ctrl_iface.c

index 455e7dffc7e5828288bff51c20781c51fdcc048b..9b9c73166b84d775c6c7ea6fbb8d49fa914bb5c1 100644 (file)
@@ -1438,6 +1438,10 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192   0x00000200
 #define WPA_DRIVER_CAPA_KEY_MGMT_OWE           0x00000400
 #define WPA_DRIVER_CAPA_KEY_MGMT_DPP           0x00000800
+#define WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA256    0x00001000
+#define WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA384    0x00002000
+#define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256 0x00004000
+#define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384 0x00008000
        /** Bitfield of supported key management suites */
        unsigned int key_mgmt;
 
index c1423bd588f8a9ba9d4c4c40ffcd582af4465eeb..7a4df1a0041b846c9ed00d449ed844e3ecee4eb8 100644 (file)
@@ -1138,6 +1138,16 @@ int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
                WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192 |
                WPA_DRIVER_CAPA_KEY_MGMT_OWE |
                WPA_DRIVER_CAPA_KEY_MGMT_DPP;
+
+       if (drv->capa.flags & WPA_DRIVER_FLAGS_SME)
+               drv->capa.key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA256 |
+                       WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA384 |
+                       WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256 |
+                       WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384;
+       else if (drv->capa.flags & WPA_DRIVER_FLAGS_FILS_SK_OFFLOAD)
+               drv->capa.key_mgmt |= WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA256 |
+                       WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA384;
+
        drv->capa.auth = WPA_DRIVER_AUTH_OPEN |
                WPA_DRIVER_AUTH_SHARED |
                WPA_DRIVER_AUTH_LEAP;
index 5bd9d087331ffc8b34a1b2f085b2fd6e399d1100..5063801d6ce33ab6206b5736ea869438b3301647 100644 (file)
@@ -62,6 +62,29 @@ static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
 static int * freq_range_to_channel_list(struct wpa_supplicant *wpa_s,
                                        char *val);
 
+
+#ifdef CONFIG_FILS
+
+static int wpa_is_fils_supported(struct wpa_supplicant *wpa_s)
+{
+       return (((wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) &&
+                (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_FILS)) ||
+               (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) &&
+                (wpa_s->drv_flags & WPA_DRIVER_FLAGS_FILS_SK_OFFLOAD)));
+}
+
+
+#ifdef CONFIG_FILS_SK_PFS
+static int wpa_is_fils_sk_pfs_supported(struct wpa_supplicant *wpa_s)
+{
+       return (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) &&
+               (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_FILS);
+}
+#endif /* CONFIG_FILS_SK_PFS */
+
+#endif /* CONFIG_FILS */
+
+
 static int set_bssid_filter(struct wpa_supplicant *wpa_s, char *val)
 {
        char *pos;
@@ -3859,6 +3882,34 @@ static int ctrl_iface_get_capability_key_mgmt(int res, char *strict,
                pos += ret;
        }
 #endif /* CONFIG_DPP */
+#ifdef CONFIG_FILS
+       if (capa->key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA256) {
+               ret = os_snprintf(pos, end - pos, " FILS-SHA256");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+       if (capa->key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA384) {
+               ret = os_snprintf(pos, end - pos, " FILS-SHA384");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+#ifdef CONFIG_IEEE80211R
+       if (capa->key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256) {
+               ret = os_snprintf(pos, end - pos, " FT-FILS-SHA256");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+       if (capa->key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384) {
+               ret = os_snprintf(pos, end - pos, " FT-FILS-SHA384");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+#endif /* CONFIG_IEEE80211R */
+#endif /* CONFIG_FILS */
 
        return pos - buf;
 }
@@ -3961,6 +4012,26 @@ static int ctrl_iface_get_capability_auth_alg(struct wpa_supplicant *wpa_s,
        }
 #endif /* CONFIG_SAE */
 
+#ifdef CONFIG_FILS
+       if (wpa_is_fils_supported(wpa_s)) {
+               ret = os_snprintf(pos, end - pos, "%sFILS_SK_WITHOUT_PFS",
+                                 pos == buf ? "" : " ");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+
+#ifdef CONFIG_FILS_SK_PFS
+       if (wpa_is_fils_sk_pfs_supported(wpa_s)) {
+               ret = os_snprintf(pos, end - pos, "%sFILS_SK_WITH_PFS",
+                                 pos == buf ? "" : " ");
+               if (os_snprintf_error(end - pos, ret))
+                       return pos - buf;
+               pos += ret;
+       }
+#endif /* CONFIG_FILS_SK_PFS */
+#endif /* CONFIG_FILS */
+
        return pos - buf;
 }
 
@@ -4219,16 +4290,23 @@ static int wpa_supplicant_ctrl_iface_get_capability(
 #endif /* CONFIG_ACS */
 
 #ifdef CONFIG_FILS
-       if (os_strcmp(field, "fils") == 0 &&
-           (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_FILS)) {
+       if (os_strcmp(field, "fils") == 0) {
 #ifdef CONFIG_FILS_SK_PFS
-               res = os_snprintf(buf, buflen, "FILS FILS-SK-PFS");
-#else /* CONFIG_FILS_SK_PFS */
-               res = os_snprintf(buf, buflen, "FILS");
+               if (wpa_is_fils_supported(wpa_s) &&
+                   wpa_is_fils_sk_pfs_supported(wpa_s)) {
+                       res = os_snprintf(buf, buflen, "FILS FILS-SK-PFS");
+                       if (os_snprintf_error(buflen, res))
+                               return -1;
+                       return res;
+               }
 #endif /* CONFIG_FILS_SK_PFS */
-               if (os_snprintf_error(buflen, res))
-                       return -1;
-               return res;
+
+               if (wpa_is_fils_supported(wpa_s)) {
+                       res = os_snprintf(buf, buflen, "FILS");
+                       if (os_snprintf_error(buflen, res))
+                               return -1;
+                       return res;
+               }
        }
 #endif /* CONFIG_FILS */