Staging: rtl8187se/ieee80211: remove superfluous JOHN_* ifdefs
PATCH 6/6 Staging: rtl8187se/ieee80211: remove superfluous JOHN_* ifdefs
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
--- drivers/staging/rtl8187se/ieee80211/ieee80211.h | 3 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | 13 ---- drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c | 42 +------------ drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c | 12 --- 4 files changed, 10 insertions(+), 60 deletions(-)
drivers/staging/rtl8187se/ieee80211/ieee80211.h +0 -3
@@ -45,14 +45,11 @@#endif */ -//#ifdef JOHN_HWSEC #define KEY_TYPE_NA 0x0#define KEY_TYPE_WEP40 0x1#define KEY_TYPE_TKIP 0x2#define KEY_TYPE_CCMP 0x4#define KEY_TYPE_WEP104 0x5 -//#endif -#define aSifsTime 10
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +3 -10
@@ -118,7 +118,6 @@ static inline void xor_block(u8 *b, u8 * b[i] ^= a[i]; } -#ifndef JOHN_CCMP static void ccmp_init_blocks(struct crypto_tfm *tfm, struct ieee80211_hdr *hdr, u8 *pn, size_t dlen, u8 *b0, u8 *auth,
@@ -196,7 +195,6 @@ static void ccmp_init_blocks(struct cryp b0[14 ] = b0[15 ] =0 ;ieee80211_ccmp_aes_encrypt (tfm, b0, s0); } -#endif static int ieee80211_ccmp_encrypt (struct sk_buff *skb,int hdr_len,void *priv) {
@@ -204,14 +202,13 @@ static int ieee80211_ccmp_encrypt(structint data_len, i;u8 *pos;struct ieee80211_hdr *hdr; -#ifndef JOHN_CCMP int blocks, last, len;u8 *mic;u8 *b0 = key->tx_b0;u8 *b = key->tx_b;u8 *e = key->tx_e;u8 *s0 = key->tx_s0; -#endif +if (skb_headroom (skb) <CCMP_HDR_LEN ||skb_tailroom (skb) <CCMP_MIC_LEN || skb->len < hdr_len)
@@ -241,7 +238,6 @@ static int ieee80211_ccmp_encrypt(struct *pos++ = key->tx_pn[0 ]; hdr = (struct ieee80211_hdr *) skb->data; -#ifndef JOHN_CCMP //mic is moved to here by john mic =skb_put (skb,CCMP_MIC_LEN );
@@ -265,7 +261,7 @@ static int ieee80211_ccmp_encrypt(structfor (i =0 ; i <CCMP_MIC_LEN ; i++) mic[i] = b[i] ^ s0[i]; -#endif +return 0 ; }
@@ -276,14 +272,13 @@ static int ieee80211_ccmp_decrypt(structu8 keyidx, *pos;struct ieee80211_hdr *hdr;u8 pn[6 ]; -#ifndef JOHN_CCMP size_t data_len = skb->len - hdr_len -CCMP_HDR_LEN -CCMP_MIC_LEN ;u8 *mic = skb->data + skb->len -CCMP_MIC_LEN ;u8 *b0 = key->rx_b0;u8 *b = key->rx_b;u8 *a = key->rx_a;int i, blocks, last, len; -#endif +if (skb->len < hdr_len +CCMP_HDR_LEN +CCMP_MIC_LEN ) { key->dot11RSNAStatsCCMPFormatErrors++;return -1 ;
@@ -335,7 +330,6 @@ static int ieee80211_ccmp_decrypt(structreturn -4 ; } -#ifndef JOHN_CCMP ccmp_init_blocks (key->tfm, hdr, pn, data_len, b0, a, b);xor_block (mic, b,CCMP_MIC_LEN );
@@ -366,7 +360,6 @@ static int ieee80211_ccmp_decrypt(structmemcpy (key->rx_pn, pn,CCMP_PN_LEN ); -#endif /* Remove hdr and MIC */ memmove (skb->data +CCMP_HDR_LEN , skb->data, hdr_len);skb_pull (skb,CCMP_HDR_LEN );
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +4 -38
129 lines not on this page · raw message
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c +3 -9
@@ -116,11 +116,10 @@ static int prism2_wep_encrypt(struct sk_u32 klen, len;u8 key[WEP_KEY_LEN +3 ];u8 *pos; -#ifndef JOHN_HWSEC u32 crc;u8 *icv;struct scatterlist sg; -#endif +if (skb_headroom (skb) <4 ||skb_tailroom (skb) <4 || skb->len < hdr_len)return -1 ;
@@ -152,7 +151,6 @@ static int prism2_wep_encrypt(struct sk_/* Copy rest of the WEP key (the secret part) */ memcpy (key +3 , wep->key, wep->key_len); -#ifndef JOHN_HWSEC /* Append little-endian CRC32 and encrypt it to produce ICV */ crc = ~crc32_le (~0 , pos, len); icv =skb_put (skb,4 );
@@ -165,8 +163,6 @@ static int prism2_wep_encrypt(struct sk_sg_init_one (&sg, pos, len +4 );return crypto_blkcipher_encrypt (&desc, &sg, &sg, len +4 ); -#endif /* JOHN_HWSEC */ -return 0 ; }
@@ -184,11 +180,10 @@ static int prism2_wep_decrypt(struct sk_u32 klen, plen;u8 key[WEP_KEY_LEN +3 ];u8 keyidx, *pos; -#ifndef JOHN_HWSEC u32 crc;u8 icv[4 ];struct scatterlist sg; -#endif +if (skb->len < hdr_len +8 )return -1 ;
@@ -207,7 +202,7 @@ static int prism2_wep_decrypt(struct sk_/* Apply RC4 to data and compute CRC32 over decrypted data */ plen = skb->len - hdr_len -8 ; -#ifndef JOHN_HWSEC +crypto_blkcipher_setkey (wep->rx_tfm, key, klen);sg_init_one (&sg, pos, plen +4 );
@@ -224,7 +219,6 @@ static int prism2_wep_decrypt(struct sk_/* ICV mismatch - drop frame */ return -2 ; } -#endif /* JOHN_HWSEC */ /* Remove IV and ICV */ memmove (skb->data +4 , skb->data, hdr_len);