diff options
-rw-r--r-- | include/net/mac80211.h | 24 | ||||
-rw-r--r-- | net/mac80211/tkip.c | 9 |
2 files changed, 25 insertions, 8 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 84770cedae2d..b29456a945c2 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/ieee80211.h> | 21 | #include <linux/ieee80211.h> |
22 | #include <net/cfg80211.h> | 22 | #include <net/cfg80211.h> |
23 | #include <asm/unaligned.h> | ||
23 | 24 | ||
24 | /** | 25 | /** |
25 | * DOC: Introduction | 26 | * DOC: Introduction |
@@ -2564,6 +2565,18 @@ struct sk_buff * | |||
2564 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 2565 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
2565 | 2566 | ||
2566 | /** | 2567 | /** |
2568 | * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32 | ||
2569 | * | ||
2570 | * This function returns the TKIP phase 1 key for the given IV32. | ||
2571 | * | ||
2572 | * @keyconf: the parameter passed with the set key | ||
2573 | * @iv32: IV32 to get the P1K for | ||
2574 | * @p1k: a buffer to which the key will be written, as 5 u16 values | ||
2575 | */ | ||
2576 | void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf, | ||
2577 | u32 iv32, u16 *p1k); | ||
2578 | |||
2579 | /** | ||
2567 | * ieee80211_get_tkip_p1k - get a TKIP phase 1 key | 2580 | * ieee80211_get_tkip_p1k - get a TKIP phase 1 key |
2568 | * | 2581 | * |
2569 | * This function returns the TKIP phase 1 key for the IV32 taken | 2582 | * This function returns the TKIP phase 1 key for the IV32 taken |
@@ -2574,8 +2587,15 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | |||
2574 | * with this P1K | 2587 | * with this P1K |
2575 | * @p1k: a buffer to which the key will be written, as 5 u16 values | 2588 | * @p1k: a buffer to which the key will be written, as 5 u16 values |
2576 | */ | 2589 | */ |
2577 | void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, | 2590 | static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, |
2578 | struct sk_buff *skb, u16 *p1k); | 2591 | struct sk_buff *skb, u16 *p1k) |
2592 | { | ||
2593 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
2594 | const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); | ||
2595 | u32 iv32 = get_unaligned_le32(&data[4]); | ||
2596 | |||
2597 | ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k); | ||
2598 | } | ||
2579 | 2599 | ||
2580 | /** | 2600 | /** |
2581 | * ieee80211_get_tkip_p2k - get a TKIP phase 2 key | 2601 | * ieee80211_get_tkip_p2k - get a TKIP phase 2 key |
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index de570b38460f..cc79e697cdb2 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -170,15 +170,12 @@ static void ieee80211_compute_tkip_p1k(struct ieee80211_key *key, u32 iv32) | |||
170 | tkip_mixing_phase1(tk, ctx, sdata->vif.addr, iv32); | 170 | tkip_mixing_phase1(tk, ctx, sdata->vif.addr, iv32); |
171 | } | 171 | } |
172 | 172 | ||
173 | void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, | 173 | void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf, |
174 | struct sk_buff *skb, u16 *p1k) | 174 | u32 iv32, u16 *p1k) |
175 | { | 175 | { |
176 | struct ieee80211_key *key = (struct ieee80211_key *) | 176 | struct ieee80211_key *key = (struct ieee80211_key *) |
177 | container_of(keyconf, struct ieee80211_key, conf); | 177 | container_of(keyconf, struct ieee80211_key, conf); |
178 | struct tkip_ctx *ctx = &key->u.tkip.tx; | 178 | struct tkip_ctx *ctx = &key->u.tkip.tx; |
179 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
180 | const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); | ||
181 | u32 iv32 = get_unaligned_le32(&data[4]); | ||
182 | unsigned long flags; | 179 | unsigned long flags; |
183 | 180 | ||
184 | spin_lock_irqsave(&key->u.tkip.txlock, flags); | 181 | spin_lock_irqsave(&key->u.tkip.txlock, flags); |
@@ -186,7 +183,7 @@ void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, | |||
186 | memcpy(p1k, ctx->p1k, sizeof(ctx->p1k)); | 183 | memcpy(p1k, ctx->p1k, sizeof(ctx->p1k)); |
187 | spin_unlock_irqrestore(&key->u.tkip.txlock, flags); | 184 | spin_unlock_irqrestore(&key->u.tkip.txlock, flags); |
188 | } | 185 | } |
189 | EXPORT_SYMBOL(ieee80211_get_tkip_p1k); | 186 | EXPORT_SYMBOL(ieee80211_get_tkip_p1k_iv); |
190 | 187 | ||
191 | void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, | 188 | void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, |
192 | struct sk_buff *skb, u8 *p2k) | 189 | struct sk_buff *skb, u8 *p2k) |