cfg80211/mac80211: Station mode SAE
Subsystems (2)
cover cfg80211/mac80211: Station mode SAE
This series adds support to allow simultaneous authentication of equals (SAE) to be implemented in station mode with user space SME.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
PATCH 1/4 mac80211: Take status code as parameter to ieee80211_send_auth
Non-zero status code may be needed for Authentication frames, e.g., when using SAE.
--- 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(-)
net/mac80211/ibss.c +2 -2
@@ -279,7 +279,7 @@ static struct sta_info *ieee80211_ibss_fibss_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 ); }
net/mac80211/ieee80211_i.h +1 -1
@@ -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,
net/mac80211/mlme.c +2 -2
@@ -1824,7 +1824,7 @@ static void ieee80211_auth_challenge(strreturn ; 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 );
net/mac80211/util.c +2 -2
@@ -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 ieee8021memcpy (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);
PATCH 2/4 mac80211: Add debug print on unexpect authentication state
In reply to Jouni MalinenThis is useful when debugging authentication process issues.
--- net/mac80211/mlme.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +6 -1
@@ -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",
PATCH 3/4 cfg80211: Allow user space to specify non-IEs to SAE Authentication
In reply to Jouni MalinenSAE 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.
--- 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(-)
include/linux/nl80211.h +11 -0
@@ -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, };/**
include/net/cfg80211.h +5 -0
@@ -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; };/**
net/wireless/core.h +4 -2
@@ -320,13 +320,15 @@ int __cfg80211_mlme_auth(struct cfg80211const 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,
net/wireless/mlme.c +8 -3
@@ -273,7 +273,8 @@ int __cfg80211_mlme_auth(struct cfg80211const 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_rwdev_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);
net/wireless/nl80211.c +18 -3
@@ -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 sstruct 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 sif (!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 sreturn 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,
net/wireless/sme.c +1 -1
@@ -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 ;
PATCH 4/4 mac80211: Allow station mode SAE to be implemented in user space
In reply to Jouni MalinenSAE 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.
--- net/mac80211/ieee80211_i.h | 5 +++-- net/mac80211/main.c | 1 + net/mac80211/mlme.c | 43 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 7 deletions(-)
net/mac80211/ieee80211_i.h +3 -2
@@ -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 {
net/mac80211/main.c +1 -0
@@ -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)
net/mac80211/mlme.c +38 -5
82 lines not on this page · raw message
Quoted 2 lines · Jouni Malinen
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