From nobody Mon Jun 26 12:08:39 2023 X-Original-To: dev-commits-src-branches@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 4QqRT41yLVz4k6qR; Mon, 26 Jun 2023 12:08:40 +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 4QqRT40ndFz3jNr; Mon, 26 Jun 2023 12:08:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781320; 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=72u1UJgySjk+b77ey6jlnNCaf4pXuvHWCgqUqHdb020=; b=bzIBZ4KFckQtArvYCMbSq/9rBN9+RbEcHdAYQhhXKWa5yCE7PYmD6DcPzWKVnieHEjq327 tYibbRMHNvdtNnrVzGpdAAN2kMMN3XWmhJXW7LkODHu6Glm8KfLtdUm9vR55BfeJV8yyIO U+v51fRxvYCypcy+OmWjWtbDK2YdVVfkDA1nrbgN2EfyinL3IzjD+hTKULt7qo2Kt571wS M71/IPBqfTr8EWDQtsNfGfHRs9u01kail8e/t2/pa3KJKQRsvjoFfEpWtJNokQI9+ivPwz Eh3AaruSgPqxA+kKUj1n35SzMwyZFTSISRvZM/kIzV2+WCkUISGfWFAmgrSvHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781320; 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=72u1UJgySjk+b77ey6jlnNCaf4pXuvHWCgqUqHdb020=; b=eiNgkOvBBlFzPqjOfUhGm7+bH05C1FEu2WOFQ1AIX/uWZlnnzf+OPCTi0uz3KOShy+u/6A Ir32C0hBZ0mEEO89Ev6s0rWaDP+bfeD/5IcXDVGSffQkbsT5xyIUyqT1kxpFMn/mgc3VHK f7LZxzRRglxRVfG6ttHQTpehPDWPA9/hrqHQq4Ufe5U4KizWhLgZHNRVFKl4JpnQG0CSkP z6NbxIvkRlq4xp+yKQnIFFz0i9L0UphR/Y1vnuMddJsDjOTpve14Az2vqpkmTomwpkSvTv nAxwTZog/wv55eG63wDTd9uoMrHyV19sIwHj4licwRxEaCoLNtTXOaNUl981lA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687781320; a=rsa-sha256; cv=none; b=ph4dWHF4YniakqkGsBJHzdy6WYwh2AOfaMmPaWxjE74HBDpYHphcFFCxVTZTfmTH8FJ4Qf q/4Lk38nTwLSvVnBuUcWYSxaOnRYlFHAUnumBOJS2BClwidq28nlJ0xkJIuQHXA9gw7psE 1zrUMuVoB94fYQdpgzKLnR8m4BXkjbhNItbFHRbgt3aidYumPy4lnRTQHu94ZhIXGNc0vO B0KhYsLvWAjJTuWFHCiEg/n2k2t7HCMhhFt/l9GpJED1Vg63Hxu0iFJVqCfDDqA8wsBGdQ 7HKTcSyaJTn8EVjdctdFyh/VXKZ0jymIeYyAIEWyzFw9P0CYpxXmF8lWchRNtQ== 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 4QqRT36stSz17ZT; Mon, 26 Jun 2023 12:08:39 +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 35QC8ds0083150; Mon, 26 Jun 2023 12:08:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35QC8dDJ083149; Mon, 26 Jun 2023 12:08:39 GMT (envelope-from git) Date: Mon, 26 Jun 2023 12:08:39 GMT Message-Id: <202306261208.35QC8dDJ083149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 7140d2464579 - stable/13 - LinuxKPI: 802.11: improve assertion and tkip code List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7140d2464579e918d5e59ba1a9b2b0b148536c86 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7140d2464579e918d5e59ba1a9b2b0b148536c86 commit 7140d2464579e918d5e59ba1a9b2b0b148536c86 Author: Bjoern A. Zeeb AuthorDate: 2023-04-20 16:01:05 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-06-26 09:14:04 +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 (cherry picked from commit 35f7fa4ac1aea8af9a4f2428b3f0a346151b4071) --- 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