linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] cfg80211/mac80211: Station mode SAE
@ 2012-09-30 16:29 Jouni Malinen
  2012-09-30 16:29 ` [PATCH 1/4] mac80211: Take status code as parameter to ieee80211_send_auth Jouni Malinen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jouni Malinen @ 2012-09-30 16:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

This series adds support to allow simultaneous authentication of equals
(SAE) to be implemented in station mode with user space SME.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] mac80211: Take status code as parameter to ieee80211_send_auth
  2012-09-30 16:29 [PATCH 0/4] cfg80211/mac80211: Station mode SAE Jouni Malinen
@ 2012-09-30 16:29 ` Jouni Malinen
  2012-09-30 16:29 ` [PATCH 2/4] mac80211: Add debug print on unexpect authentication state Jouni Malinen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jouni Malinen @ 2012-09-30 16:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Jouni Malinen

Non-zero status code may be needed for Authentication frames, e.g.,
when using SAE.

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 net/mac80211/ibss.c        |    4 ++--
 net/mac80211/ieee80211_i.h |    2 +-
 net/mac80211/mlme.c        |    4 ++--
 net/mac80211/util.c        |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

Index: wireless-testing/net/mac80211/ibss.c
===================================================================
--- wireless-testing.orig/net/mac80211/ibss.c	2012-09-30 19:16:51.487842602 +0300
+++ wireless-testing/net/mac80211/ibss.c	2012-09-30 19:16:52.587842581 +0300
@@ -279,7 +279,7 @@ static struct sta_info *ieee80211_ibss_f
 		ibss_dbg(sdata,
 			 "TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n",
 			 sdata->vif.addr, addr, sdata->u.ibss.bssid);
-		ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
+		ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, 0, NULL, 0,
 				    addr, sdata->u.ibss.bssid, NULL, 0, 0);
 	}
 	return sta;
@@ -389,7 +389,7 @@ static void ieee80211_rx_mgmt_auth_ibss(
 	 * However, try to reply to authentication attempts if someone
 	 * has actually implemented this.
 	 */
-	ieee80211_send_auth(sdata, 2, WLAN_AUTH_OPEN, NULL, 0,
+	ieee80211_send_auth(sdata, 2, WLAN_AUTH_OPEN, 0, NULL, 0,
 			    mgmt->sa, sdata->u.ibss.bssid, NULL, 0, 0);
 }
 
Index: wireless-testing/net/mac80211/ieee80211_i.h
===================================================================
--- wireless-testing.orig/net/mac80211/ieee80211_i.h	2012-09-30 19:16:51.467842603 +0300
+++ wireless-testing/net/mac80211/ieee80211_i.h	2012-09-30 19:16:52.591842581 +0300
@@ -1444,7 +1444,7 @@ static inline void ieee80211_add_pending
 }
 
 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
-			 u16 transaction, u16 auth_alg,
+			 u16 transaction, u16 auth_alg, u16 status,
 			 u8 *extra, size_t extra_len, const u8 *bssid,
 			 const u8 *da, const u8 *key, u8 key_len, u8 key_idx);
 void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
Index: wireless-testing/net/mac80211/mlme.c
===================================================================
--- wireless-testing.orig/net/mac80211/mlme.c	2012-09-30 19:16:51.499842602 +0300
+++ wireless-testing/net/mac80211/mlme.c	2012-09-30 19:16:52.591842581 +0300
@@ -1824,7 +1824,7 @@ static void ieee80211_auth_challenge(str
 		return;
 	auth_data->expected_transaction = 4;
 	drv_mgd_prepare_tx(sdata->local, sdata);
-	ieee80211_send_auth(sdata, 3, auth_data->algorithm,
+	ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0,
 			    elems.challenge - 2, elems.challenge_len + 2,
 			    auth_data->bss->bssid, auth_data->bss->bssid,
 			    auth_data->key, auth_data->key_len,
@@ -2708,7 +2708,7 @@ static int ieee80211_probe_auth(struct i
 			   IEEE80211_AUTH_MAX_TRIES);
 
 		auth_data->expected_transaction = 2;
-		ieee80211_send_auth(sdata, 1, auth_data->algorithm,
+		ieee80211_send_auth(sdata, 1, auth_data->algorithm, 0,
 				    auth_data->ie, auth_data->ie_len,
 				    auth_data->bss->bssid,
 				    auth_data->bss->bssid, NULL, 0, 0);
Index: wireless-testing/net/mac80211/util.c
===================================================================
--- wireless-testing.orig/net/mac80211/util.c	2012-09-30 19:16:51.479842602 +0300
+++ wireless-testing/net/mac80211/util.c	2012-09-30 19:16:52.591842581 +0300
@@ -968,7 +968,7 @@ u32 ieee80211_mandatory_rates(struct iee
 }
 
 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
-			 u16 transaction, u16 auth_alg,
+			 u16 transaction, u16 auth_alg, u16 status,
 			 u8 *extra, size_t extra_len, const u8 *da,
 			 const u8 *bssid, const u8 *key, u8 key_len, u8 key_idx)
 {
@@ -993,7 +993,7 @@ void ieee80211_send_auth(struct ieee8021
 	memcpy(mgmt->bssid, bssid, ETH_ALEN);
 	mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg);
 	mgmt->u.auth.auth_transaction = cpu_to_le16(transaction);
-	mgmt->u.auth.status_code = cpu_to_le16(0);
+	mgmt->u.auth.status_code = cpu_to_le16(status);
 	if (extra)
 		memcpy(skb_put(skb, extra_len), extra, extra_len);
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] mac80211: Add debug print on unexpect authentication state
  2012-09-30 16:29 [PATCH 0/4] cfg80211/mac80211: Station mode SAE Jouni Malinen
  2012-09-30 16:29 ` [PATCH 1/4] mac80211: Take status code as parameter to ieee80211_send_auth Jouni Malinen
