aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChung-Hsien Hsu <stanley.hsu@cypress.com>2019-05-09 05:49:06 -0400
committerJohannes Berg <johannes.berg@intel.com>2019-06-14 08:07:49 -0400
commit26f7044e95042daabcf1c71796a0e804a83c979f (patch)
tree8fa407b7b97697e56f4e4e74d707c2aad7e39c07
parentcc3e14c21ae928b3f8bce584b2c7d53d332b9738 (diff)
nl80211: add support for SAE authentication offload
Let drivers advertise support for station-mode SAE authentication offload with a new NL80211_EXT_FEATURE_SAE_OFFLOAD flag. Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com> Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/linux/ieee80211.h1
-rw-r--r--include/net/cfg80211.h5
-rw-r--r--include/uapi/linux/nl80211.h19
-rw-r--r--net/wireless/nl80211.c14
4 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 61f0a316c6ac..5dfd949ade25 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2612,6 +2612,7 @@ enum ieee80211_key_len {
2612#define FILS_ERP_MAX_RRK_LEN 64 2612#define FILS_ERP_MAX_RRK_LEN 64
2613 2613
2614#define PMK_MAX_LEN 64 2614#define PMK_MAX_LEN 64
2615#define SAE_PASSWORD_MAX_LEN 128
2615 2616
2616/* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ 2617/* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
2617enum ieee80211_pub_actioncode { 2618enum ieee80211_pub_actioncode {
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c19687833493..4b45056dbb25 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -742,6 +742,9 @@ struct survey_info {
742 * CFG80211_MAX_WEP_KEYS WEP keys 742 * CFG80211_MAX_WEP_KEYS WEP keys
743 * @wep_tx_key: key index (0..3) of the default TX static WEP key 743 * @wep_tx_key: key index (0..3) of the default TX static WEP key
744 * @psk: PSK (for devices supporting 4-way-handshake offload) 744 * @psk: PSK (for devices supporting 4-way-handshake offload)
745 * @sae_pwd: password for SAE authentication (for devices supporting SAE
746 * offload)
747 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
745 */ 748 */
746struct cfg80211_crypto_settings { 749struct cfg80211_crypto_settings {
747 u32 wpa_versions; 750 u32 wpa_versions;
@@ -757,6 +760,8 @@ struct cfg80211_crypto_settings {
757 struct key_params *wep_keys; 760 struct key_params *wep_keys;
758 int wep_tx_key; 761 int wep_tx_key;
759 const u8 *psk; 762 const u8 *psk;
763 const u8 *sae_pwd;
764 u8 sae_pwd_len;
760}; 765};
761 766
762/** 767/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index e9bf3d69d847..8b1e43fecd25 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -235,6 +235,15 @@
235 */ 235 */
236 236
237/** 237/**
238 * DOC: SAE authentication offload
239 *
240 * By setting @NL80211_EXT_FEATURE_SAE_OFFLOAD flag drivers can indicate they
241 * support offloading SAE authentication for WPA3-Personal networks. In
242 * %NL80211_CMD_CONNECT the password for SAE should be specified using
243 * %NL80211_ATTR_SAE_PASSWORD.
244 */
245
246/**
238 * enum nl80211_commands - supported nl80211 commands 247 * enum nl80211_commands - supported nl80211 commands
239 * 248 *
240 * @NL80211_CMD_UNSPEC: unspecified command to catch errors 249 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -2341,6 +2350,10 @@ enum nl80211_commands {
2341 * should be picking up the lowest tx power, either tx power per-interface 2350 * should be picking up the lowest tx power, either tx power per-interface
2342 * or per-station. 2351 * or per-station.
2343 * 2352 *
2353 * @NL80211_ATTR_SAE_PASSWORD: attribute for passing SAE password material. It
2354 * is used with %NL80211_CMD_CONNECT to provide password for offloading
2355 * SAE authentication for WPA3-Personal networks.
2356 *
2344 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 2357 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
2345 * @NL80211_ATTR_MAX: highest attribute number currently defined 2358 * @NL80211_ATTR_MAX: highest attribute number currently defined
2346 * @__NL80211_ATTR_AFTER_LAST: internal use 2359 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2794,6 +2807,8 @@ enum nl80211_attrs {
2794 NL80211_ATTR_STA_TX_POWER_SETTING, 2807 NL80211_ATTR_STA_TX_POWER_SETTING,
2795 NL80211_ATTR_STA_TX_POWER, 2808 NL80211_ATTR_STA_TX_POWER,
2796 2809
2810 NL80211_ATTR_SAE_PASSWORD,
2811
2797 /* add attributes here, update the policy in nl80211.c */ 2812 /* add attributes here, update the policy in nl80211.c */
2798 2813
2799 __NL80211_ATTR_AFTER_LAST, 2814 __NL80211_ATTR_AFTER_LAST,
@@ -5423,6 +5438,9 @@ enum nl80211_feature_flags {
5423 * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power 5438 * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power
5424 * to a station. 5439 * to a station.
5425 * 5440 *
5441 * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in
5442 * station mode (SAE password is passed as part of the connect command).
5443 *
5426 * @NUM_NL80211_EXT_FEATURES: number of extended features. 5444 * @NUM_NL80211_EXT_FEATURES: number of extended features.
5427 * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 5445 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
5428 */ 5446 */
@@ -5467,6 +5485,7 @@ enum nl80211_ext_feature_index {
5467 NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD, 5485 NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
5468 NL80211_EXT_FEATURE_EXT_KEY_ID, 5486 NL80211_EXT_FEATURE_EXT_KEY_ID,
5469 NL80211_EXT_FEATURE_STA_TX_PWR, 5487 NL80211_EXT_FEATURE_STA_TX_PWR,
5488 NL80211_EXT_FEATURE_SAE_OFFLOAD,
5470 5489
5471 /* add new features before the definition below */ 5490 /* add new features before the definition below */
5472 NUM_NL80211_EXT_FEATURES, 5491 NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8332a5731c57..80e514872719 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -571,6 +571,8 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
571 [NL80211_ATTR_PEER_MEASUREMENTS] = 571 [NL80211_ATTR_PEER_MEASUREMENTS] =
572 NLA_POLICY_NESTED(nl80211_pmsr_attr_policy), 572 NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
573 [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1), 573 [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
574 [NL80211_ATTR_SAE_PASSWORD] = { .type = NLA_BINARY,
575 .len = SAE_PASSWORD_MAX_LEN },
574}; 576};
575 577
576/* policy for the key attributes */ 578/* policy for the key attributes */
@@ -4434,6 +4436,8 @@ static bool nl80211_valid_auth_type(struct cfg80211_registered_device *rdev,
4434 return true; 4436 return true;
4435 case NL80211_CMD_CONNECT: 4437 case NL80211_CMD_CONNECT:
4436 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) && 4438 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) &&
4439 !wiphy_ext_feature_isset(&rdev->wiphy,
4440 NL80211_EXT_FEATURE_SAE_OFFLOAD) &&
4437 auth_type == NL80211_AUTHTYPE_SAE) 4441 auth_type == NL80211_AUTHTYPE_SAE)
4438 return false; 4442 return false;
4439 4443
@@ -8973,6 +8977,16 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
8973 settings->psk = nla_data(info->attrs[NL80211_ATTR_PMK]); 8977 settings->psk = nla_data(info->attrs[NL80211_ATTR_PMK]);
8974 } 8978 }
8975 8979
8980 if (info->attrs[NL80211_ATTR_SAE_PASSWORD]) {
8981 if (!wiphy_ext_feature_isset(&rdev->wiphy,
8982 NL80211_EXT_FEATURE_SAE_OFFLOAD))
8983 return -EINVAL;
8984 settings->sae_pwd =
8985 nla_data(info->attrs[NL80211_ATTR_SAE_PASSWORD]);
8986 settings->sae_pwd_len =
8987 nla_len(info->attrs[NL80211_ATTR_SAE_PASSWORD]);
8988 }
8989
8976 return 0; 8990 return 0;
8977} 8991}
8978 8992