developer | 5f1d3ca | 2024-04-25 05:25:22 +0800 | [diff] [blame^] | 1 | From c2aed160872b89580f253fdfb2369e59951e3695 Mon Sep 17 00:00:00 2001 |
developer | 0415fc3 | 2024-04-19 18:29:00 +0800 | [diff] [blame] | 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Thu, 21 Mar 2024 10:58:59 +0800 |
| 4 | Subject: [PATCH 56/61] mtk: mac80211: extend IEEE80211_KEY_FLAG_GENERATE_MMIE |
| 5 | to other ciphers |
| 6 | |
| 7 | This commit extends the flag IEEE80211_KEY_FLAG_GENERATE_MMIE to |
| 8 | CMAC-256 and GMAC for the same reason that this flag was added. |
| 9 | (a0b449: mac80211: add IEEE80211_KEY_FLAG_GENERATE_MMIE to ieee80211_key_flags) |
| 10 | |
developer | 0415fc3 | 2024-04-19 18:29:00 +0800 | [diff] [blame] | 11 | Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
developer | 0415fc3 | 2024-04-19 18:29:00 +0800 | [diff] [blame] | 12 | --- |
| 13 | net/mac80211/wpa.c | 12 ++++++++++-- |
| 14 | 1 file changed, 10 insertions(+), 2 deletions(-) |
| 15 | |
| 16 | diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c |
| 17 | index daf1bcc..e66f917 100644 |
| 18 | --- a/net/mac80211/wpa.c |
| 19 | +++ b/net/mac80211/wpa.c |
| 20 | @@ -903,7 +903,8 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx) |
| 21 | |
| 22 | info = IEEE80211_SKB_CB(skb); |
| 23 | |
| 24 | - if (info->control.hw_key) |
| 25 | + if (info->control.hw_key && |
| 26 | + !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE)) |
| 27 | return TX_CONTINUE; |
| 28 | |
| 29 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) |
| 30 | @@ -919,6 +920,9 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx) |
| 31 | |
| 32 | bip_ipn_set64(mmie->sequence_number, pn64); |
| 33 | |
| 34 | + if (info->control.hw_key) |
| 35 | + return TX_CONTINUE; |
| 36 | + |
| 37 | bip_aad(skb, aad); |
| 38 | |
| 39 | /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128) |
| 40 | @@ -1048,7 +1052,8 @@ ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx) |
| 41 | |
| 42 | info = IEEE80211_SKB_CB(skb); |
| 43 | |
| 44 | - if (info->control.hw_key) |
| 45 | + if (info->control.hw_key && |
| 46 | + !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE)) |
| 47 | return TX_CONTINUE; |
| 48 | |
| 49 | if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) |
| 50 | @@ -1064,6 +1069,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx) |
| 51 | |
| 52 | bip_ipn_set64(mmie->sequence_number, pn64); |
| 53 | |
| 54 | + if (info->control.hw_key) |
| 55 | + return TX_CONTINUE; |
| 56 | + |
| 57 | bip_aad(skb, aad); |
| 58 | |
| 59 | hdr = (struct ieee80211_hdr *)skb->data; |
| 60 | -- |
developer | 5f1d3ca | 2024-04-25 05:25:22 +0800 | [diff] [blame^] | 61 | 2.18.0 |
developer | 0415fc3 | 2024-04-19 18:29:00 +0800 | [diff] [blame] | 62 | |