@ 2012-09-30 16:29 ` Jouni Malinen
  2012-09-30 16:29 ` [PATCH 3/4] cfg80211: Allow user space to specify non-IEs to SAE Authentication Jouni Malinen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jouni Malinen @ 2012-09-30 16:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Jouni Malinen

This is useful when debugging authentication process issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 net/mac80211/mlme.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: wireless-testing/net/mac80211/mlme.c
===================================================================
--- wireless-testing.orig/net/mac80211/mlme.c	2012-09-30 19:16:52.591842581 +0300
+++ wireless-testing/net/mac80211/mlme.c	2012-09-30 19:16:55.831842519 +0300
@@ -1858,8 +1858,13 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
 	status_code = le16_to_cpu(mgmt->u.auth.status_code);
 
 	if (auth_alg != ifmgd->auth_data->algorithm ||
-	    auth_transaction != ifmgd->auth_data->expected_transaction)
+	    auth_transaction != ifmgd->auth_data->expected_transaction) {
+		sdata_info(sdata, "%pM unexpected authentication state: alg %d (expected %d) transact %d (expected %d)\n",
+			   mgmt->sa, auth_alg, ifmgd->auth_data->algorithm,
+			   auth_transaction,
+			   ifmgd->auth_data->expected_transaction);
 		return RX_MGMT_NONE;
+	}
 
 	if (status_code != WLAN_STATUS_SUCCESS) {
 		sdata_info(sdata, "%pM denied authentication (status %d)\n",


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] cfg80211: Allow user space to specify non-IEs to SAE Authentication
  2012-09-30 16:29 [PATCH 0/4] cfg80211/mac80211: Station mode SAE Jouni Malinen
  2012-09-30 16:29 ` [PATCH 1/4] mac80211: Take status code as parameter to ieee80211_send_auth Jouni Malinen
  2012-09-30 16:29 ` [PATCH 2/4] mac80211: Add debug print on unexpect authentication state Jouni Malinen
@ 2012-09-30 16:29 ` Jouni Malinen
  2012-09-30 16:29 ` [PATCH 4/4] mac80211: Allow station mode SAE to be implemented in user space Jouni Malinen
  2012-10-01  7:47 ` [PATCH 0/4] cfg80211/mac80211: Station mode SAE Johannes Berg
  4 siblings, 0 replies; 6+ messages in thread
From: Jouni Malinen @ 2012-09-30 16:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Jouni Malinen

SAE extends Authentication frames with fields that are not information
elements. NL80211_ATTR_IE is not suitable for these, so introduce a new
attribute that can be used to specify the fields needed for SAE in
station mode.

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 include/linux/nl80211.h |   11 +++++++++++
 include/net/cfg80211.h  |    5 +++++
 net/wireless/core.h     |    6 ++++--
 net/wireless/mlme.c     |   11 ++++++++---
 net/wireless/nl80211.c  |   21 ++++++++++++++++++---
 net/wireless/sme.c      |    2 +-
 6 files changed, 47 insertions(+), 9 deletions(-)

Index: wireless-testing/include/linux/nl80211.h
===================================================================
--- wireless-testing.orig/include/linux/nl80211.h	2012-09-30 19:16:51.271842606 +0300
+++ wireless-testing/include/linux/nl80211.h	2012-09-30 19:16:57.679842484 +0300
@@ -1273,6 +1273,9 @@ 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_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1530,6 +1533,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_CONN_FAILED_REASON,
 
+	NL80211_ATTR_SAE_DATA,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -2489,6 +2494,7 @@ enum nl80211_bss_status {
  * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
  * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
  * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
+ * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals
  * @__NL80211_AUTHTYPE_NUM: internal
  * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
  * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
@@ -2500,6 +2506,7 @@ enum nl80211_auth_type {
 	NL80211_AUTHTYPE_SHARED_KEY,
 	NL80211_AUTHTYPE_FT,
 	NL80211_AUTHTYPE_NETWORK_EAP,
+	NL80211_AUTHTYPE_SAE,
 
 	/* keep last */
 	__NL80211_AUTHTYPE_NUM,
@@ -3028,6 +3035,9 @@ enum nl80211_ap_sme_features {
  *	in the interface combinations, even when it's only used for scan
  *	and remain-on-channel. This could be due to, for example, the
  *	remain-on-channel implementation requiring a channel context.
+ * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
+ *	equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
+ *	mode
  */
 enum nl80211_feature_flags {
 	NL80211_FEATURE_SK_TX_STATUS			= 1 << 0,
@@ -3035,6 +3045,7 @@ enum nl80211_feature_flags {
 	NL80211_FEATURE_INACTIVITY_TIMER		= 1 << 2,
 	NL80211_FEATURE_CELL_BASE_REG_HINTS		= 1 << 3,
 	NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL	= 1 << 4,
+	NL80211_FEATURE_SAE				= 1 << 5,
 };
 
 /**
Index: wireless-testing/include/net/cfg80211.h
===================================================================
--- wireless-testing.orig/include/net/cfg80211.h	2012-09-30 19:16:51.283842606 +0300
+++ wireless-testing/include/net/cfg80211.h	2012-09-30 19:16:57.679842484 +0300
@@ -1152,6 +1152,9 @@ const u8 *ieee80211_bss_get_ie(struct cf
  * @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
  */
 struct cfg80211_auth_request {
 	struct cfg80211_bss *bss;
@@ -1160,6 +1163,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;
 };
 
 /**
Index: wireless-testing/net/wireless/core.h
===================================================================
--- wireless-testing.orig/net/wireless/core.h	2012-09-30 19:16:51.303842606 +0300
+++ wireless-testing/net/wireless/core.h	2012-09-30 19:16:57.679842484 +0300
@@ -320,13 +320,15 @@ int __cfg80211_mlme_auth(struct cfg80211
 			 const u8 *bssid,
 			 const u8 *ssid, int ssid_len,
 			 const u8 *ie, int ie_len,
-			 const u8 *key, int key_len, int key_idx);
+			 const u8 *key, int key_len, int key_idx,
+			 const u8 *sae_data, int sae_data_len);
 int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
 		       struct net_device *dev, struct ieee80211_channel *chan,
 		       enum nl80211_auth_type auth_type, const u8 *bssid,
 		       const u8 *ssid, int ssid_len,
 		       const u8 *ie, int ie_len,
-		       const u8 *key, int key_len, int key_idx);
+		       const u8 *key, int key_len, int key_idx,
+		       const u8 *sae_data, int sae_data_len);
 int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
 			  struct net_device *dev,
 			  struct ieee80211_channel *chan,
Index: wireless-testing/net/wireless/mlme.c
===================================================================
--- wireless-testing.orig/net/wireless/mlme.c	2012-09-30 19:16:51.323842605 +0300
+++ wireless-testing/net/wireless/mlme.c	2012-09-30 19:16:57.679842484 +0300
@@ -273,7 +273,8 @@ int __cfg80211_mlme_auth(struct cfg80211
 			 const u8 *bssid,
 			 const u8 *ssid, int ssid_len,
 			 const u8 *ie, int ie_len,
-			 const u8 *key, int key_len, int key_idx)
+			 const u8 *key, int key_len, int key_idx,
+			 const u8 *sae_data, int sae_data_len)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct cfg80211_auth_request req;
@@ -293,6 +294,8 @@ int __cfg80211_mlme_auth(struct cfg80211
 
 	req.ie = ie;
 	req.ie_len = ie_len;
+	req.sae_data = sae_data;
+	req.sae_data_len = sae_data_len;
 	req.auth_type = auth_type;
 	req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
 				   WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
@@ -319,7 +322,8 @@ int cfg80211_mlme_auth(struct cfg80211_r
 		       enum nl80211_auth_type auth_type, const u8 *bssid,
 		       const u8 *ssid, int ssid_len,
 		       const u8 *ie, int ie_len,
-		       const u8 *key, int key_len, int key_idx)
+		       const u8 *key, int key_len, int key_idx,
+		       const u8 *sae_data, int sae_data_len)
 {
 	int err;
 
@@ -327,7 +331,8 @@ int cfg80211_mlme_auth(struct cfg80211_r
 	wdev_lock(dev->ieee80211_ptr);
 	err = __cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
 				   ssid, ssid_len, ie, ie_len,
-				   key, key_len, key_idx);
+				   key, key_len, key_idx,
+				   sae_data, sae_data_len);
 	wdev_unlock(dev->ieee80211_ptr);
 	mutex_unlock(&rdev->devlist_mtx);
 
Index: wireless-testing/net/wireless/nl80211.c
===================================================================
--- wireless-testing.orig/net/wireless/nl80211.c	2012-09-30 19:16:51.311842605 +0300
+++ wireless-testing/net/wireless/nl80211.c	2012-09-30 19:16:57.683842484 +0300
@@ -355,6 +355,7 @@ static const struct nla_policy nl80211_p
 	[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, },
 };
 
 /* policy for the key attributes */
@@ -4868,8 +4869,8 @@ static int nl80211_authenticate(struct s
 	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;
-	int err, ssid_len, ie_len = 0;
+	const u8 *bssid, *ssid, *ie = NULL, *sae_data = NULL;
+	int err, ssid_len, ie_len = 0, sae_data_len = 0;
 	enum nl80211_auth_type auth_type;
 	struct key_parse key;
 	bool local_state_change;
@@ -4948,6 +4949,19 @@ static int nl80211_authenticate(struct s
 	if (!nl80211_valid_auth_type(auth_type))
 		return -EINVAL;
 
+	if (auth_type == NL80211_AUTHTYPE_SAE &&
+	    !info->attrs[NL80211_ATTR_SAE_DATA])
+		return -EINVAL;
+	if (info->attrs[NL80211_ATTR_SAE_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]);
+		/* need to include at least Auth Transaction and Status Code */
+		if (sae_data_len < 4)
+			return -EINVAL;
+	}
+
 	local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE];
 
 	/*
@@ -4959,7 +4973,8 @@ static int nl80211_authenticate(struct s
 
 	return cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
 				  ssid, ssid_len, ie, ie_len,
-				  key.p.key, key.p.key_len, key.idx);
+				  key.p.key, key.p.key_len, key.idx,
+				  sae_data, sae_data_len);
 }
 
 static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
Index: wireless-testing/net/wireless/sme.c
===================================================================
--- wireless-testing.orig/net/wireless/sme.c	2012-09-30 19:16:51.295842606 +0300
+++ wireless-testing/net/wireless/sme.c	2012-09-30 19:16:57.683842484 +0300
@@ -179,7 +179,7 @@ static int cfg80211_conn_do_work(struct
 					    params->ssid, params->ssid_len,
 					    NULL, 0,
 					    params->key, params->key_len,
-					    params->key_idx);
+					    params->key_idx, NULL, 0);
 	case CFG80211_CONN_ASSOCIATE_NEXT:
 		BUG_ON(!rdev->ops->assoc);
 		wdev->conn->state = CFG80211_CONN_ASSOCIATING;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] mac80211: Allow station mode SAE to be implemented in user space
  2012-09-30 16:29 [PATCH 0/4] cfg80211/mac80211: Station mode SAE Jouni Malinen
                   ` (2 preceding siblings ...)
  2012-09-30 16:29 ` [PATCH 3/4] cfg80211: Allow user space to specify non-IEs to SAE Authentication Jouni Malinen
@ 2012-09-30 16:29 ` Jouni Malinen
  2012-10-01  7:47 ` [PATCH 0/4] cfg80211/mac80211: Station mode SAE Johannes Berg
  4 siblings, 0 replies; 6+ messages in thread
From: Jouni Malinen @ 2012-09-30 16:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Jouni Malinen

SAE uses two rounds of Authentication frames and both rounds require
considerable calculation to be done. This commit extends the existing
station mode authentication request to allow more control for user
space programs to build the SAE fields and to run the authentication
step ones. Only the second round with authentication transaction
sequence 2 will result in moving to authenticated state.

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 net/mac80211/ieee80211_i.h |    5 +++--
 net/mac80211/main.c        |    1 +
 net/mac80211/mlme.c        |   43 ++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 42 insertions(+), 7 deletions(-)

Index: wireless-testing/net/mac80211/ieee80211_i.h
===================================================================
--- wireless-testing.orig/net/mac80211/ieee80211_i.h	2012-09-30 19:16:52.591842581 +0300
+++ wireless-testing/net/mac80211/ieee80211_i.h	2012-09-30 19:16:59.375842452 +0300
@@ -378,8 +378,9 @@ struct ieee80211_mgd_auth_data {
 	u8 key_len, key_idx;
 	bool done;
 
-	size_t ie_len;
-	u8 ie[];
+	u16 sae_trans, sae_status;
+	size_t data_len;
+	u8 data[];
 };
 
 struct ieee80211_mgd_assoc_data {
Index: wireless-testing/net/mac80211/main.c
===================================================================
--- wireless-testing.orig/net/mac80211/main.c	2012-09-30 19:16:51.227842607 +0300
+++ wireless-testing/net/mac80211/main.c	2012-09-30 19:16:59.375842452 +0300
@@ -585,6 +585,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
 		wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 
 	wiphy->features = NL80211_FEATURE_SK_TX_STATUS |
+			  NL80211_FEATURE_SAE |
 			  NL80211_FEATURE_HT_IBSS;
 
 	if (!ops->set_key)
Index: wireless-testing/net/mac80211/mlme.c
===================================================================
--- wireless-testing.orig/net/mac80211/mlme.c	2012-09-30 19:16:55.831842519 +0300
+++ wireless-testing/net/mac80211/mlme.c	2012-09-30 19:16:59.375842452 +0300
@@ -1877,6 +1877,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
 	case WLAN_AUTH_OPEN:
 	case WLAN_AUTH_LEAP:
 	case WLAN_AUTH_FT:
+	case WLAN_AUTH_SAE:
 		break;
 	case WLAN_AUTH_SHARED_KEY:
 		if (ifmgd->auth_data->expected_transaction != 4) {
@@ -1896,6 +1897,15 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
 	ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
 	run_again(ifmgd, ifmgd->auth_data->timeout);
 
+	if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE &&
+	    ifmgd->auth_data->expected_transaction != 2) {
+		/*
+		 * Report auth frame to user space for processing since another
+		 * round of Authentication frames is still needed.
+		 */
+		return RX_MGMT_CFG80211_RX_AUTH;
+	}
+
 	/* move station state to auth */
 	mutex_lock(&sdata->local->sta_mtx);
 	sta = sta_info_get(sdata, bssid);
@@ -2708,13 +2718,23 @@ static int ieee80211_probe_auth(struct i
 	drv_mgd_prepare_tx(local, sdata);
 
 	if (auth_data->bss->proberesp_ies) {
+		u16 trans = 1;
+		u16 status = 0;
+
 		sdata_info(sdata, "send auth to %pM (try %d/%d)\n",
 			   auth_data->bss->bssid, auth_data->tries,
 			   IEEE80211_AUTH_MAX_TRIES);
 
 		auth_data->expected_transaction = 2;
-		ieee80211_send_auth(sdata, 1, auth_data->algorithm, 0,
-				    auth_data->ie, auth_data->ie_len,
+
+		if (auth_data->algorithm == WLAN_AUTH_SAE) {
+			trans = auth_data->sae_trans;
+			status = auth_data->sae_status;
+			auth_data->expected_transaction = trans;
+		}
+
+		ieee80211_send_auth(sdata, trans, auth_data->algorithm, status,
+				    auth_data->data, auth_data->data_len,
 				    auth_data->bss->bssid,
 				    auth_data->bss->bssid, NULL, 0, 0);
 	} else {
@@ -3268,19 +3288,32 @@ int ieee80211_mgd_auth(struct ieee80211_
 	case NL80211_AUTHTYPE_NETWORK_EAP:
 		auth_alg = WLAN_AUTH_LEAP;
 		break;
+	case NL80211_AUTHTYPE_SAE:
+		auth_alg = WLAN_AUTH_SAE;
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}
 
-	auth_data = kzalloc(sizeof(*auth_data) + req->ie_len, GFP_KERNEL);
+	auth_data = kzalloc(sizeof(*auth_data) + req->sae_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;
+		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;
+	}
 	if (req->ie && req->ie_len) {
-		memcpy(auth_data->ie, req->ie, req->ie_len);
-		auth_data->ie_len = req->ie_len;
+		memcpy(&auth_data->data[auth_data->data_len],
+		       req->ie, req->ie_len);
+		auth_data->data_len += req->ie_len;
 	}
 
 	if (req->key && req->key_len) {


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] cfg80211/mac80211: Station mode SAE
  2012-09-30 16:29 [PATCH 0/4] cfg80211/mac80211: Station mode SAE Jouni Malinen
                   ` (3 preceding siblings ...)
  2012-09-30 16:29 ` [PATCH 4/4] mac80211: Allow station mode SAE to be implemented in user space Jouni Malinen
@ 2012-10-01  7:47 ` Johannes Berg
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2012-10-01  7:47 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless

On Sun, 2012-09-30 at 19:29 +0300, Jouni Malinen wrote:
> This series adds support to allow simultaneous authentication of equals
> (SAE) to be implemented in station mode with user space SME.

Applied, thanks. I made a change to the cfg80211/nl80211 patch to avoid
allowing SAE to be configured for connect/start-ap, please verify:
http://p.sipsolutions.net/0d315cdfcd0c447d.txt

johannes



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-01  7:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-30 16:29 [PATCH 0/4] cfg80211/mac80211: Station mode SAE Jouni Malinen
2012-09-30 16:29 ` [PATCH 1/4] mac80211: Take status code as parameter to ieee80211_send_auth Jouni Malinen
2012-09-30 16:29 ` [PATCH 2/4] mac80211: Add debug print on unexpect authentication state Jouni Malinen
2012-09-30 16:29 ` [PATCH 3/4] cfg80211: Allow user space to specify non-IEs to SAE Authentication Jouni Malinen
2012-09-30 16:29 ` [PATCH 4/4] mac80211: Allow station mode SAE to be implemented in user space Jouni Malinen
2012-10-01  7:47 ` [PATCH 0/4] cfg80211/mac80211: Station mode SAE Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).