f7e022ca0caf64649ef6aad94872270d0242d00b
[openwrt/staging/hauke.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Tue, 16 Jul 2019 00:09:19 +0200
3 Subject: [PATCH] mac80211: add IEEE80211_KEY_FLAG_GENERATE_MMIE to
4 ieee80211_key_flags
5
6 Add IEEE80211_KEY_FLAG_GENERATE_MMIE flag to ieee80211_key_flags in order
7 to allow the driver to notify mac80211 to generate MMIE and that it
8 requires sequence number generation only.
9 This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615
10 driver
11
12 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
13 Link: https://lore.kernel.org/r/dfe275f9aa0f1cc6b33085f9efd5d8447f68ad13.1563228405.git.lorenzo@kernel.org
14 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 ---
16
17 --- a/include/net/mac80211.h
18 +++ b/include/net/mac80211.h
19 @@ -1616,6 +1616,9 @@ struct wireless_dev *ieee80211_vif_to_wd
20 * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for
21 * a TKIP key if it only requires MIC space. Do not set together with
22 * @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
23 + * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver
24 + * for a AES_CMAC key to indicate that it requires sequence number
25 + * generation only
26 */
27 enum ieee80211_key_flags {
28 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0),
29 @@ -1627,6 +1630,7 @@ enum ieee80211_key_flags {
30 IEEE80211_KEY_FLAG_RX_MGMT = BIT(6),
31 IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7),
32 IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(8),
33 + IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(10),
34 };
35
36 /**
37 --- a/net/mac80211/wpa.c
38 +++ b/net/mac80211/wpa.c
39 @@ -947,7 +947,8 @@ ieee80211_crypto_aes_cmac_encrypt(struct
40
41 info = IEEE80211_SKB_CB(skb);
42
43 - if (info->control.hw_key)
44 + if (info->control.hw_key &&
45 + !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE))
46 return TX_CONTINUE;
47
48 if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
49 @@ -963,6 +964,9 @@ ieee80211_crypto_aes_cmac_encrypt(struct
50
51 bip_ipn_set64(mmie->sequence_number, pn64);
52
53 + if (info->control.hw_key)
54 + return TX_CONTINUE;
55 +
56 bip_aad(skb, aad);
57
58 /*