Allow NL80211_ATTR_AUTH_DATA with FT authentication. The first FT message with the PQC AKM carries the PQC Parameter element, which is an Extended Length element and is therefore rejected in NL80211_ATTR_IE. In addition, allow NL80211_ATTR_EPP_PEER with FT authentication to indicate that the reassociation following it is encrypted. This requires the driver to support NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION. Signed-off-by: Ilan Peer --- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 15 +++++++++------ net/wireless/nl80211.c | 14 +++++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index c166f97dcf81..7ab99507724a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -3347,6 +3347,8 @@ static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id) * given an MLD address) by the driver * @ap_mld_addr: AP MLD address in case of authentication request with * an AP MLD, valid iff @link_id >= 0 + * @epp_peer: the AP is an EPP peer and the (re)association following the + * FT authentication is encrypted */ struct cfg80211_auth_request { struct cfg80211_bss *bss; @@ -3362,6 +3364,7 @@ struct cfg80211_auth_request { size_t auth_data_len; s8 link_id; const u8 *ap_mld_addr; + bool epp_peer; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 439a08654274..5373a1422883 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2460,11 +2460,12 @@ enum nl80211_commands { * 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. + * the frames (SAE and FILS) or that carry Extended Length elements + * (e.g., the PQC Parameter element with FT). 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) @@ -3201,7 +3202,9 @@ enum nl80211_commands { * the 1 MHz primary subchannel within that 2 MHz primary. * * @NL80211_ATTR_EPP_PEER: A flag attribute to indicate if the peer is an EPP - * STA. Used with %NL80211_CMD_NEW_STA and %NL80211_CMD_ADD_LINK_STA + * STA. Used with %NL80211_CMD_NEW_STA and %NL80211_CMD_ADD_LINK_STA. Also + * used with %NL80211_CMD_AUTHENTICATE for FT authentication to indicate + * that the following reassociation is encrypted. * * @NL80211_ATTR_UHR_CAPABILITY: UHR Capability information element (from * association request when used with NL80211_CMD_NEW_STATION). Can be set diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8a5c9dd9d0db..7912624728fd 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -13414,7 +13414,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) auth_type != NL80211_AUTHTYPE_FILS_SK_PFS && auth_type != NL80211_AUTHTYPE_FILS_PK && auth_type != NL80211_AUTHTYPE_EPPKE && - auth_type != NL80211_AUTHTYPE_IEEE8021X) + auth_type != NL80211_AUTHTYPE_IEEE8021X && + auth_type != NL80211_AUTHTYPE_FT) return -EINVAL; req.auth_data = nla_data(info->attrs[NL80211_ATTR_AUTH_DATA]); req.auth_data_len = nla_len(info->attrs[NL80211_ATTR_AUTH_DATA]); @@ -13429,6 +13430,17 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) if (local_state_change) return 0; + if (info->attrs[NL80211_ATTR_EPP_PEER]) { + if (auth_type != NL80211_AUTHTYPE_FT) + return -EINVAL; + + if (!wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION)) + return -EOPNOTSUPP; + + req.epp_peer = true; + } + req.auth_type = auth_type; req.key = key.p.key; req.key_len = key.p.key_len; -- 2.55.0