diff options
Diffstat (limited to 'drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c')
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c index 21f09c62cff..2651811ad39 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -118,7 +118,6 @@ static inline void xor_block(u8 *b, u8 *a, size_t len) | |||
118 | b[i] ^= a[i]; | 118 | b[i] ^= a[i]; |
119 | } | 119 | } |
120 | 120 | ||
121 | #ifndef JOHN_CCMP | ||
122 | static void ccmp_init_blocks(struct crypto_tfm *tfm, | 121 | static void ccmp_init_blocks(struct crypto_tfm *tfm, |
123 | struct ieee80211_hdr *hdr, | 122 | struct ieee80211_hdr *hdr, |
124 | u8 *pn, size_t dlen, u8 *b0, u8 *auth, | 123 | u8 *pn, size_t dlen, u8 *b0, u8 *auth, |
@@ -196,7 +195,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
196 | b0[14] = b0[15] = 0; | 195 | b0[14] = b0[15] = 0; |
197 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); | 196 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); |
198 | } | 197 | } |
199 | #endif | ||
200 | 198 | ||
201 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | 199 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
202 | { | 200 | { |
@@ -204,14 +202,13 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
204 | int data_len, i; | 202 | int data_len, i; |
205 | u8 *pos; | 203 | u8 *pos; |
206 | struct ieee80211_hdr *hdr; | 204 | struct ieee80211_hdr *hdr; |
207 | #ifndef JOHN_CCMP | ||
208 | int blocks, last, len; | 205 | int blocks, last, len; |
209 | u8 *mic; | 206 | u8 *mic; |
210 | u8 *b0 = key->tx_b0; | 207 | u8 *b0 = key->tx_b0; |
211 | u8 *b = key->tx_b; | 208 | u8 *b = key->tx_b; |
212 | u8 *e = key->tx_e; | 209 | u8 *e = key->tx_e; |
213 | u8 *s0 = key->tx_s0; | 210 | u8 *s0 = key->tx_s0; |
214 | #endif | 211 | |
215 | if (skb_headroom(skb) < CCMP_HDR_LEN || | 212 | if (skb_headroom(skb) < CCMP_HDR_LEN || |
216 | skb_tailroom(skb) < CCMP_MIC_LEN || | 213 | skb_tailroom(skb) < CCMP_MIC_LEN || |
217 | skb->len < hdr_len) | 214 | skb->len < hdr_len) |
@@ -241,7 +238,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
241 | *pos++ = key->tx_pn[0]; | 238 | *pos++ = key->tx_pn[0]; |
242 | 239 | ||
243 | hdr = (struct ieee80211_hdr *) skb->data; | 240 | hdr = (struct ieee80211_hdr *) skb->data; |
244 | #ifndef JOHN_CCMP | ||
245 | //mic is moved to here by john | 241 | //mic is moved to here by john |
246 | mic = skb_put(skb, CCMP_MIC_LEN); | 242 | mic = skb_put(skb, CCMP_MIC_LEN); |
247 | 243 | ||
@@ -265,7 +261,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
265 | 261 | ||
266 | for (i = 0; i < CCMP_MIC_LEN; i++) | 262 | for (i = 0; i < CCMP_MIC_LEN; i++) |
267 | mic[i] = b[i] ^ s0[i]; | 263 | mic[i] = b[i] ^ s0[i]; |
268 | #endif | 264 | |
269 | return 0; | 265 | return 0; |
270 | } | 266 | } |
271 | 267 | ||
@@ -276,14 +272,13 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
276 | u8 keyidx, *pos; | 272 | u8 keyidx, *pos; |
277 | struct ieee80211_hdr *hdr; | 273 | struct ieee80211_hdr *hdr; |
278 | u8 pn[6]; | 274 | u8 pn[6]; |
279 | #ifndef JOHN_CCMP | ||
280 | size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; | 275 | size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; |
281 | u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; | 276 | u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; |
282 | u8 *b0 = key->rx_b0; | 277 | u8 *b0 = key->rx_b0; |
283 | u8 *b = key->rx_b; | 278 | u8 *b = key->rx_b; |
284 | u8 *a = key->rx_a; | 279 | u8 *a = key->rx_a; |
285 | int i, blocks, last, len; | 280 | int i, blocks, last, len; |
286 | #endif | 281 | |
287 | if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { | 282 | if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { |
288 | key->dot11RSNAStatsCCMPFormatErrors++; | 283 | key->dot11RSNAStatsCCMPFormatErrors++; |
289 | return -1; | 284 | return -1; |
@@ -335,7 +330,6 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
335 | return -4; | 330 | return -4; |
336 | } | 331 | } |
337 | 332 | ||
338 | #ifndef JOHN_CCMP | ||
339 | ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); | 333 | ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); |
340 | xor_block(mic, b, CCMP_MIC_LEN); | 334 | xor_block(mic, b, CCMP_MIC_LEN); |
341 | 335 | ||
@@ -366,7 +360,6 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
366 | 360 | ||
367 | memcpy(key->rx_pn, pn, CCMP_PN_LEN); | 361 | memcpy(key->rx_pn, pn, CCMP_PN_LEN); |
368 | 362 | ||
369 | #endif | ||
370 | /* Remove hdr and MIC */ | 363 | /* Remove hdr and MIC */ |
371 | memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len); | 364 | memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len); |
372 | skb_pull(skb, CCMP_HDR_LEN); | 365 | skb_pull(skb, CCMP_HDR_LEN); |