From patchwork Fri Feb 9 13:50:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinayak Yadawad X-Patchwork-Id: 771817 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EF9B3C099 for ; Fri, 9 Feb 2024 13:45:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707486325; cv=none; b=aAWgY6Edql6ZUz7NKjPlxOhD0vR9W4EqlfGPSir2GlwEVnkfsNWsrusMWnCAt6nsbf+gh+HS3a+jC54cZbfbMkhpGdZK4MezrUkWf4CzZhf7RiZdsDktTr8Aa3xkv1joZYcNZ5KsuuGSjiXGCk8O5MBZKD5rgfzuxsnhoNnsTdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707486325; c=relaxed/simple; bh=O7ExEhOfreOhKikgsOgxHOgUH/7a0r/6CmnFs2T6wEo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=SkcYQdDpa7WgZq4ef8dL3DGiXhfZcp47TPuoHBmoUJALyxSz2mJnTVon6LdYTywlSCIJha7rnpjeV1Gh45CfQ1Hm2osHjWU5s9zxTNirIwzLpThVfyJmTA7tskL5qYM6nhn7nCy2q3EJhwuN14oA1QaYcfkih5JOhoLM+1CnfTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=TdU+ZSys; arc=none smtp.client-ip=209.85.222.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="TdU+ZSys" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-783f3d27bfbso41218085a.2 for ; Fri, 09 Feb 2024 05:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1707486323; x=1708091123; darn=vger.kernel.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=wjGCK4lgpy/0QQ/lFE2vHUo6oRVe9mteXFl8otNH7i8=; b=TdU+ZSyspbfNMV75//vQfrKgyoNhqBxPOuyk/a18ZBEdobclHLXfD9x3JOVBacKS1x QmH7TOVciqgEXKSYSHEM7pHrkxRcy0YdO77q+AUOgWeuUplqRz4mqc1Op+tc9skb9I2J LFjgTIL8owXca4x4AbmbMv58I1m7sqHhHUlIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707486323; x=1708091123; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wjGCK4lgpy/0QQ/lFE2vHUo6oRVe9mteXFl8otNH7i8=; b=EY2R428bmnbV5UeFMY4sgo69BPSMuUN+UTKB0amOQ4QLqu0gQSBQ3uete+rK8/nJpF jDSb2qH9Pw6R9IIaP4lUHdLBV+w/54DR2YFDuHFnrpcHjlmZTODvovIF12v6bKARTsIJ q9AYjjsdqHSJuBz8l9mkPkonik0+nXcHyGGnIqgxUWk/lEZYWVLfjsPuNgH7g7Yen9Ac /8cCm+S9Hnoa33WmW1xg+G6TqQYZx74heVx4WmuuTVb2WYTXJYjxZkFaDsFqYWSf36cv haUjbKLm6phtt9f+9JTHxy2AnOzE+WF5XojFaDTHzKkB8nxvWOB7u5cbMZ0heC1wONVH /UEw== X-Gm-Message-State: AOJu0YylK69jtuAnWYFIDmxPbuaQCv0WrVlPQTIs+0mLIMbD0HMtO972 4D8XAGHaGen6gUJB/SPI3tloyZcaNCgNY3N2BeHcgviOr0W3ddczy2CjJK9D0w== X-Google-Smtp-Source: AGHT+IHvMs+FHIzq2AZspOOV3PVKPJ09r60srJMtnF2wYlmsJpEfxYPTLj5XGIjAkxyV18cHQjkGvA== X-Received: by 2002:a05:620a:2287:b0:785:74f5:62c6 with SMTP id o7-20020a05620a228700b0078574f562c6mr1436159qkh.75.1707486322816; Fri, 09 Feb 2024 05:45:22 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVLWn7VXT2a4ntW4EW8XSZSiPaqHQBujPWVhlnU9JAS9wVDtazwNZgBADEwrKcPEoqlNunhhwO/SGGRg99IeskmjpzSgHng9ct7wEjEN1kcmNTMf4E5o39ODY/nFZkJiOMP4zVJhpQ= Received: from hnd.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id bq42-20020a05620a46aa00b00783fed2e88fsm730598qkb.20.2024.02.09.05.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 05:45:22 -0800 (PST) From: Vinayak Yadawad To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, jithu.jance@broadcom.com, Vinayak Yadawad Subject: [PATCH 1/1] wifi: nl80211: Add support for plumbing SAE groups to driver Date: Fri, 9 Feb 2024 19:20:43 +0530 Message-Id: <309965e8ef4d220053ca7e6bd34393f892ea1bb8.1707486287.git.vinayak.yadawad@broadcom.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In case of SAE authentication offload, the driver would need the info of SAE DH groups for both STA connection and soft AP. In the current change we update the SAE DH group support info to driver in the order/priority as provided by the supplicant/ upper layer. Signed-off-by: Vinayak Yadawad --- include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 7 +++++++ net/wireless/nl80211.c | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 5b42bfc..0b2db0d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1194,6 +1194,7 @@ struct survey_info { }; #define CFG80211_MAX_NUM_AKM_SUITES 10 +#define CFG80211_MAX_NUM_SAE_DH_GROUPS 10 /** * struct cfg80211_crypto_settings - Crypto settings @@ -1235,6 +1236,9 @@ struct survey_info { * * NL80211_SAE_PWE_BOTH * Allow either hunting-and-pecking loop or hash-to-element + * + * @sae_dh_groups: SAE DH groups in preference order. + * @n_sae_dhd_groups: No of SAE DH groups assigned. */ struct cfg80211_crypto_settings { u32 wpa_versions; @@ -1252,6 +1256,8 @@ struct cfg80211_crypto_settings { const u8 *sae_pwd; u8 sae_pwd_len; enum nl80211_sae_pwe_mechanism sae_pwe; + u32 sae_dh_groups[CFG80211_MAX_NUM_SAE_DH_GROUPS]; + u8 n_sae_dh_groups; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 853ac53..7c1a7b4 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2855,6 +2855,11 @@ enum nl80211_commands { * %NL80211_CMD_ASSOCIATE indicating the SPP A-MSDUs * are used on this connection * + * @NL80211_ATTR_SAE_DH_GROUPS: Attribute to indicate the supported SAE DH + * groups to driver. For STA role, the dh groups should be tried in the + * indicated order. For AP role, the order does not have any specific + * significance. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3400,6 +3405,8 @@ enum nl80211_attrs { NL80211_ATTR_ASSOC_SPP_AMSDU, + NL80211_ATTR_SAE_DH_GROUPS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 68c2040..555eb0f 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -826,6 +826,7 @@ static int validate_he_capa(const struct nlattr *attr, [NL80211_ATTR_MLO_TTLM_DLINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), [NL80211_ATTR_MLO_TTLM_ULINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), [NL80211_ATTR_ASSOC_SPP_AMSDU] = { .type = NLA_FLAG }, + [NL80211_ATTR_SAE_DH_GROUPS] = { .type = NLA_NESTED }, }; /* policy for the key attributes */ @@ -10883,6 +10884,27 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, else settings->sae_pwe = NL80211_SAE_PWE_UNSPECIFIED; + if (info->attrs[NL80211_ATTR_SAE_DH_GROUPS]) { + struct nlattr *dh_group; + int tmp, i = 0; + + if (!wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_SAE_OFFLOAD) && + !wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_SAE_OFFLOAD_AP)) + return -EINVAL; + + nla_for_each_nested(dh_group, info->attrs[NL80211_ATTR_SAE_DH_GROUPS], + tmp) { + settings->sae_dh_groups[i] = nla_get_u32(dh_group); + i++; + + if (i == CFG80211_MAX_NUM_SAE_DH_GROUPS) + break; + } + settings->n_sae_dh_groups = i; + } + return 0; }