mac80211: remove ieee80211_get_hdr_info
PATCH 1/1 mac80211: remove ieee80211_get_hdr_info
Move the address selection into the michale_mic header calculation helper and pass a pointer to the ieee80211_hdr directly.
Reorganize ccmp_special_blocks while eliminating the unneeded sa/da/qos variables.
--- net/mac80211/michael.c | 17 ++++-- net/mac80211/michael.h | 2 +- net/mac80211/wpa.c | 139 ++++++++++++++++++++--------------------------- 3 files changed, 72 insertions(+), 86 deletions(-)
net/mac80211/michael.c +12 -5
@@ -8,6 +8,7 @@*/ #include <linux/types.h> #include <linux/bitops.h> +#include <linux/ieee80211.h> #include <asm/unaligned.h> #include "michael.h"
@@ -26,9 +27,15 @@ static void michael_block(struct michael_mic_ctx *mctx, u32 val) mctx->l += mctx->r; } -static void michael_mic_hdr (struct michael_mic_ctx *mctx, -const u8 *key,const u8 *da,const u8 *sa,u8 priority) +static void michael_mic_hdr (struct michael_mic_ctx *mctx,const u8 *key, +const struct ieee80211_hdr *hdr) { +u8 *da, *sa, tid; + + da =ieee80211_get_DA (hdr); + sa =ieee80211_get_SA (hdr); + tid = *ieee80211_get_qos_ctl (hdr) &0x0f ; + mctx->l =get_unaligned_le32 (key); mctx->r =get_unaligned_le32 (key +4 );
@@ -40,17 +47,17 @@ static void michael_mic_hdr(struct michael_mic_ctx *mctx,michael_block (mctx,get_unaligned_le16 (&da[4 ]) | (get_unaligned_le16 (sa) <<16 ));michael_block (mctx,get_unaligned_le32 (&sa[2 ])); -michael_block (mctx, priority); +michael_block (mctx, tid); } -void michael_mic (const u8 *key,const u8 *da,const u8 *sa,u8 priority, +void michael_mic (const u8 *key,const struct ieee80211_hdr *hdr,const u8 *data,size_t data_len,u8 *mic) {u32 val;size_t block, blocks, left;struct michael_mic_ctx mctx; -michael_mic_hdr (&mctx, key, da, sa, priority); +michael_mic_hdr (&mctx, key, hdr);/* Real data */ blocks = data_len /4 ;
net/mac80211/michael.h +1 -1
@@ -18,7 +18,7 @@ struct michael_mic_ctx { u32 l, r; }; -void michael_mic (const u8 *key,const u8 *da,const u8 *sa,u8 priority, +void michael_mic (const u8 *key,const struct ieee80211_hdr *hdr,const u8 *data,size_t data_len,u8 *mic);#endif /* MICHAEL_H */
net/mac80211/wpa.c +59 -80
218 lines not on this page · raw message
Signature · 1 line
1.5.6.290.gc4e15
Quoted 1 line
From
43070f098527c6f9022a83eb41e95b166e6d8605Mon Sep 17 00:00:00 2001
From: Harvey Harrison <[email protected]>
Date: Mon, 23 Jun 2008 14:21:13 -0700
Subject: [PATCH] mac80211: fix incorrect bit masking from previous patch
Checked ieee802.11-2007 and saw I changed this to mask one too many bits, the original comment is correct.
--- net/mac80211/wpa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/wpa.c +1 -1
@@ -322,7 +322,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,* Retry, PwrMgt, MoreData; set Protected */ msk_fc = hdr->frame_control; - msk_fc &= ~cpu_to_le16 (IEEE80211_FCTL_STYPE |IEEE80211_FCTL_RETRY | + msk_fc &= ~cpu_to_le16 (0x0070 |IEEE80211_FCTL_RETRY |IEEE80211_FCTL_PM |IEEE80211_FCTL_MOREDATA ); msk_fc |=cpu_to_le16 (IEEE80211_FCTL_PROTECTED );put_unaligned (msk_fc, (__le16 *)(aad +2 ));
Signature · 1 line
1.5.6.290.gc4e15
Quoted 7 lines · Harvey Harrison
Quoted 1 line
From
43070f098527c6f9022a83eb41e95b166e6d8605Mon Sep 17 00:00:00 2001From: Harvey Harrison <[email protected]>
Date: Mon, 23 Jun 2008 14:21:13 -0700
Subject: [PATCH] mac80211: fix incorrect bit masking from previous patchChecked ieee802.11-2007 and saw I changed this to mask one too many bits, the original comment is correct.
Would you mind posting a combined patch?
John
Signature · 2 lines
John W. Linville [email protected]
Move the address selection into the michale_mic header calculation helper and pass a pointer to the ieee80211_hdr directly.
Reorganize ccmp_special_blocks while eliminating the unneeded sa/da/qos variables.
---
John, combined patch with fixed masking, as you requested.
net/mac80211/michael.c | 17 ++++-- net/mac80211/michael.h | 2 +- net/mac80211/wpa.c | 139 ++++++++++++++++++++--------------------------- 3 files changed, 72 insertions(+), 86 deletions(-)
net/mac80211/michael.c +12 -5
@@ -8,6 +8,7 @@*/ #include <linux/types.h> #include <linux/bitops.h> +#include <linux/ieee80211.h> #include <asm/unaligned.h> #include "michael.h"
@@ -26,9 +27,15 @@ static void michael_block(struct michael_mic_ctx *mctx, u32 val) mctx->l += mctx->r; } -static void michael_mic_hdr (struct michael_mic_ctx *mctx, -const u8 *key,const u8 *da,const u8 *sa,u8 priority) +static void michael_mic_hdr (struct michael_mic_ctx *mctx,const u8 *key, +const struct ieee80211_hdr *hdr) { +u8 *da, *sa, tid; + + da =ieee80211_get_DA (hdr); + sa =ieee80211_get_SA (hdr); + tid = *ieee80211_get_qos_ctl (hdr) &0x0f ; + mctx->l =get_unaligned_le32 (key); mctx->r =get_unaligned_le32 (key +4 );
@@ -40,17 +47,17 @@ static void michael_mic_hdr(struct michael_mic_ctx *mctx,michael_block (mctx,get_unaligned_le16 (&da[4 ]) | (get_unaligned_le16 (sa) <<16 ));michael_block (mctx,get_unaligned_le32 (&sa[2 ])); -michael_block (mctx, priority); +michael_block (mctx, tid); } -void michael_mic (const u8 *key,const u8 *da,const u8 *sa,u8 priority, +void michael_mic (const u8 *key,const struct ieee80211_hdr *hdr,const u8 *data,size_t data_len,u8 *mic) {u32 val;size_t block, blocks, left;struct michael_mic_ctx mctx; -michael_mic_hdr (&mctx, key, da, sa, priority); +michael_mic_hdr (&mctx, key, hdr);/* Real data */ blocks = data_len /4 ;
net/mac80211/michael.h +1 -1
@@ -18,7 +18,7 @@ struct michael_mic_ctx { u32 l, r; }; -void michael_mic (const u8 *key,const u8 *da,const u8 *sa,u8 priority, +void michael_mic (const u8 *key,const struct ieee80211_hdr *hdr,const u8 *data,size_t data_len,u8 *mic);#endif /* MICHAEL_H */
net/mac80211/wpa.c +59 -80
218 lines not on this page · raw message
Signature · 1 line
1.5.6.290.gc4e15