wifi: mac80211: refactor CMAC implementation
Subsystems (2)
v4 cover wifi: mac80211: refactor CMAC implementation
This series refactors the CMAC implementation in mac80211 to:
1. Add proper error handling
2. Remove duplication
Every patch in the patchset has been tested with mac80211_hwsim and the result looks good.
---
Changes in v4:
- Simplify error handling in CMAC functions.
- Use the newly defined constants in all available places.
- Unify output handling in ieee80211_aes_cmac().
- Coding style fixes.
- Remove cumbersome words in commit messages.
---
Changes in v3:
- Drop patch 1/6("wifi: mac80211: remove an unnecessary copy").
- Rework patch 2/6("wifi: mac80211: fix CMAC functions not handling errors") and patch 5/6("wifi: mac80211: refactor CMAC crypt functions") accordingly.
---
Changes in v2:
- Remove words in commit messages stating that only compile is tested.
- Remove Fixes line in patch 1/6.
---
Chien Wong (5):
wifi: mac80211: fix CMAC functions not handling errors
wifi: mac80211: add generic MMIE struct defines
wifi: mac80211: utilize the newly defined CMAC constants
wifi: mac80211: refactor CMAC crypt functions
wifi: mac80211: refactor CMAC packet handlers
include/linux/ieee80211.h | 14 +++- net/mac80211/aes_cmac.c | 60 +++++++--------- net/mac80211/aes_cmac.h | 7 +- net/mac80211/aes_gmac.c | 22 +++--- net/mac80211/aes_gmac.h | 1 - net/mac80211/rx.c | 6 +- net/mac80211/tx.c | 6 +- net/mac80211/wpa.c | 148 ++++++++------------------------------ net/mac80211/wpa.h | 10 ++- 9 files changed, 96 insertions(+), 178 deletions(-)
Signature · 1 line
2.51.2
PATCH v4 1/5 wifi: mac80211: fix CMAC functions not handling errors
The called hash functions could fail thus we should check return values.
--- net/mac80211/aes_cmac.c | 63 +++++++++++++++++++++++++++++------------ net/mac80211/aes_cmac.h | 8 +++--- net/mac80211/wpa.c | 20 +++++++------ 3 files changed, 61 insertions(+), 30 deletions(-)
net/mac80211/aes_cmac.c +45 -18
@@ -22,50 +22,77 @@static const u8 zero[CMAC_TLEN_256 ]; -void ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic) +int ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad, +const u8 *data,size_t data_len,u8 *mic) { +int err;SHASH_DESC_ON_STACK (desc, tfm);u8 out[AES_BLOCK_SIZE ];const __le16 *fc; desc->tfm = tfm; -crypto_shash_init (desc); -crypto_shash_update (desc, aad,AAD_LEN ); + err =crypto_shash_init (desc); +if (err) +return err; + err =crypto_shash_update (desc, aad,AAD_LEN ); +if (err) +return err; fc = (const __le16 *)aad;if (ieee80211_is_beacon (*fc)) {/* mask Timestamp field to zero */ -crypto_shash_update (desc, zero,8 ); -crypto_shash_update (desc, data +8 , data_len -8 -CMAC_TLEN ); + err =crypto_shash_update (desc, zero,8 ); +if (err) +return err; + err =crypto_shash_update (desc, data +8 , + data_len -8 -CMAC_TLEN ); +if (err) +return err; }else { -crypto_shash_update (desc, data, data_len -CMAC_TLEN ); + err =crypto_shash_update (desc, data, + data_len -CMAC_TLEN ); +if (err) +return err; } -crypto_shash_finup (desc, zero,CMAC_TLEN , out); - + err =crypto_shash_finup (desc, zero,CMAC_TLEN , out); +if (err) +return err;memcpy (mic, out,CMAC_TLEN ); + +return 0 ; } -void ieee80211_aes_cmac_256 (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic) +int ieee80211_aes_cmac_256 (struct crypto_shash *tfm,const u8 *aad, +const u8 *data,size_t data_len,u8 *mic) { +int err;SHASH_DESC_ON_STACK (desc, tfm);const __le16 *fc; desc->tfm = tfm; -crypto_shash_init (desc); -crypto_shash_update (desc, aad,AAD_LEN ); + err =crypto_shash_init (desc); +if (err) +return err; + err =crypto_shash_update (desc, aad,AAD_LEN ); +if (err) +return err; fc = (const __le16 *)aad;if (ieee80211_is_beacon (*fc)) {/* mask Timestamp field to zero */ -crypto_shash_update (desc, zero,8 ); -crypto_shash_update (desc, data +8 , - data_len -8 -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, zero,8 ); +if (err) +return err; + err =crypto_shash_update (desc, data +8 , + data_len -8 -CMAC_TLEN_256 ); +if (err) +return err; }else { -crypto_shash_update (desc, data, data_len -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, data, data_len -CMAC_TLEN_256 ); +if (err) +return err; } -crypto_shash_finup (desc, zero,CMAC_TLEN_256 , mic); +return crypto_shash_finup (desc, zero,CMAC_TLEN_256 , mic); } struct crypto_shash *ieee80211_aes_cmac_key_setup(const u8 key[],
net/mac80211/aes_cmac.h +4 -4
@@ -11,10 +11,10 @@struct crypto_shash *ieee80211_aes_cmac_key_setup (const u8 key[],size_t key_len); -void ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic); -void ieee80211_aes_cmac_256 (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic); +int ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad, +const u8 *data,size_t data_len,u8 *mic); +int ieee80211_aes_cmac_256 (struct crypto_shash *tfm,const u8 *aad, +const u8 *data,size_t data_len,u8 *mic);void ieee80211_aes_cmac_key_free (struct crypto_shash *tfm);#endif /* AES_CMAC_H */
net/mac80211/wpa.c +12 -8
@@ -869,8 +869,9 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx)/* * MIC = AES-128-CMAC(IGTK, AAD || Management Frame Body || MMIE, 64) */ -ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mmie->mic); +if (ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, + skb->data +24 , skb->len -24 , mmie->mic)) +return TX_DROP ;return TX_CONTINUE ; }
@@ -916,8 +917,9 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)/* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */ -ieee80211_aes_cmac_256 (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mmie->mic); +if (ieee80211_aes_cmac_256 (key->u.aes_cmac.tfm, aad, + skb->data +24 , skb->len -24 , mmie->mic)) +return TX_DROP ;return TX_CONTINUE ; }
@@ -956,8 +958,9 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)if (!(status->flag &RX_FLAG_DECRYPTED )) {/* hardware didn't decrypt/verify MIC */ bip_aad (skb, aad); -ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mic); +if (ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, + skb->data +24 , skb->len -24 , mic)) +return RX_DROP_U_DECRYPT_FAIL ;if (crypto_memneq (mic, mmie->mic,sizeof (mmie->mic))) { key->u.aes_cmac.icverrors++;return RX_DROP_U_MIC_FAIL ;
@@ -1006,8 +1009,9 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)if (!(status->flag &RX_FLAG_DECRYPTED )) {/* hardware didn't decrypt/verify MIC */ bip_aad (skb, aad); -ieee80211_aes_cmac_256 (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mic); +if (ieee80211_aes_cmac_256 (key->u.aes_cmac.tfm, aad, + skb->data +24 , skb->len -24 , mic)) +return RX_DROP_U_DECRYPT_FAIL ;if (crypto_memneq (mic, mmie->mic,sizeof (mmie->mic))) { key->u.aes_cmac.icverrors++;return RX_DROP_U_MIC_FAIL ;
Signature · 1 line
2.51.2
PATCH v4 2/5 wifi: mac80211: add generic MMIE struct defines
In reply to Chien WongThe added struct is needed when writing generic handler for both CMAC-128 and CMAC-256.
--- include/linux/ieee80211.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
include/linux/ieee80211.h +13 -1
@@ -1207,7 +1207,7 @@ struct ieee80211_mgmt {#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) -/* Management MIC information element (IEEE 802.11w) */ +/* Management MIC information element (IEEE 802.11w) for CMAC */ struct ieee80211_mmie {u8 element_id;u8 length;
@@ -1225,6 +1225,15 @@ struct ieee80211_mmie_16 {u8 mic[16 ]; } __packed; +/* Management MIC information element (IEEE 802.11w) for all variants */ +struct ieee80211_mmie_var { +u8 element_id; +u8 length; +__le16 key_id; +u8 sequence_number[6 ]; +u8 mic[];/* 8 or 16 bytes */ +} __packed; +struct ieee80211_vendor_ie {u8 element_id;u8 len;
@@ -1889,6 +1898,9 @@ enum ieee80211_radio_measurement_actioncode {#define IEEE80211_GCMP_HDR_LEN 8#define IEEE80211_GCMP_MIC_LEN 16#define IEEE80211_GCMP_PN_LEN 6 +#define IEEE80211_CMAC_128_MIC_LEN 8 +#define IEEE80211_CMAC_256_MIC_LEN 16 +#define IEEE80211_GMAC_MIC_LEN 16#define FILS_NONCE_LEN 16#define FILS_MAX_KEK_LEN 64
Signature · 1 line
2.51.2
PATCH v4 3/5 wifi: mac80211: utilize the newly defined CMAC constants
In reply to Chien WongMake use of the added constants to reduce duplication.
--- net/mac80211/aes_cmac.c | 25 ++++++++++++------------- net/mac80211/aes_gmac.c | 22 ++++++++++++---------- net/mac80211/aes_gmac.h | 1 - net/mac80211/wpa.c | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-)
net/mac80211/aes_cmac.c +12 -13
@@ -16,11 +16,9 @@#include "key.h" #include "aes_cmac.h" -#define CMAC_TLEN 8/* CMAC TLen = 64 bits (8 octets) */ -#define CMAC_TLEN_256 16/* CMAC TLen = 128 bits (16 octets) */ #define AAD_LEN 20 -static const u8 zero[CMAC_TLEN_256 ]; +static const u8 zero[IEEE80211_CMAC_256_MIC_LEN ];int ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad,const u8 *data,size_t data_len,u8 *mic)
@@ -44,20 +42,20 @@ int ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, err =crypto_shash_update (desc, zero,8 );if (err)return err; - err =crypto_shash_update (desc, data +8 , - data_len -8 -CMAC_TLEN ); + err =crypto_shash_update (desc, data +8 , data_len -8 - +IEEE80211_CMAC_128_MIC_LEN );if (err)return err; }else { - err =crypto_shash_update (desc, data, - data_len -CMAC_TLEN ); + err =crypto_shash_update (desc, data, data_len - +IEEE80211_CMAC_128_MIC_LEN );if (err)return err; } - err =crypto_shash_finup (desc, zero,CMAC_TLEN , out); + err =crypto_shash_finup (desc, zero,IEEE80211_CMAC_128_MIC_LEN , out);if (err)return err; -memcpy (mic, out,CMAC_TLEN ); +memcpy (mic, out,IEEE80211_CMAC_128_MIC_LEN );return 0 ; }
@@ -83,16 +81,17 @@ int ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad, err =crypto_shash_update (desc, zero,8 );if (err)return err; - err =crypto_shash_update (desc, data +8 , - data_len -8 -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, data +8 , data_len -8 - +IEEE80211_CMAC_256_MIC_LEN );if (err)return err; }else { - err =crypto_shash_update (desc, data, data_len -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, data, data_len - +IEEE80211_CMAC_256_MIC_LEN );if (err)return err; } -return crypto_shash_finup (desc, zero,CMAC_TLEN_256 , mic); +return crypto_shash_finup (desc, zero,IEEE80211_CMAC_256_MIC_LEN , mic); } struct crypto_shash *ieee80211_aes_cmac_key_setup(const u8 key[],
net/mac80211/aes_gmac.c +12 -10
@@ -24,15 +24,16 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,const __le16 *fc;int ret; -if (data_len <GMAC_MIC_LEN ) +if (data_len <IEEE80211_GMAC_MIC_LEN )return -EINVAL ; - aead_req =kzalloc (reqsize +GMAC_MIC_LEN +GMAC_AAD_LEN ,GFP_ATOMIC ); + aead_req =kzalloc (reqsize +IEEE80211_GMAC_MIC_LEN +GMAC_AAD_LEN , +GFP_ATOMIC );if (!aead_req)return -ENOMEM ; zero = (u8 *)aead_req + reqsize; - __aad = zero +GMAC_MIC_LEN ; + __aad = zero +IEEE80211_GMAC_MIC_LEN ;memcpy (__aad, aad,GMAC_AAD_LEN ); fc = (const __le16 *)aad;
@@ -41,15 +42,16 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,sg_init_table (sg,5 );sg_set_buf (&sg[0 ], __aad,GMAC_AAD_LEN );sg_set_buf (&sg[1 ], zero,8 ); -sg_set_buf (&sg[2 ], data +8 , data_len -8 -GMAC_MIC_LEN ); -sg_set_buf (&sg[3 ], zero,GMAC_MIC_LEN ); -sg_set_buf (&sg[4 ], mic,GMAC_MIC_LEN ); +sg_set_buf (&sg[2 ], data +8 , + data_len -8 -IEEE80211_GMAC_MIC_LEN ); +sg_set_buf (&sg[3 ], zero,IEEE80211_GMAC_MIC_LEN ); +sg_set_buf (&sg[4 ], mic,IEEE80211_GMAC_MIC_LEN ); }else {sg_init_table (sg,4 );sg_set_buf (&sg[0 ], __aad,GMAC_AAD_LEN ); -sg_set_buf (&sg[1 ], data, data_len -GMAC_MIC_LEN ); -sg_set_buf (&sg[2 ], zero,GMAC_MIC_LEN ); -sg_set_buf (&sg[3 ], mic,GMAC_MIC_LEN ); +sg_set_buf (&sg[1 ], data, data_len -IEEE80211_GMAC_MIC_LEN ); +sg_set_buf (&sg[2 ], zero,IEEE80211_GMAC_MIC_LEN ); +sg_set_buf (&sg[3 ], mic,IEEE80211_GMAC_MIC_LEN ); }memcpy (iv, nonce,GMAC_NONCE_LEN );
@@ -78,7 +80,7 @@ struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], err =crypto_aead_setkey (tfm, key, key_len);if (!err) - err =crypto_aead_setauthsize (tfm,GMAC_MIC_LEN ); + err =crypto_aead_setauthsize (tfm,IEEE80211_GMAC_MIC_LEN );if (!err)return tfm;
net/mac80211/aes_gmac.h +0 -1
@@ -9,7 +9,6 @@#include <linux/crypto.h> #define GMAC_AAD_LEN 20 -#define GMAC_MIC_LEN 16#define GMAC_NONCE_LEN 12 struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
net/mac80211/wpa.c +1 -1
@@ -1117,7 +1117,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)memcpy (nonce, hdr->addr2,ETH_ALEN );memcpy (nonce +ETH_ALEN , ipn,6 ); - mic =kmalloc (GMAC_MIC_LEN ,GFP_ATOMIC ); + mic =kmalloc (IEEE80211_GMAC_MIC_LEN ,GFP_ATOMIC );if (!mic)return RX_DROP_U_OOM ; if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
Signature · 1 line
2.51.2
PATCH v4 4/5 wifi: mac80211: refactor CMAC crypt functions
In reply to Chien Wongieee80211_aes_cmac() and ieee80211_aes_cmac_256() are almost the same. Merge them. This removes duplication.
--- net/mac80211/aes_cmac.c | 48 ++++++----------------------------------- net/mac80211/aes_cmac.h | 5 ++--- net/mac80211/wpa.c | 16 ++++++++------ 3 files changed, 19 insertions(+), 50 deletions(-)
net/mac80211/aes_cmac.c +7 -41
@@ -21,7 +21,8 @@static const u8 zero[IEEE80211_CMAC_256_MIC_LEN ];int ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic) +const u8 *data,size_t data_len,u8 *mic, +unsigned int mic_len) {int err;SHASH_DESC_ON_STACK (desc, tfm);
@@ -42,58 +43,23 @@ int ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, err =crypto_shash_update (desc, zero,8 );if (err)return err; - err =crypto_shash_update (desc, data +8 , data_len -8 - -IEEE80211_CMAC_128_MIC_LEN ); + err =crypto_shash_update (desc, data +8 , + data_len -8 - mic_len);if (err)return err; }else { - err =crypto_shash_update (desc, data, data_len - -IEEE80211_CMAC_128_MIC_LEN ); + err =crypto_shash_update (desc, data, data_len - mic_len);if (err)return err; } - err =crypto_shash_finup (desc, zero,IEEE80211_CMAC_128_MIC_LEN , out); + err =crypto_shash_finup (desc, zero, mic_len, out);if (err)return err; -memcpy (mic, out,IEEE80211_CMAC_128_MIC_LEN ); +memcpy (mic, out, mic_len);return 0 ; } -int ieee80211_aes_cmac_256 (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic) -{ -int err; -SHASH_DESC_ON_STACK (desc, tfm); -const __le16 *fc; - - desc->tfm = tfm; - - err =crypto_shash_init (desc); -if (err) -return err; - err =crypto_shash_update (desc, aad,AAD_LEN ); -if (err) -return err; - fc = (const __le16 *)aad; -if (ieee80211_is_beacon (*fc)) { -/* mask Timestamp field to zero */ - err =crypto_shash_update (desc, zero,8 ); -if (err) -return err; - err =crypto_shash_update (desc, data +8 , data_len -8 - -IEEE80211_CMAC_256_MIC_LEN ); -if (err) -return err; - }else { - err =crypto_shash_update (desc, data, data_len - -IEEE80211_CMAC_256_MIC_LEN ); -if (err) -return err; - } -return crypto_shash_finup (desc, zero,IEEE80211_CMAC_256_MIC_LEN , mic); -} -struct crypto_shash *ieee80211_aes_cmac_key_setup (const u8 key[],size_t key_len) {
net/mac80211/aes_cmac.h +2 -3
@@ -12,9 +12,8 @@struct crypto_shash *ieee80211_aes_cmac_key_setup (const u8 key[],size_t key_len);int ieee80211_aes_cmac (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic); -int ieee80211_aes_cmac_256 (struct crypto_shash *tfm,const u8 *aad, -const u8 *data,size_t data_len,u8 *mic); +const u8 *data,size_t data_len,u8 *mic, +unsigned int mic_len);void ieee80211_aes_cmac_key_free (struct crypto_shash *tfm);#endif /* AES_CMAC_H */
net/mac80211/wpa.c +10 -6
@@ -870,7 +870,8 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx)* MIC = AES-128-CMAC(IGTK, AAD || Management Frame Body || MMIE, 64) */ if (ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mmie->mic)) + skb->data +24 , skb->len -24 , mmie->mic, +IEEE80211_CMAC_128_MIC_LEN ))return TX_DROP ;return TX_CONTINUE ;
@@ -917,8 +918,9 @@ ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)/* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */ -if (ieee80211_aes_cmac_256 (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mmie->mic)) +if (ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, + skb->data +24 , skb->len -24 , mmie->mic, +IEEE80211_CMAC_256_MIC_LEN ))return TX_DROP ;return TX_CONTINUE ;
@@ -959,7 +961,8 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)/* hardware didn't decrypt/verify MIC */ bip_aad (skb, aad);if (ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mic)) + skb->data +24 , skb->len -24 , mic, +IEEE80211_CMAC_128_MIC_LEN ))return RX_DROP_U_DECRYPT_FAIL ;if (crypto_memneq (mic, mmie->mic,sizeof (mmie->mic))) { key->u.aes_cmac.icverrors++;
@@ -1009,8 +1012,9 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)if (!(status->flag &RX_FLAG_DECRYPTED )) {/* hardware didn't decrypt/verify MIC */ bip_aad (skb, aad); -if (ieee80211_aes_cmac_256 (key->u.aes_cmac.tfm, aad, - skb->data +24 , skb->len -24 , mic)) +if (ieee80211_aes_cmac (key->u.aes_cmac.tfm, aad, + skb->data +24 , skb->len -24 , mic, +IEEE80211_CMAC_256_MIC_LEN ))return RX_DROP_U_DECRYPT_FAIL ;if (crypto_memneq (mic, mmie->mic,sizeof (mmie->mic))) { key->u.aes_cmac.icverrors++;
Signature · 1 line
2.51.2
PATCH v4 5/5 wifi: mac80211: refactor CMAC packet handlers
In reply to Chien WongMerge CMAC-128 and CMAC-256 handlers since they are almost the same. This removes duplication.
The comment 'MIC = AES-128-CMAC(IGTK, AAD ...' is out-dated since CMAC is also used with BIGTK, as is the comment for CMAC-256. Simply remove the comments.
Tested-on: mac80211_hwsim
--- net/mac80211/rx.c | 6 +- net/mac80211/tx.c | 6 +- net/mac80211/wpa.c | 146 ++++++++------------------------------------- net/mac80211/wpa.h | 10 ++-- 4 files changed, 37 insertions(+), 131 deletions(-)
net/mac80211/rx.c +4 -2
@@ -2215,10 +2215,12 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) rx, IEEE80211_CCMP_256_MIC_LEN);break ;case WLAN_CIPHER_SUITE_AES_CMAC : - result =ieee80211_crypto_aes_cmac_decrypt (rx); + result =ieee80211_crypto_aes_cmac_decrypt ( + rx,IEEE80211_CMAC_128_MIC_LEN );break ;case WLAN_CIPHER_SUITE_BIP_CMAC_256 : - result =ieee80211_crypto_aes_cmac_256_decrypt (rx); + result =ieee80211_crypto_aes_cmac_decrypt ( + rx,IEEE80211_CMAC_256_MIC_LEN );break ;case WLAN_CIPHER_SUITE_BIP_GMAC_128 :case WLAN_CIPHER_SUITE_BIP_GMAC_256 :
net/mac80211/tx.c +4 -2
@@ -1062,9 +1062,11 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)return ieee80211_crypto_ccmp_encrypt ( tx,IEEE80211_CCMP_256_MIC_LEN );case WLAN_CIPHER_SUITE_AES_CMAC : -return ieee80211_crypto_aes_cmac_encrypt (tx); +return ieee80211_crypto_aes_cmac_encrypt ( + tx,IEEE80211_CMAC_128_MIC_LEN );case WLAN_CIPHER_SUITE_BIP_CMAC_256 : -return ieee80211_crypto_aes_cmac_256_encrypt (tx); +return ieee80211_crypto_aes_cmac_encrypt ( + tx,IEEE80211_CMAC_256_MIC_LEN );case WLAN_CIPHER_SUITE_BIP_GMAC_128 :case WLAN_CIPHER_SUITE_BIP_GMAC_256 :return ieee80211_crypto_aes_gmac_encrypt (tx);
net/mac80211/wpa.c +25 -121
206 lines not on this page · raw message
net/mac80211/wpa.h +4 -6
@@ -29,13 +29,11 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx, unsigned int mic_len);ieee80211_tx_result -ieee80211_crypto_aes_cmac_encrypt (struct ieee80211_tx_data *tx); -ieee80211_tx_result -ieee80211_crypto_aes_cmac_256_encrypt (struct ieee80211_tx_data *tx); -ieee80211_rx_result -ieee80211_crypto_aes_cmac_decrypt (struct ieee80211_rx_data *rx); +ieee80211_crypto_aes_cmac_encrypt (struct ieee80211_tx_data *tx, +unsigned int mic_len);ieee80211_rx_result -ieee80211_crypto_aes_cmac_256_decrypt (struct ieee80211_rx_data *rx); +ieee80211_crypto_aes_cmac_decrypt (struct ieee80211_rx_data *rx, +unsigned int mic_len);ieee80211_tx_result ieee80211_crypto_aes_gmac_encrypt (struct ieee80211_tx_data *tx); ieee80211_rx_result
Signature · 1 line
2.51.2