From nobody Thu Apr 20 16:08:45 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q2Mz20FLDz46FkR; Thu, 20 Apr 2023 16:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q2Mz13HKCz3CF8; Thu, 20 Apr 2023 16:08:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682006925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rto39X946MR4EdqjTQPmdY0oZl/ZXsyGbjpzMx/nRTo=; b=X1SkV+al8a8wPi6KvcI7KHBSaQr42HKA4Z8AkJrV/ukOQqFkNRe6o1rvnAmmqd7h9SdlXi eLoM/admchWxP1c/uNv9r3E02G9PZKHfs9KZyayppmf/03ZxhO5ci9m/KufFOWSEDYykXd EaSFYTTmwYokppl5QoVK1NE2NtC1zn7jSLxZQicxCJqHglplALWbJQ4A+UUEZasY6LISVC +1DbY4CZnNRp3wZu9Jwcfclh88iHGC78waQcIWtb9hXwVsWtwGlG0gMgpKGBesVQVKDUTL L7CEF9dor7Bn9kZmfTYCzV35z+NBf8Ielo6TzqIt5Qdc4mzBtq/T0ZORET7RMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682006925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rto39X946MR4EdqjTQPmdY0oZl/ZXsyGbjpzMx/nRTo=; b=kIHquwpavpCRqNg9i9EcM4fVFCClyz1PG/U8l3lfbOqrVTrHG44LmtK/Iafmtyg0YGytU0 KIIExLwcdNk8HEb+sE50gQ4l5hNsvjTTV8nn6Hn8nEZhWVZuyfPUtGl5HtBpiSfichQVkd inVX1NmK223nEkgKUqC08R2HVUBBFTEgrxQ14+VTfBFZEVtss/Tm0VMCI1eYupz3X61Xve Xtt6UiMQi9JqE2Gk3mi2uUvG+mAwyxt+AFJ0YKjSTBjRttDJSiR/KADaRlMmxIWQ1HVZ4u 1UKnv3H8YR7VJxmIYqs9nAzkNUmS7IqZyYznlHqDk7KJmcqz3G8Zxlgc4VfERg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682006925; a=rsa-sha256; cv=none; b=xlcgnHPn/iWn9g1Fun/vk4iHlsS7yKVE4uguN68miYky3WutYScMTzQFHiQuWbdZhcKRIJ eicVI85xQVh0sMYt2OPhEGC0IBijQokOcpVubM8ocXMuoeHVIQCwcuBQZW3Z5zJjN0dtjm umNBLzZrm88AC3BDbq35K/qv6xfN6QphAndgUmK66J5v2VfY7aZhDv2Pl0MbJyXLEn9KVB l07vIQ+uTNqROSBK/oKd00lXCl8r+syKhBelSXYo1N0UJ3WIMvk8LHHW2gYKB5zr08sh2x kyG+KnPUjHwgXiD/fvhniT931bpGag+73jqYXL9GvgsJHwDiHbFJnUMGBdyorw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q2Mz10yN8zk1G; Thu, 20 Apr 2023 16:08:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33KG8jAr029092; Thu, 20 Apr 2023 16:08:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33KG8jad029091; Thu, 20 Apr 2023 16:08:45 GMT (envelope-from git) Date: Thu, 20 Apr 2023 16:08:45 GMT Message-Id: <202304201608.33KG8jad029091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 35f7fa4ac1ae - main - LinuxKPI: 802.11: improve assertion and tkip code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35f7fa4ac1aea8af9a4f2428b3f0a346151b4071 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=35f7fa4ac1aea8af9a4f2428b3f0a346151b4071 commit 35f7fa4ac1aea8af9a4f2428b3f0a346151b4071 Author: Bjoern A. Zeeb AuthorDate: 2023-04-20 16:01:05 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-04-20 16:07:50 +0000 LinuxKPI: 802.11: improve assertion and tkip code Move a KASSERT out of a function and make it a CTASSERT with appropriate comments. Skeleton implement two tkip functions, still left TODO, initializing variables with dummy values to quiten compiler warnings. It is unclear to me if we should still ever properly implement TKIP compat code at this point. If so the current code gives a good idea what needs to be done in addition to allocating references to real state along with keyconf. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/net/mac80211.h | 38 ++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 1fcee420232c..77045f866e8b 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1756,6 +1756,11 @@ ieee80211_tu_to_usec(unsigned long tu) return (tu * IEEE80211_DUR_TU); } +/* + * Below we assume that the two values from different emums are the same. + * Make sure this does not accidentally change. + */ +CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP); static __inline bool ieee80211_action_contains_tpc(struct sk_buff *skb) @@ -1783,10 +1788,10 @@ ieee80211_action_contains_tpc(struct sk_buff *skb) mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT) return (false); - /* Check that it is TPC Report or Link Measurement Report? */ - KASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP, - ("%s: SM_TPCREP %d != RADIO_MEASUREMENT_LMREP %d\n", __func__, - IEEE80211_ACTION_SM_TPCREP, IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP)); + /* + * Check that it is TPC Report or Link Measurement Report? + * The values of each are the same (see CTASSERT above function). + */ if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP) return (false); @@ -1834,7 +1839,12 @@ static __inline void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, const u8 *addr, uint32_t iv32, u16 *p1k) { + + KASSERT(keyconf != NULL && addr != NULL && p1k != NULL, + ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k)); + TODO(); + memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */ } static __inline size_t @@ -2051,7 +2061,27 @@ static __inline void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid, struct ieee80211_key_seq *seq) { + + KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n", + __func__, keyconf, seq)); + TODO(); + switch (keyconf->cipher) { + case WLAN_CIPHER_SUITE_CCMP: + case WLAN_CIPHER_SUITE_CCMP_256: + memset(seq->ccmp.pn, 0xfa, sizeof(seq->ccmp.pn)); /* XXX TODO */ + break; + case WLAN_CIPHER_SUITE_AES_CMAC: + memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */ + break; + case WLAN_CIPHER_SUITE_TKIP: + seq->tkip.iv32 = 0xfa; /* XXX TODO */ + seq->tkip.iv16 = 0xfa; /* XXX TODO */ + break; + default: + pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher); + break; + } } static __inline void