From patchwork Mon Aug 5 06:39:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 818077 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A457914BF9B for ; Mon, 5 Aug 2024 06:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722839991; cv=none; b=vFCnSrN8jIXpZjpUf4PM3hzWBOPvZ9uzKqJyraP40Yv3Wr73za67uAmrOt7unZQ/vh7DJy0VkO/jqZIQ75OexcU6Atrb3PMeE1jjZUjafFVXUwbGH8bI4tUJ/vEYrra45xofNchLcFqmUe3qzOW6NUs1+CKWtc3dM9ash09UpLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722839991; c=relaxed/simple; bh=TRNV4ubhHsipr5Lxr2FdSIUdP/KKJtbCJAZmfctiF4Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Dv5R2yng4v775Hdzg0y/U7Lh4txESWQmsEWYR5ABTRbpukaLr6Fxr/AIvcS2Owmdrl+fhib/uRhoMmUjiqlSB4ORyW4ZoqRDifDSEACN28mawvuRYDl1/ysH1E7aEGtjQediuoixhnO0mIgoNBiWL8zC37EcvLblBl/FgigQpgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sarNI-00039D-Ri; Mon, 05 Aug 2024 08:39:20 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sarNH-004e48-Lv; Mon, 05 Aug 2024 08:39:19 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sarNH-000M8i-1u; Mon, 05 Aug 2024 08:39:19 +0200 From: Sascha Hauer Date: Mon, 05 Aug 2024 08:39:13 +0200 Subject: [PATCH v4 1/3] wifi: mwifiex: simplify WPA flags setting Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240805-mwifiex-wpa-psk-sha256-v4-1-e1eee80508e6@pengutronix.de> References: <20240805-mwifiex-wpa-psk-sha256-v4-0-e1eee80508e6@pengutronix.de> In-Reply-To: <20240805-mwifiex-wpa-psk-sha256-v4-0-e1eee80508e6@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: David Lin , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722839959; l=2494; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=TRNV4ubhHsipr5Lxr2FdSIUdP/KKJtbCJAZmfctiF4Q=; b=GYFCkxAE6as6SqgEl/9NTLCApcbnGmffMLnyQBKtPWFTXqcotgzimMecxgDreERiaXmSi98vc aVQTtD02+0rCJ3eCtmpf5s5maXaMvxOKr4AQt0+WlOUdGMplp+BfPKR X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The WPA flags setting only depends on the wpa_versions bitfield and not on the AKM suite, so move it out of the switch/case to simplify the code a bit. Also set bss_config->protocol to zero explicitly. This is done only to make the code clearer, bss_config has been zero alloced by the caller, so should be zero already. No functional change intended. Reviewed-by: Francesco Dolcini Acked-by: Brian Norris Link: https://lore.kernel.org/r/20240723-mwifiex-wpa-psk-sha256-v3-1-025168a91da1@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 29 +++++++------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 073c665183b30..51fcae8726ed0 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -46,34 +46,21 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, bss_config->key_mgmt_operation |= KEY_MGMT_ON_HOST; + bss_config->protocol = 0; + if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) + bss_config->protocol |= PROTOCOL_WPA; + if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) + bss_config->protocol |= PROTOCOL_WPA2; + for (i = 0; i < params->crypto.n_akm_suites; i++) { switch (params->crypto.akm_suites[i]) { case WLAN_AKM_SUITE_8021X: - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_1) { - bss_config->protocol = PROTOCOL_WPA; - bss_config->key_mgmt = KEY_MGMT_EAP; - } - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_2) { - bss_config->protocol |= PROTOCOL_WPA2; - bss_config->key_mgmt = KEY_MGMT_EAP; - } + bss_config->key_mgmt = KEY_MGMT_EAP; break; case WLAN_AKM_SUITE_PSK: - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_1) { - bss_config->protocol = PROTOCOL_WPA; - bss_config->key_mgmt = KEY_MGMT_PSK; - } - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_2) { - bss_config->protocol |= PROTOCOL_WPA2; - bss_config->key_mgmt = KEY_MGMT_PSK; - } + bss_config->key_mgmt = KEY_MGMT_PSK; break; case WLAN_AKM_SUITE_SAE: - bss_config->protocol = PROTOCOL_WPA2; bss_config->key_mgmt = KEY_MGMT_SAE; break; default: From patchwork Mon Aug 5 06:39:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 817025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DBBD146D79 for ; Mon, 5 Aug 2024 06:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722839983; cv=none; b=DkzTwdsZRSdTN+OOyev4PgXtG4CVo8pLTy4pK58ocWazpdu8ZFe7FgbhtYOT96tvn6KHDEv0L3JvU0NiNfbhumXkvIo/pAmpCo3IytEmO5aeGwWwZ2Soz8W13X23rw3tvzV+tjHibfluOfmjEn+NAdni6QKjX+YTmk0f2ZFDVps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722839983; c=relaxed/simple; bh=8xROGRY7f/VoLCybDt94w0BGHi2D02d5jGFRhfXMhlc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GaBstLAKqMppVKV6oT+p0tIHzbc0By332cpr38cxrq7IobEhMnFvxp9p0nJnnYSWv+SDDRHFY91U6duJgqNY06Y8C8gnZDOV3cTTlgUsUHjL/SlEr8tGAPwyj6z/TSugRbVRa9xRGIJ6Meef9LRJBNOELAa2uHM2ttUq0Wa13PQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sarNI-00039E-Rh; Mon, 05 Aug 2024 08:39:20 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sarNH-004e49-MI; Mon, 05 Aug 2024 08:39:19 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sarNH-000M8i-1v; Mon, 05 Aug 2024 08:39:19 +0200 From: Sascha Hauer Date: Mon, 05 Aug 2024 08:39:14 +0200 Subject: [PATCH v4 2/3] wifi: mwifiex: fix key_mgmt setting Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240805-mwifiex-wpa-psk-sha256-v4-2-e1eee80508e6@pengutronix.de> References: <20240805-mwifiex-wpa-psk-sha256-v4-0-e1eee80508e6@pengutronix.de> In-Reply-To: <20240805-mwifiex-wpa-psk-sha256-v4-0-e1eee80508e6@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: David Lin , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722839959; l=2065; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=8xROGRY7f/VoLCybDt94w0BGHi2D02d5jGFRhfXMhlc=; b=zq+SceW6JZDRBXhBD9qPbbb6tzjLIwDMgrK/4dAyCjZdXynyKM68rV9lTAik7EsCaohtDrLg8 kTK6pgENcazAXRfEKgcJUzixPafb26OIROxJx3uBPI8WBEk2Z6wOriO X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org bss_config->key_mgmt specifies the AKM suites that are usable in hardware. This variable is set to specific values while iterating over the advertised AKM suites. This means the final value of the variable depends on the order of the entries in the AKM suites array. Instead of setting the variable, just set the relevant bits in the key_mgmt bit field to make us independent of the order of entries. This behaviour is derived from the downstream driver that does the same. Also, set bss_config->key_mgmt to zero explicitly right before the loop. bss_config has been zero allocated by the caller already, but do so again to save the reader from following the code path. Reviewed-by: Francesco Dolcini Acked-by: Brian Norris Link: https://lore.kernel.org/r/20240723-mwifiex-wpa-psk-sha256-v3-2-025168a91da1@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 51fcae8726ed0..7214b6cf304a9 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -52,16 +52,17 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) bss_config->protocol |= PROTOCOL_WPA2; + bss_config->key_mgmt = 0; for (i = 0; i < params->crypto.n_akm_suites; i++) { switch (params->crypto.akm_suites[i]) { case WLAN_AKM_SUITE_8021X: - bss_config->key_mgmt = KEY_MGMT_EAP; + bss_config->key_mgmt |= KEY_MGMT_EAP; break; case WLAN_AKM_SUITE_PSK: - bss_config->key_mgmt = KEY_MGMT_PSK; + bss_config->key_mgmt |= KEY_MGMT_PSK; break; case WLAN_AKM_SUITE_SAE: - bss_config->key_mgmt = KEY_MGMT_SAE; + bss_config->key_mgmt |= KEY_MGMT_SAE; break; default: break; From patchwork Mon Aug 5 06:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 818078 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68C081E4B2 for ; Mon, 5 Aug 2024 06:39:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722839977; cv=none; b=ElezzkcD5gStRzrznS1OEzbZBydEWuQaCWMWYw8oFvrd+4NUNj/3+KrHj6YhOMufWH5nFKtCnl7cNHT7AE8FkWlZ/02lU0V1RtEh35TqzaffsI25pCf5oD0/ztl5d8c0APgYpzcmjevYuqsIwo/EoXXXR9yfO9Ve00vKzPhKl9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722839977; c=relaxed/simple; bh=rDHqS/kVURL2gTGl82KO6UdTC3NaPTLnwlW/E1+VadU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bBZqeL76kaH4HqMRViXCL0R15LDbUufncgOZRzLgkhveqTJ76gzK+NvDWGyi7QpLhcBsWPUR5njCJhvdrzGMO9CoG3xVva5oB+3riuYD6QyouFtM/yZWWw1Vxk4obRnAms9O3M/m1utypaHl0pAaJEy4fDJwthrWfFwMLQq/afE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sarNI-00039F-Rh; Mon, 05 Aug 2024 08:39:20 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sarNH-004e4A-MS; Mon, 05 Aug 2024 08:39:19 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sarNH-000M8i-1w; Mon, 05 Aug 2024 08:39:19 +0200 From: Sascha Hauer Date: Mon, 05 Aug 2024 08:39:15 +0200 Subject: [PATCH v4 3/3] wifi: mwifiex: add support for WPA-PSK-SHA256 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240805-mwifiex-wpa-psk-sha256-v4-3-e1eee80508e6@pengutronix.de> References: <20240805-mwifiex-wpa-psk-sha256-v4-0-e1eee80508e6@pengutronix.de> In-Reply-To: <20240805-mwifiex-wpa-psk-sha256-v4-0-e1eee80508e6@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: David Lin , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722839959; l=1911; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=rDHqS/kVURL2gTGl82KO6UdTC3NaPTLnwlW/E1+VadU=; b=WwHZbWKf8ooh/sB3mfP82ij81YNBAXRGXGjJIzMOkyWhpmpCJ6vSa4/Ppn7fXm/IfKe0IzQJp lvvG/fxjRo7CQvHOSf3Bj7JKsB/EncbCwrVBlO+xucpw+iBLy3QuczV X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org This adds support for the WPA-PSK AKM suite with SHA256 as hashing method (WPA-PSK-SHA256). Tested with a wpa_supplicant provided AP using key_mgmt=WPA-PSK-SHA256. Reviewed-by: Francesco Dolcini Link: https://lore.kernel.org/r/20240717-mwifiex-wpa-psk-sha256-v2-2-eb53d5082b62@pengutronix.de Acked-by: Brian Norris Link: https://lore.kernel.org/r/20240723-mwifiex-wpa-psk-sha256-v3-3-025168a91da1@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/fw.h | 1 + drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index 65799ae3bc723..e91def0afa14d 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -419,6 +419,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { #define KEY_MGMT_NONE 0x04 #define KEY_MGMT_PSK 0x02 #define KEY_MGMT_EAP 0x01 +#define KEY_MGMT_PSK_SHA256 0x100 #define KEY_MGMT_SAE 0x400 #define CIPHER_TKIP 0x04 #define CIPHER_AES_CCMP 0x08 diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 7214b6cf304a9..1c0ceac6b27fb 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -61,6 +61,9 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, case WLAN_AKM_SUITE_PSK: bss_config->key_mgmt |= KEY_MGMT_PSK; break; + case WLAN_AKM_SUITE_PSK_SHA256: + bss_config->key_mgmt |= KEY_MGMT_PSK_SHA256; + break; case WLAN_AKM_SUITE_SAE: bss_config->key_mgmt |= KEY_MGMT_SAE; break;