Skip to content

Commit

Permalink
wifi: mac80211: extend IEEE80211_KEY_FLAG_GENERATE_MMIE to other ciphers
Browse files Browse the repository at this point in the history
Extend the flag IEEE80211_KEY_FLAG_GENERATE_MMIE to BIP-CMAC-256,
BIP-GMAC-128 and BIP-GMAC-256 for the same reason and in the same
way that the flag was added originally in commit a0b4496
("mac80211: add IEEE80211_KEY_FLAG_GENERATE_MMIE to ieee80211_key_flags").

Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Link: https://msgid.link/20240326003036.15215-1-michael-cy.lee@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Michael-CY Lee authored and Johannes Berg committed Apr 8, 2024
1 parent 0e9824e commit a35b36e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2124,8 +2124,8 @@ static inline bool lockdep_vif_wiphy_mutex_held(struct ieee80211_vif *vif)
* @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
* @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation.
* @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver
* for a AES_CMAC key to indicate that it requires sequence number
* generation only
* for a AES_CMAC or a AES_GMAC key to indicate that it requires sequence
* number generation only
* @IEEE80211_KEY_FLAG_SPP_AMSDU: SPP A-MSDUs can be used with this key
* (set by mac80211 from the sta->spp_amsdu flag)
*/
Expand Down
12 changes: 10 additions & 2 deletions net/mac80211/wpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,8 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)

info = IEEE80211_SKB_CB(skb);

if (info->control.hw_key)
if (info->control.hw_key &&
!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE))
return TX_CONTINUE;

if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
Expand All @@ -911,6 +912,9 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)

bip_ipn_set64(mmie->sequence_number, pn64);

if (info->control.hw_key)
return TX_CONTINUE;

bip_aad(skb, aad);

/* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
Expand Down Expand Up @@ -1040,7 +1044,8 @@ ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)

info = IEEE80211_SKB_CB(skb);

if (info->control.hw_key)
if (info->control.hw_key &&
!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE))
return TX_CONTINUE;

if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
Expand All @@ -1056,6 +1061,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)

bip_ipn_set64(mmie->sequence_number, pn64);

if (info->control.hw_key)
return TX_CONTINUE;

bip_aad(skb, aad);

hdr = (struct ieee80211_hdr *)skb->data;
Expand Down

0 comments on commit a35b36e

Please sign in to comment.