summaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2016-02-14 06:56:35 -0500
committerJohannes Berg <johannes.berg@intel.com>2016-02-24 03:04:38 -0500
commitf8079d43cf0f1f0171606e75fcef6fe17bb183f2 (patch)
tree33ba813097bcab2d8a43f502e49bea9a31ba3181 /include/net/mac80211.h
parent109843b07aed8663a3c1fe9ef02c540b6ff203b4 (diff)
mac80211: move TKIP TX IVs to public part of key struct
Some drivers/devices might want to set the IVs by themselves (and still let mac80211 generate MMIC). Specifically, this is needed when the device does offloading at certain times, and the driver has to make sure that the IVs of new tx frames (from the host) are synchronized with IVs that were potentially used during the offloading. Similarly to CCMP, move the TX IVs of TKIP keys to the public part of the key struct, and export a function to add the IV right into the crypto header. The public tx_pn field is defined as atomic64, so define TKIP_PN_TO_IV16/32 helper macros to convert it to iv16/32 when needed. Since the iv32 used for the p1k cache is taken directly from the frame, we can safely remove iv16/32 from being protected by tkip.txlock. Signed-off-by: Eliad Peller <eliadx.peller@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 57147749ae42..15879b49baad 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1521,9 +1521,8 @@ enum ieee80211_key_flags {
1521 * wants to be given when a frame is transmitted and needs to be 1521 * wants to be given when a frame is transmitted and needs to be
1522 * encrypted in hardware. 1522 * encrypted in hardware.
1523 * @cipher: The key's cipher suite selector. 1523 * @cipher: The key's cipher suite selector.
1524 * @tx_pn: PN used for TX on non-TKIP keys, may be used by the driver 1524 * @tx_pn: PN used for TX keys, may be used by the driver as well if it
1525 * as well if it needs to do software PN assignment by itself 1525 * needs to do software PN assignment by itself (e.g. due to TSO)
1526 * (e.g. due to TSO)
1527 * @flags: key flags, see &enum ieee80211_key_flags. 1526 * @flags: key flags, see &enum ieee80211_key_flags.
1528 * @keyidx: the key index (0-3) 1527 * @keyidx: the key index (0-3)
1529 * @keylen: key material length 1528 * @keylen: key material length
@@ -1549,6 +1548,9 @@ struct ieee80211_key_conf {
1549 1548
1550#define IEEE80211_MAX_PN_LEN 16 1549#define IEEE80211_MAX_PN_LEN 16
1551 1550
1551#define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff))
1552#define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff))
1553
1552/** 1554/**
1553 * struct ieee80211_key_seq - key sequence counter 1555 * struct ieee80211_key_seq - key sequence counter
1554 * 1556 *
@@ -4447,6 +4449,21 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
4447 struct sk_buff *skb, u8 *p2k); 4449 struct sk_buff *skb, u8 *p2k);
4448 4450
4449/** 4451/**
4452 * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos
4453 *
4454 * @pos: start of crypto header
4455 * @keyconf: the parameter passed with the set key
4456 * @pn: PN to add
4457 *
4458 * Returns: pointer to the octet following IVs (i.e. beginning of
4459 * the packet payload)
4460 *
4461 * This function writes the tkip IV value to pos (which should
4462 * point to the crypto header)
4463 */
4464u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn);
4465
4466/**
4450 * ieee80211_get_key_tx_seq - get key TX sequence counter 4467 * ieee80211_get_key_tx_seq - get key TX sequence counter
4451 * 4468 *
4452 * @keyconf: the parameter passed with the set key 4469 * @keyconf: the parameter passed with the set key