diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-07-02 14:05:35 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-07-08 14:16:01 -0400 |
commit | 8e8862b79d2ce9177bfddd85b8328a86a25c69b2 (patch) | |
tree | 595f0a47cf20800ee895c9cd6e98817ac1ff71ba /net/mac80211/michael.c | |
parent | f14df8049f9c9f34164dd598772fecea83a394a2 (diff) |
mac80211: remove ieee80211_get_hdr_info
Do the check for sufficient skb->len explicitly and pass a pointer
to the struct ieee80211_hdr directly to the michael_mic calculation.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/michael.c')
-rw-r--r-- | net/mac80211/michael.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/net/mac80211/michael.c b/net/mac80211/michael.c index 1fcdf38cf60c..408649bd4702 100644 --- a/net/mac80211/michael.c +++ b/net/mac80211/michael.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/bitops.h> | 10 | #include <linux/bitops.h> |
11 | #include <linux/ieee80211.h> | ||
11 | #include <asm/unaligned.h> | 12 | #include <asm/unaligned.h> |
12 | 13 | ||
13 | #include "michael.h" | 14 | #include "michael.h" |
@@ -26,9 +27,18 @@ static void michael_block(struct michael_mic_ctx *mctx, u32 val) | |||
26 | mctx->l += mctx->r; | 27 | mctx->l += mctx->r; |
27 | } | 28 | } |
28 | 29 | ||
29 | static void michael_mic_hdr(struct michael_mic_ctx *mctx, | 30 | static void michael_mic_hdr(struct michael_mic_ctx *mctx, const u8 *key, |
30 | const u8 *key, const u8 *da, const u8 *sa, u8 priority) | 31 | struct ieee80211_hdr *hdr) |
31 | { | 32 | { |
33 | u8 *da, *sa, tid; | ||
34 | |||
35 | da = ieee80211_get_DA(hdr); | ||
36 | sa = ieee80211_get_SA(hdr); | ||
37 | if (ieee80211_is_data_qos(hdr->frame_control)) | ||
38 | tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; | ||
39 | else | ||
40 | tid = 0; | ||
41 | |||
32 | mctx->l = get_unaligned_le32(key); | 42 | mctx->l = get_unaligned_le32(key); |
33 | mctx->r = get_unaligned_le32(key + 4); | 43 | mctx->r = get_unaligned_le32(key + 4); |
34 | 44 | ||
@@ -40,17 +50,17 @@ static void michael_mic_hdr(struct michael_mic_ctx *mctx, | |||
40 | michael_block(mctx, get_unaligned_le16(&da[4]) | | 50 | michael_block(mctx, get_unaligned_le16(&da[4]) | |
41 | (get_unaligned_le16(sa) << 16)); | 51 | (get_unaligned_le16(sa) << 16)); |
42 | michael_block(mctx, get_unaligned_le32(&sa[2])); | 52 | michael_block(mctx, get_unaligned_le32(&sa[2])); |
43 | michael_block(mctx, priority); | 53 | michael_block(mctx, tid); |
44 | } | 54 | } |
45 | 55 | ||
46 | void michael_mic(const u8 *key, const u8 *da, const u8 *sa, u8 priority, | 56 | void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, |
47 | const u8 *data, size_t data_len, u8 *mic) | 57 | const u8 *data, size_t data_len, u8 *mic) |
48 | { | 58 | { |
49 | u32 val; | 59 | u32 val; |
50 | size_t block, blocks, left; | 60 | size_t block, blocks, left; |
51 | struct michael_mic_ctx mctx; | 61 | struct michael_mic_ctx mctx; |
52 | 62 | ||
53 | michael_mic_hdr(&mctx, key, da, sa, priority); | 63 | michael_mic_hdr(&mctx, key, hdr); |
54 | 64 | ||
55 | /* Real data */ | 65 | /* Real data */ |
56 | blocks = data_len / 4; | 66 | blocks = data_len / 4; |