Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211, cfg80211: Export michael_mic() and move it to cfg80211

Export michael_mic() so that the ath11k and ath12k drivers can call it.
In addition, move it from mac80211 to cfg80211 so that the ipw2x00
drivers, which depend on cfg80211 but not mac80211, can also call it.

Currently these drivers have their own local implementations of
michael_mic() based on crypto_shash, which is redundant and inefficient.
By consolidating all the Michael MIC code into cfg80211, we'll be able
to remove the duplicate Michael MIC code in the crypto/ directory.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Link: https://patch.msgid.link/20260408030651.80336-3-ebiggers@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Eric Biggers and committed by
Johannes Berg
613c8376 ea06baf5

+10 -26
+5
include/linux/ieee80211.h
··· 1921 1921 #define PMK_MAX_LEN 64 1922 1922 #define SAE_PASSWORD_MAX_LEN 128 1923 1923 1924 + #define MICHAEL_MIC_LEN 8 1925 + 1926 + void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, 1927 + const u8 *data, size_t data_len, u8 *mic); 1928 + 1924 1929 /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ 1925 1930 enum ieee80211_pub_actioncode { 1926 1931 WLAN_PUB_ACTION_20_40_BSS_COEX = 0,
-1
net/mac80211/Makefile
··· 18 18 iface.o \ 19 19 link.o \ 20 20 rate.o \ 21 - michael.o \ 22 21 tkip.o \ 23 22 aes_cmac.o \ 24 23 aes_gmac.o \
+4 -1
net/mac80211/michael.c net/wireless/michael-mic.c
··· 8 8 #include <linux/ieee80211.h> 9 9 #include <linux/unaligned.h> 10 10 11 - #include "michael.h" 11 + struct michael_mic_ctx { 12 + u32 l, r; 13 + }; 12 14 13 15 static void michael_block(struct michael_mic_ctx *mctx, u32 val) 14 16 { ··· 83 81 put_unaligned_le32(mctx.l, mic); 84 82 put_unaligned_le32(mctx.r, mic + 4); 85 83 } 84 + EXPORT_SYMBOL_GPL(michael_mic);
-22
net/mac80211/michael.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Michael MIC implementation - optimized for TKIP MIC operations 4 - * Copyright 2002-2003, Instant802 Networks, Inc. 5 - */ 6 - 7 - #ifndef MICHAEL_H 8 - #define MICHAEL_H 9 - 10 - #include <linux/types.h> 11 - #include <linux/ieee80211.h> 12 - 13 - #define MICHAEL_MIC_LEN 8 14 - 15 - struct michael_mic_ctx { 16 - u32 l, r; 17 - }; 18 - 19 - void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, 20 - const u8 *data, size_t data_len, u8 *mic); 21 - 22 - #endif /* MICHAEL_H */
-1
net/mac80211/wpa.c
··· 18 18 #include <crypto/utils.h> 19 19 20 20 #include "ieee80211_i.h" 21 - #include "michael.h" 22 21 #include "tkip.h" 23 22 #include "aes_ccm.h" 24 23 #include "aes_cmac.h"
+1 -1
net/wireless/Makefile
··· 8 8 9 9 cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o 10 10 cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o 11 - cfg80211-y += pmsr.o 11 + cfg80211-y += michael-mic.o pmsr.o 12 12 cfg80211-$(CONFIG_OF) += of.o 13 13 cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o 14 14 cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o