lib80211: Introduce TKIP_HDR_LEN define for code clarity
PATCH 1/1 lib80211: Introduce TKIP_HDR_LEN define for code clarity
Introduce TKIP_HDR_LEN define for code clarity (in the same way as CCMP_HDR_LEN).
Also odd len variable (not used) dropped from lib80211_tkip_hdr().
--- net/wireless/lib80211_crypt_tkip.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
(quoted diff) +0 -0
b/net/wireless/lib80211_crypt_tkip.c
index c362873..c4fb4fb 100644
net/wireless/lib80211_crypt_tkip.c +2 -0
@@ -36,6 +36,8 @@ MODULE_AUTHOR("Jouni Malinen");MODULE_DESCRIPTION ("lib80211 crypt: TKIP" );MODULE_LICENSE ("GPL" ); +#define TKIP_HDR_LEN 8 +struct lib80211_tkip_data {#define TKIP_KEY_LEN 32u8 key[TKIP_KEY_LEN ];
@@ -314,13 +316,12 @@ static int lib80211_tkip_hdr(struct sk_buff *skb,
int hdr_len,
u8 * rc4key, int keylen, void *priv)
{
struct lib80211_tkip_data *tkey = priv;
- int len;
u8 *pos;
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *)skb->data;
- if (skb_headroom(skb) < 8 || skb->len < hdr_len)
+ if (skb_headroom(skb) < TKIP_HDR_LEN || skb->len < hdr_len)
return -1;
if (rc4key == NULL || keylen < 16)
@@ -333,9 +334,8 @@ static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len,
}
tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
- len = skb->len - hdr_len;
- pos = skb_push(skb, 8);
- memmove(pos, pos + 8, hdr_len);
+ pos = skb_push(skb, TKIP_HDR_LEN);
+ memmove(pos, pos + TKIP_HDR_LEN, hdr_len);
pos += hdr_len;
*pos++ = *rc4key;
@@ -353,7 +353,7 @@ static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len,
tkey->tx_iv32++;
}
- return 8;
+ return TKIP_HDR_LEN;
}
static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void
*priv)
Quoted 26 lines · Andriy Tkachuk
Introduce
TKIP_HDR_LENdefine for code clarity (in the same way asCCMP_HDR_LEN).Also odd len variable (not used) dropped from
lib80211_tkip_hdr().Signed-off-by Andriy V. Tkachuk <[email protected]>--- net/wireless/lib80211_crypt_tkip.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)net/wireless/lib80211_crypt_tkip.c +2
-0@@ -36,6 +36,8 @@ MODULE_AUTHOR("Jouni Malinen");MODULE_DESCRIPTION ("lib80211 crypt: TKIP" );MODULE_LICENSE ("GPL" ); +#define TKIP_HDR_LEN 8 +struct lib80211_tkip_data {#define TKIP_KEY_LEN 32u8 key[TKIP_KEY_LEN ];
net/wireless/lib80211_crypt_tkip.c static int lib80211_tkip_hdr(struct sk_buff *skb, · line 316
Quoted 1 line
net/wireless/lib80211_crypt_tkip.c +0
-0@@ -314,13 +316,12 @@ static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len,
After a quick look, this and the other patch look fine. But, the patches are whitespace-damaged. I can fix these, but in the future please be sure to use a mailer that does not break lines. I recommend mutt and/or 'git send-email'.
Thanks,
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.