From patchwork Tue Jul 23 07:09:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 814115 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 0644814AD17 for ; Tue, 23 Jul 2024 07:10:26 +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=1721718628; cv=none; b=vBV2v6OguLBZ0OGacR9EhWRVUDRW2N4TagGhOD+3AjcyfTpNj+ICNeU0jckkbQeDd0Hf5aL1qwr1ujq/aliT5u8mc88utrxtWrApyfwxSSA6NB3NjGUYMpJBS4tJHc2q7Eo5n9ODIdWuk9rzF3KU7cNNDa0/QEbXjhf/r2jUsEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721718628; c=relaxed/simple; bh=QmS7JHS06iertVy0YmtRPh7GDbMg8jJY5k7oJSyn3Xo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BpW4sSq9qU11JWUDmaMpj6BFUYnitOVtRZWjMcUztkSoNPkm+5CBoPUx1vIVM6I/YzFvUTBYgA6tAAG39czM48zzX/wYGX0ZnColeBUMlR8dIQXZBhXLMpiJKcgt9QdRZXBtFAqt0/QNveTARinrMRSvp+wpVZg0QmUECqP2Wj8= 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 1sW9ev-0007O6-Fv; Tue, 23 Jul 2024 09:10:05 +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 1sW9et-001ZAX-Jp; Tue, 23 Jul 2024 09:10:03 +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 1sW9et-00FQKO-1i; Tue, 23 Jul 2024 09:10:03 +0200 From: Sascha Hauer Date: Tue, 23 Jul 2024 09:09:57 +0200 Subject: [PATCH v3 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: <20240723-mwifiex-wpa-psk-sha256-v3-1-025168a91da1@pengutronix.de> References: <20240723-mwifiex-wpa-psk-sha256-v3-0-025168a91da1@pengutronix.de> In-Reply-To: <20240723-mwifiex-wpa-psk-sha256-v3-0-025168a91da1@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=1721718603; l=2282; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=QmS7JHS06iertVy0YmtRPh7GDbMg8jJY5k7oJSyn3Xo=; b=kwSxTmAubnuT2s/iYia1FUhdmFL24Al7GcqgDf6ovcbp0filaHJlIkFTlLRuyZCVzHSVwO+EW bzH4X0Oh+UCABsWvCQeo+4nmhdQnVgX7YcgyFugaK1Nw4YNMVWxJh4y 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 Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 28 ++++++++------------------ 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 491e366119096..7f822660fd955 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -46,31 +46,19 @@ 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; default: break; From patchwork Tue Jul 23 07:09:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 814340 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 C3C3714A62B for ; Tue, 23 Jul 2024 07:10:19 +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=1721718621; cv=none; b=FxnHLZb2CnI9whN4uIbY04PuzBD8dkpv8oCZuG1RB28+vZR7ZWx4RFHF1LnHAbvKM/ngLqmOPtCeJmIdbRQBiRf/+XKCznK4p0a1xKEruU0rqlxrlgnw2SMO3foeS5a3lwxgn5eUDL4KzSKhtSLbVyg6uc3RmyUl825bZqQZmWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721718621; c=relaxed/simple; bh=wzn/r/5WRn+jiDnO4sEyQ2Ina1Q4p7Vzlb7yDTY/sSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FYwlODqeYJpr10qUGyHrfa6Qqdl6MpLUtAdGJ104FQ0C7MS6Rf+gdHw0fWQ7yRX+XsgEM2rCuYD2gNbxwRXSz/2ZrCIEevz8gKsKNxBMtNi9C+mndP5fZrcAIRTn7T9RLjcJXi12Duao8k6dEIqJLoe2lS44oT4vie0eWx/j+KA= 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 1sW9ev-0007O8-Fu; Tue, 23 Jul 2024 09:10:05 +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 1sW9et-001ZAY-K6; Tue, 23 Jul 2024 09:10:03 +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 1sW9et-00FQKO-1j; Tue, 23 Jul 2024 09:10:03 +0200 From: Sascha Hauer Date: Tue, 23 Jul 2024 09:09:58 +0200 Subject: [PATCH v3 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: <20240723-mwifiex-wpa-psk-sha256-v3-2-025168a91da1@pengutronix.de> References: <20240723-mwifiex-wpa-psk-sha256-v3-0-025168a91da1@pengutronix.de> In-Reply-To: <20240723-mwifiex-wpa-psk-sha256-v3-0-025168a91da1@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: David Lin , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1721718603; l=1724; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=wzn/r/5WRn+jiDnO4sEyQ2Ina1Q4p7Vzlb7yDTY/sSc=; b=AxKGRepMpo0W0EVZ8c2FWJEiZslEtRkvmjjz/rUcNIdnSOYfifcSBpFb54Iu9i54J5pKUJA2W HXe+VeGpYSzA5pEdISkIiliHPg9LAcaDgyEbTqi4QriqoahNW0ff+JS 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 safe the reader from following the code path. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 7f822660fd955..57280eaae483c 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -52,13 +52,14 @@ 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; default: break; From patchwork Tue Jul 23 07:09:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 814116 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 1682114A635 for ; Tue, 23 Jul 2024 07:10:11 +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=1721718615; cv=none; b=a2SeEMg+Y8ZABt03FCXLGCiXl9TyQQCAiTDsGacgO9kwWC+rOu5NdnmLZlANaQ1WjmL7Nz0UkcGOBtxXnFaq1S0e5nYGSSXzNKcHoTN3Dc4slm+VPitFZjnn0RbGS0qa3CsF+l6eSjRppP0sR/tI4JsWa6atGwnFI2guQj6SLAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721718615; c=relaxed/simple; bh=pnxVQ5yr/CRNk0Q3YV7hR7PaOobue4/QloO+PAOzCtY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZxIKDmCN/urnZP9i56aSYsuS0wrVThR4Mw6BNOxc4imMI72DaMjYIxrWGgCxOBasUxoRX4R7TKo99KIjYhBmdScwMAGT7sVSqSgbPx0HlstYmMublmGC0rlY0IQN2c5ZA2tjtzYBNO5sR7MKk7Vnklu9r+O5HpeLjuG/sU/gGOg= 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 1sW9ev-0007O9-Fu; Tue, 23 Jul 2024 09:10:05 +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 1sW9et-001ZAZ-Kj; Tue, 23 Jul 2024 09:10:03 +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 1sW9et-00FQKO-1k; Tue, 23 Jul 2024 09:10:03 +0200 From: Sascha Hauer Date: Tue, 23 Jul 2024 09:09:59 +0200 Subject: [PATCH v3 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: <20240723-mwifiex-wpa-psk-sha256-v3-3-025168a91da1@pengutronix.de> References: <20240723-mwifiex-wpa-psk-sha256-v3-0-025168a91da1@pengutronix.de> In-Reply-To: <20240723-mwifiex-wpa-psk-sha256-v3-0-025168a91da1@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=1721718603; l=1708; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=pnxVQ5yr/CRNk0Q3YV7hR7PaOobue4/QloO+PAOzCtY=; b=+s253rV1R1j2Y94P5EQGcxcd7m59W4yRcFQZQZ3kTcXVBtRqTKkC1PC4iAscBTIYoghcUv+Ai SsbhvbruHHnAIz2QEoWb2SaOkdvHZeAP5+m7FJJUHo1WQrkCUtdcD0O 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 Signed-off-by: Sascha Hauer Acked-by: Brian Norris --- 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 3adc447b715f6..1c76754b616ff 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -415,6 +415,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 CIPHER_TKIP 0x04 #define CIPHER_AES_CCMP 0x08 #define VALID_CIPHER_BITMAP 0x0c diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 57280eaae483c..3888c7a86876c 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; default: break; }