wifi: mac80211: refactor CMAC implementation
Subsystems (2)
v2 cover wifi: mac80211: refactor CMAC implementation
This series refactors the CMAC implementation in mac80211 to:
1. Remove unnecessary operation
2. Add proper error handling
3. Remove duplication
Every patch in the patchset has been tested with mac80211_hwsim and the result looks good.
---
Changes in v2:
- Remove words in commit messages stating that only compile is tested.
- Remove Fixes line in patch 1/6.
---
Chien Wong (6):
wifi: mac80211: remove an unnecessary copy
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 | 6 +- net/mac80211/aes_gmac.h | 2 +- net/mac80211/rx.c | 6 +- net/mac80211/tx.c | 6 +- net/mac80211/wpa.c | 144 +++++++------------------------------- net/mac80211/wpa.h | 10 ++- 8 files changed, 80 insertions(+), 168 deletions(-)
Signature · 1 line
2.51.2
PATCH v2 1/6 wifi: mac80211: remove an unnecessary copy
Using a temporary buffer for saving the CMAC result is useless. With the patch, ieee80211_aes_cmac() just resembles ieee80211_aes_cmac_256().
--- net/mac80211/aes_cmac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/mac80211/aes_cmac.c +1 -4
@@ -26,7 +26,6 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, const u8 *data, size_t data_len, u8 *mic) {SHASH_DESC_ON_STACK (desc ,tfm ); -u8 out[AES_BLOCK_SIZE ];const __le16 *fc; desc->tfm = tfm;
@@ -41,9 +40,7 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, }else {crypto_shash_update (desc, data, data_len -CMAC_TLEN ); } -crypto_shash_finup (desc, zero,CMAC_TLEN , out); - -memcpy (mic, out,CMAC_TLEN ); +crypto_shash_finup (desc, zero,CMAC_TLEN , mic); } void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad,
Signature · 1 line
2.51.2
Johannes Berg
maintainerRe: [PATCH v2 1/6] wifi: mac80211: remove an unnecessary copy
Quoted 3 lines · Chien Wong
Using a temporary buffer for saving the CMAC result is useless. With the patch,
ieee80211_aes_cmac()just resemblesieee80211_aes_cmac_256().
I guess I could've looked more closely at v1 ...
Quoted 10 lines
+++
b/net/mac80211/aes_cmac.cnet/mac80211/aes_cmac.c +0
-1@@ -26,7 +26,6 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, const u8 *data, size_t data_len, u8 *mic) {SHASH_DESC_ON_STACK (desc ,tfm ); -u8 out[AES_BLOCK_SIZE ];const __le16 *fc; desc->tfm = tfm;
net/mac80211/aes_cmac.c void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, · line 43
Quoted 7 lines
net/mac80211/aes_cmac.c +1
-3@@ -41,9 +40,7 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, }else {crypto_shash_update (desc, data, data_len -CMAC_TLEN ); } -crypto_shash_finup (desc, zero,CMAC_TLEN , out); - -memcpy (mic, out,CMAC_TLEN ); +crypto_shash_finup (desc, zero,CMAC_TLEN , mic);
This seems very wrong, it writes 16 bytes when 'mic' will only have space for CMAC_TLEN==8. AFAICT, the CMAC_TLEN in the function call is the input length (of 'zero'), not the output length.
johannes
Re: [PATCH v2 1/6] wifi: mac80211: remove an unnecessary copy
Quoted 15 lines · Johannes Berg
Quoted 3 lines · Chien Wong
Using a temporary buffer for saving the CMAC result is useless. With the patch,
ieee80211_aes_cmac()just resemblesieee80211_aes_cmac_256().I guess I could've looked more closely at v1 ...
Quoted 8 lines
+++
b/net/mac80211/aes_cmac.cnet/mac80211/aes_cmac.c +0
-1@@ -26,7 +26,6 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, const u8 *data, size_t data_len, u8 *mic) {SHASH_DESC_ON_STACK (desc ,tfm ); -u8 out[AES_BLOCK_SIZE ];const __le16 *fc;
Quoted 14 lines
net/mac80211/aes_cmac.c void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, · line 43
Quoted 9 lines
net/mac80211/aes_cmac.c +1
-3desc->tfm = tfm;@@ -41,9 +40,7 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, }else {crypto_shash_update (desc, data, data_len -CMAC_TLEN ); } -crypto_shash_finup (desc, zero,CMAC_TLEN , out); - -memcpy (mic, out,CMAC_TLEN ); +crypto_shash_finup (desc, zero,CMAC_TLEN , mic);This seems very wrong, it writes 16 bytes when 'mic' will only have space for CMAC_TLEN==8. AFAICT, the
CMAC_TLENin the function call is the input length (of 'zero'), not the output length.
Sorry, that's completely wrong. Thanks for pointing out the issue—I'll fix it in v3.
PATCH v2 2/6 wifi: mac80211: fix CMAC functions not handling errors
In reply to Chien WongThe called hash functions could fail thus we should check return values. All references to the changed functions in the tree are adapted.
--- net/mac80211/aes_cmac.c | 60 +++++++++++++++++++++++++++++------------ net/mac80211/aes_cmac.h | 8 +++--- net/mac80211/wpa.c | 20 ++++++++------ 3 files changed, 59 insertions(+), 29 deletions(-)
net/mac80211/aes_cmac.c +43 -17
@@ -22,47 +22,73 @@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);const __le16 *fc; desc->tfm = tfm; -crypto_shash_init (desc); -crypto_shash_update (desc, aad,AAD_LEN ); + err =crypto_shash_init (desc); +if (err) + goto out; + err =crypto_shash_update (desc, aad,AAD_LEN ); +if (err) + goto out; 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) + goto out; + err =crypto_shash_update (desc, data +8 , data_len -8 -CMAC_TLEN ); +if (err) + goto out; }else { -crypto_shash_update (desc, data, data_len -CMAC_TLEN ); + err =crypto_shash_update (desc, data, data_len -CMAC_TLEN ); +if (err) + goto out; } -crypto_shash_finup (desc, zero,CMAC_TLEN , mic); + err =crypto_shash_finup (desc, zero,CMAC_TLEN , mic); +out: +return err; } -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) + goto out; + err =crypto_shash_update (desc, aad,AAD_LEN ); +if (err) + goto out; 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) + goto out; + err =crypto_shash_update (desc, data +8 , + data_len -8 -CMAC_TLEN_256 ); +if (err) + goto out; }else { -crypto_shash_update (desc, data, data_len -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, data, data_len -CMAC_TLEN_256 ); +if (err) + goto out; } -crypto_shash_finup (desc, zero,CMAC_TLEN_256 , mic); + err =crypto_shash_finup (desc, zero,CMAC_TLEN_256 , mic); +out: +return err; } 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 v2 3/6 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
@@ -1633,7 +1633,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;
@@ -1651,6 +1651,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;
@@ -4064,6 +4073,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 v2 4/6 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 | 4 ++-- net/mac80211/aes_gmac.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/mac80211/aes_cmac.c +2 -2
@@ -16,8 +16,8 @@#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 CMAC_TLEN IEEE80211_CMAC_128_MIC_LEN +#define CMAC_TLEN_256 IEEE80211_CMAC_256_MIC_LEN#define AAD_LEN 20static const u8 zero[CMAC_TLEN_256 ];
net/mac80211/aes_gmac.h +1 -1
@@ -9,7 +9,7 @@#include <linux/crypto.h> #define GMAC_AAD_LEN 20 -#define GMAC_MIC_LEN 16 +#define GMAC_MIC_LEN IEEE80211_GMAC_MIC_LEN#define GMAC_NONCE_LEN 12 struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
Signature · 1 line
2.51.2
PATCH v2 5/6 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.
All references to the refactored functions in the tree are adapted.
--- net/mac80211/aes_cmac.c | 49 +++++++---------------------------------- net/mac80211/aes_cmac.h | 4 +--- net/mac80211/wpa.c | 16 +++++++++----- 3 files changed, 19 insertions(+), 50 deletions(-)
net/mac80211/aes_cmac.c +8 -41
@@ -16,52 +16,20 @@#include "key.h" #include "aes_cmac.h" -#define CMAC_TLEN IEEE80211_CMAC_128_MIC_LEN -#define CMAC_TLEN_256 IEEE80211_CMAC_256_MIC_LEN#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) +const u8 *data,size_t data_len,u8 *mic,unsigned int mic_len) {int err;SHASH_DESC_ON_STACK (desc, tfm);const __le16 *fc; - desc->tfm = tfm; - - err =crypto_shash_init (desc); -if (err) - goto out; - err =crypto_shash_update (desc, aad,AAD_LEN ); -if (err) - goto out; - fc = (const __le16 *)aad; -if (ieee80211_is_beacon (*fc)) { -/* mask Timestamp field to zero */ - err =crypto_shash_update (desc, zero,8 ); -if (err) - goto out; - err =crypto_shash_update (desc, data +8 , data_len -8 -CMAC_TLEN ); -if (err) - goto out; - }else { - err =crypto_shash_update (desc, data, data_len -CMAC_TLEN ); -if (err) - goto out; - } - err =crypto_shash_finup (desc, zero,CMAC_TLEN , mic); -out: -return err; -} - -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; +if (mic_len !=IEEE80211_CMAC_128_MIC_LEN && + mic_len !=IEEE80211_CMAC_256_MIC_LEN ) +return -EINVAL ; desc->tfm = tfm;
@@ -77,16 +45,15 @@ int ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad, err =crypto_shash_update (desc, zero,8 );if (err) goto out; - err =crypto_shash_update (desc, data +8 , - data_len -8 -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, data +8 , data_len -8 - mic_len);if (err) goto out; }else { - err =crypto_shash_update (desc, data, data_len -CMAC_TLEN_256 ); + err =crypto_shash_update (desc, data, data_len - mic_len);if (err) goto out; } - err =crypto_shash_finup (desc, zero,CMAC_TLEN_256 , mic); + err =crypto_shash_finup (desc, zero, mic_len, mic); out:return err; }
net/mac80211/aes_cmac.h +1 -3
@@ -12,9 +12,7 @@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 v2 6/6 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.
All references to the refactored functions in the tree are adapted.
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 | 144 ++++++++------------------------------------- net/mac80211/wpa.h | 10 ++-- 4 files changed, 35 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 +23 -121
204 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