aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2025-01-27 13:54:02 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2025-02-24 20:26:50 +0000
commit8feaeb95440b851202d59f12d7bde0500109be5b (patch)
tree30df6732b62a21ee3d9d7ba424821135944a10d2
parent8468f05ff74d84d9f4f9094bf42f7356a9ac6045 (diff)
net80211: crypto: ccmp: simplify and style(9)
Comply with style(9) and andd checks for booleaness when doing bit tests. If there is no need for double negated checks simplify them. This all makes the conditions a lot easier to read. Slip in a comment about MIC vs. MMIC. No functional changes. Sponsored by: The FreeBSD Foundation Reviewed by: emaste, adrian Differential Revision: https://reviews.freebsd.org/D49055 (cherry picked from commit 8dcdffdb086103e9ce36bfa82fc1179c88ebc31b)
-rw-r--r--sys/net80211/ieee80211_crypto_ccmp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net80211/ieee80211_crypto_ccmp.c b/sys/net80211/ieee80211_crypto_ccmp.c
index 06028cf2a37c..404996b1cbca 100644
--- a/sys/net80211/ieee80211_crypto_ccmp.c
+++ b/sys/net80211/ieee80211_crypto_ccmp.c
@@ -242,7 +242,7 @@ ccmp_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen)
rxs = ieee80211_get_rx_params_ptr(m);
- if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))
+ if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) != 0)
goto finish;
/*
@@ -297,14 +297,15 @@ finish:
/*
* XXX TODO: see if MMIC_STRIP also covers CCMP MIC trailer.
+ * Well no as it's a MIC not MMIC but we re-use the same flag for now.
*/
- if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP)))
+ if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP) == 0)
m_adj(m, -ccmp.ic_trailer);
/*
* Ok to update rsc now.
*/
- if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) {
+ if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) == 0) {
/*
* Do not go backwards in the IEEE80211_KEY_NOREPLAY cases
* or in case hardware has checked but frames are arriving