mac80211: add a struct to hold tkip context
PATCH 5/7 mac80211: add a struct to hold tkip context
Signed-off-by Harvey Harrison <[email protected]>
--- net/mac80211/cfg.c | 4 +- net/mac80211/debugfs_key.c | 8 +++--- net/mac80211/key.h | 17 +++++++------ net/mac80211/tkip.c | 54 ++++++++++++++++++++++---------------------- net/mac80211/wpa.c | 16 ++++++------ 5 files changed, 50 insertions(+), 49 deletions(-)
net/mac80211/cfg.c +2 -2
@@ -256,8 +256,8 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,case ALG_TKIP : params.cipher =WLAN_CIPHER_SUITE_TKIP ; - iv32 = key->u.tkip.iv32; - iv16 = key->u.tkip.iv16; + iv32 = key->u.tkip.tx.iv32; + iv16 = key->u.tkip.tx.iv16;if (key->flags &KEY_FLAG_UPLOADED_TO_HARDWARE && sdata->local->ops->get_tkip_seq)
net/mac80211/debugfs_key.c +4 -4
@@ -97,8 +97,8 @@ static ssize_t key_tx_spec_read(struct file *file, char __user *userbuf,break ;case ALG_TKIP : len =scnprintf (buf,sizeof (buf),"%08x %04x\n" , - key->u.tkip.iv32, - key->u.tkip.iv16); + key->u.tkip.tx.iv32, + key->u.tkip.tx.iv16);break ;case ALG_CCMP : tpn = key->u.ccmp.tx_pn;
@@ -128,8 +128,8 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf,for (i =0 ; i <NUM_RX_DATA_QUEUES ; i++) p +=scnprintf (p,sizeof (buf)+buf-p,"%08x %04x\n" , - key->u.tkip.iv32_rx[i], - key->u.tkip.iv16_rx[i]); + key->u.tkip.rx[i].iv32, + key->u.tkip.rx[i].iv16); len = p - buf;break ;case ALG_CCMP :
net/mac80211/key.h +9 -8
@@ -69,6 +69,13 @@ enum ieee80211_internal_key_flags { KEY_FLAG_TODO_ADD_DEBUGFS = BIT(5), }; +struct tkip_ctx { +u32 iv32; +u16 iv16; +u16 p1k[5 ]; +int initialized; +}; +struct ieee80211_key {struct ieee80211_local *local;struct ieee80211_sub_if_data *sdata;
@@ -85,16 +92,10 @@ struct ieee80211_key {union {struct {/* last used TSC */ -u32 iv32; -u16 iv16; -u16 p1k[5 ]; -int tx_initialized; +struct tkip_ctx tx;/* last received RSC */ -u32 iv32_rx[NUM_RX_DATA_QUEUES ]; -u16 iv16_rx[NUM_RX_DATA_QUEUES ]; -u16 p1k_rx[NUM_RX_DATA_QUEUES ][5 ]; -int rx_initialized[NUM_RX_DATA_QUEUES ]; +struct tkip_ctx rx[NUM_RX_DATA_QUEUES ]; } tkip;struct {u8 tx_pn[6 ];
net/mac80211/tkip.c +27 -27
129 lines not on this page · raw message
net/mac80211/wpa.c +8 -8
@@ -176,8 +176,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)skb_trim (skb, skb->len -MICHAEL_MIC_LEN );/* update IV in key information to be able to detect replays */ - rx->key->u.tkip.iv32_rx[rx->queue] = rx->tkip_iv32; - rx->key->u.tkip.iv16_rx[rx->queue] = rx->tkip_iv16; + rx->key->u.tkip.rx[rx->queue].iv32 = rx->tkip_iv32; + rx->key->u.tkip.rx[rx->queue].iv16 = rx->tkip_iv16;return RX_CONTINUE ; }
@@ -214,19 +214,19 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, pos += hdrlen;/* Increase IV for the frame */ - key->u.tkip.iv16++; -if (key->u.tkip.iv16 ==0 ) - key->u.tkip.iv32++; + key->u.tkip.tx.iv16++; +if (key->u.tkip.tx.iv16 ==0 ) + key->u.tkip.tx.iv32++;if (tx->key->flags &KEY_FLAG_UPLOADED_TO_HARDWARE ) { hdr = (struct ieee80211_hdr *)skb->data;/* hwaccel - with preallocated room for IV */ ieee80211_tkip_add_iv (pos, key, - (u8) (key->u.tkip.iv16 >>8 ), - (u8) (((key->u.tkip.iv16 >>8 ) |0x20 ) & + (u8) (key->u.tkip.tx.iv16 >>8 ), + (u8) (((key->u.tkip.tx.iv16 >>8 ) |0x20 ) &0x7f ), - (u8 ) key->u.tkip.iv16); + (u8 ) key->u.tkip.tx.iv16); tx->control->key_idx = tx->key->conf.hw_key_idx;return 0 ;
Signature · 1 line
1.5.5.144.g3e42