]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cfg80211: Rename SAE_DATA to more generic AUTH_DATA
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 26 Oct 2016 21:41:58 +0000 (00:41 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 27 Oct 2016 14:03:20 +0000 (16:03 +0200)
This adds defines and nl80211 extensions to allow FILS Authentication to
be implemented similarly to SAE. FILS does not need the special rules
for the Authentication transaction number and Status code fields, but it
does need to add non-IE fields. The previously used
NL80211_ATTR_SAE_DATA can be reused for this to avoid having to
duplicate that implementation. Rename that attribute to more generic
NL80211_ATTR_AUTH_DATA (with backwards compatibility define for
NL80211_SAE_DATA).

Also document the special rules related to the Authentication
transaction number and Status code fiels.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/mac80211/mlme.c
net/wireless/core.h
net/wireless/mlme.c
net/wireless/nl80211.c

index d1ffbc3a8e55e2039009423f5caee0bebf2eee66..dffc265a4fd6ca7ce8e3284f88bb5bc9c93dd920 100644 (file)
@@ -1785,9 +1785,11 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
  * @key_len: length of WEP key for shared key authentication
  * @key_idx: index of WEP key for shared key authentication
  * @key: WEP key for shared key authentication
- * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
- *     Authentication transaction sequence number field.
- * @sae_data_len: Length of sae_data buffer in octets
+ * @auth_data: Fields and elements in Authentication frames. This contains
+ *     the authentication frame body (non-IE and IE data), excluding the
+ *     Authentication algorithm number, i.e., starting at the Authentication
+ *     transaction sequence number field.
+ * @auth_data_len: Length of auth_data buffer in octets
  */
 struct cfg80211_auth_request {
        struct cfg80211_bss *bss;
@@ -1796,8 +1798,8 @@ struct cfg80211_auth_request {
        enum nl80211_auth_type auth_type;
        const u8 *key;
        u8 key_len, key_idx;
-       const u8 *sae_data;
-       size_t sae_data_len;
+       const u8 *auth_data;
+       size_t auth_data_len;
 };
 
 /**
index 1362d24957b514044d61721469b2c66bf740affb..18bcf44899aa380e27c5de4abd58fa25aee999be 100644 (file)
@@ -1638,8 +1638,16 @@ enum nl80211_commands {
  *     the connection request from a station. nl80211_connect_failed_reason
  *     enum has different reasons of connection failure.
  *
- * @NL80211_ATTR_SAE_DATA: SAE elements in Authentication frames. This starts
- *     with the Authentication transaction sequence number field.
+ * @NL80211_ATTR_AUTH_DATA: Fields and elements in Authentication frames.
+ *     This contains the authentication frame body (non-IE and IE data),
+ *     excluding the Authentication algorithm number, i.e., starting at the
+ *     Authentication transaction sequence number field. It is used with
+ *     authentication algorithms that need special fields to be added into
+ *     the frames (SAE and FILS). Currently, only the SAE cases use the
+ *     initial two fields (Authentication transaction sequence number and
+ *     Status code). However, those fields are included in the attribute data
+ *     for all authentication algorithms to keep the attribute definition
+ *     consistent.
  *
  * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
  *     association request when used with NL80211_CMD_NEW_STATION)
@@ -2195,7 +2203,7 @@ enum nl80211_attrs {
 
        NL80211_ATTR_CONN_FAILED_REASON,
 
-       NL80211_ATTR_SAE_DATA,
+       NL80211_ATTR_AUTH_DATA,
 
        NL80211_ATTR_VHT_CAPABILITY,
 
@@ -2347,6 +2355,7 @@ enum nl80211_attrs {
 #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
 #define        NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
 #define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
+#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
 
 /*
  * Allow user space programs to use #ifdef on new attributes by defining them
index c8d3a9b02fb6f405d4178b1b9fae43d26d44f5fc..32fd29581d4d2b93da4c813ecf74989b1d913a77 100644 (file)
@@ -4483,20 +4483,20 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
                return -EOPNOTSUPP;
        }
 
-       auth_data = kzalloc(sizeof(*auth_data) + req->sae_data_len +
+       auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len +
                            req->ie_len, GFP_KERNEL);
        if (!auth_data)
                return -ENOMEM;
 
        auth_data->bss = req->bss;
 
-       if (req->sae_data_len >= 4) {
-               __le16 *pos = (__le16 *) req->sae_data;
+       if (req->auth_data_len >= 4) {
+               __le16 *pos = (__le16 *) req->auth_data;
                auth_data->sae_trans = le16_to_cpu(pos[0]);
                auth_data->sae_status = le16_to_cpu(pos[1]);
-               memcpy(auth_data->data, req->sae_data + 4,
-                      req->sae_data_len - 4);
-               auth_data->data_len += req->sae_data_len - 4;
+               memcpy(auth_data->data, req->auth_data + 4,
+                      req->auth_data_len - 4);
+               auth_data->data_len += req->auth_data_len - 4;
        }
 
        if (req->ie && req->ie_len) {
index 21e31888cfa93f4b63be12e6144145817291992a..fb2fcd5581fed69599e96fe9b02e52ceb8aef6d4 100644 (file)
@@ -345,7 +345,7 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
                       const u8 *ssid, int ssid_len,
                       const u8 *ie, int ie_len,
                       const u8 *key, int key_len, int key_idx,
-                      const u8 *sae_data, int sae_data_len);
+                      const u8 *auth_data, int auth_data_len);
 int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
                        struct net_device *dev,
                        struct ieee80211_channel *chan,
index cbb48e26a8715b8964333bf9b69c52010289bafb..bd1f7a159d6a3e5f29e0a36516144277124cabf1 100644 (file)
@@ -204,14 +204,14 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
                       const u8 *ssid, int ssid_len,
                       const u8 *ie, int ie_len,
                       const u8 *key, int key_len, int key_idx,
-                      const u8 *sae_data, int sae_data_len)
+                      const u8 *auth_data, int auth_data_len)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct cfg80211_auth_request req = {
                .ie = ie,
                .ie_len = ie_len,
-               .sae_data = sae_data,
-               .sae_data_len = sae_data_len,
+               .auth_data = auth_data,
+               .auth_data_len = auth_data_len,
                .auth_type = auth_type,
                .key = key,
                .key_len = key_len,
index 7e746c90156e7983a9e5fbf0121ceda6d7924427..704851142eedba29961d2dc5f0a11f54c11b7831 100644 (file)
@@ -357,7 +357,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
        [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
        [NL80211_ATTR_WDEV] = { .type = NLA_U64 },
        [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },
-       [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, },
+       [NL80211_ATTR_AUTH_DATA] = { .type = NLA_BINARY, },
        [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
        [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
        [NL80211_ATTR_P2P_CTWINDOW] = { .type = NLA_U8 },
@@ -7729,8 +7729,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
        struct cfg80211_registered_device *rdev = info->user_ptr[0];
        struct net_device *dev = info->user_ptr[1];
        struct ieee80211_channel *chan;
-       const u8 *bssid, *ssid, *ie = NULL, *sae_data = NULL;
-       int err, ssid_len, ie_len = 0, sae_data_len = 0;
+       const u8 *bssid, *ssid, *ie = NULL, *auth_data = NULL;
+       int err, ssid_len, ie_len = 0, auth_data_len = 0;
        enum nl80211_auth_type auth_type;
        struct key_parse key;
        bool local_state_change;
@@ -7811,16 +7811,16 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
                return -EINVAL;
 
        if (auth_type == NL80211_AUTHTYPE_SAE &&
-           !info->attrs[NL80211_ATTR_SAE_DATA])
+           !info->attrs[NL80211_ATTR_AUTH_DATA])
                return -EINVAL;
 
-       if (info->attrs[NL80211_ATTR_SAE_DATA]) {
+       if (info->attrs[NL80211_ATTR_AUTH_DATA]) {
                if (auth_type != NL80211_AUTHTYPE_SAE)
                        return -EINVAL;
-               sae_data = nla_data(info->attrs[NL80211_ATTR_SAE_DATA]);
-               sae_data_len = nla_len(info->attrs[NL80211_ATTR_SAE_DATA]);
+               auth_data = nla_data(info->attrs[NL80211_ATTR_AUTH_DATA]);
+               auth_data_len = nla_len(info->attrs[NL80211_ATTR_AUTH_DATA]);
                /* need to include at least Auth Transaction and Status Code */
-               if (sae_data_len < 4)
+               if (auth_data_len < 4)
                        return -EINVAL;
        }
 
@@ -7837,7 +7837,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
        err = cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
                                 ssid, ssid_len, ie, ie_len,
                                 key.p.key, key.p.key_len, key.idx,
-                                sae_data, sae_data_len);
+                                auth_data, auth_data_len);
        wdev_unlock(dev->ieee80211_ptr);
        return err;
 }