Skip to content

Commit 8bca5d8

Browse files
jmberg-intellinvjw
authored andcommitted
mac80211: allow driver access to TKIP RX P1K
When the driver wants to pre-program the TKIP RX phase 1 key, it needs to be able to obtain it for the peer's TA. Add API to allow it to generate it. The generation uses a dummy on-stack context since it doesn't know the RX queue. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 66760ea commit 8bca5d8

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎include/net/mac80211.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,6 +2612,20 @@ static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf,
26122612
ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k);
26132613
}
26142614

2615+
/**
2616+
* ieee80211_get_tkip_rx_p1k - get a TKIP phase 1 key for RX
2617+
*
2618+
* This function returns the TKIP phase 1 key for the given IV32
2619+
* and transmitter address.
2620+
*
2621+
* @keyconf: the parameter passed with the set key
2622+
* @ta: TA that will be used with the key
2623+
* @iv32: IV32 to get the P1K for
2624+
* @p1k: a buffer to which the key will be written, as 5 u16 values
2625+
*/
2626+
void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
2627+
const u8 *ta, u32 iv32, u16 *p1k);
2628+
26152629
/**
26162630
* ieee80211_get_tkip_p2k - get a TKIP phase 2 key
26172631
*

‎net/mac80211/tkip.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf,
185185
}
186186
EXPORT_SYMBOL(ieee80211_get_tkip_p1k_iv);
187187

188+
void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
189+
const u8 *ta, u32 iv32, u16 *p1k)
190+
{
191+
const u8 *tk = &keyconf->key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
192+
struct tkip_ctx ctx;
193+
194+
tkip_mixing_phase1(tk, &ctx, ta, iv32);
195+
memcpy(p1k, ctx.p1k, sizeof(ctx.p1k));
196+
}
197+
EXPORT_SYMBOL(ieee80211_get_tkip_rx_p1k);
198+
188199
void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
189200
struct sk_buff *skb, u8 *p2k)
190201
{

0 commit comments

Comments
 (0)