aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wpa.c
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-07-02 14:05:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-08 14:16:00 -0400
commit73e1f7c823252d671361cddde0b498bf2c0fe4e1 (patch)
tree16b9d66d4317825241d7e6de7bac90c313a7055d /net/mac80211/wpa.c
parent238f74a227fd7de8ea1bc66dcbbd36cf9920d1cb (diff)
mac80211: use symbolic defines in wpa.c
ETH_ALEN and IEEE80211_QOS_CTL_LEN Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wpa.c')
-rw-r--r--net/mac80211/wpa.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index b414d5d92f38..222001c47d89 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -38,7 +38,7 @@ static int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
38 *data_len = skb->len - hdrlen; 38 *data_len = skb->len - hdrlen;
39 39
40 if (ieee80211_is_data_qos(fc)) 40 if (ieee80211_is_data_qos(fc))
41 *qos_tid = (*ieee80211_get_qos_ctl(hdr) & 0x0f) | 0x80; 41 *qos_tid = (*ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK) | 0x80;
42 else 42 else
43 *qos_tid = 0; 43 *qos_tid = 0;
44 44
@@ -312,7 +312,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
312 data_len -= CCMP_HDR_LEN + (encrypted ? CCMP_MIC_LEN : 0); 312 data_len -= CCMP_HDR_LEN + (encrypted ? CCMP_MIC_LEN : 0);
313 if (qos_tid & 0x80) { 313 if (qos_tid & 0x80) {
314 qos_included = 1; 314 qos_included = 1;
315 qos_tid &= 0x0f; 315 qos_tid &= IEEE80211_QOS_CTL_TID_MASK;
316 } else 316 } else
317 qos_included = 0; 317 qos_included = 0;
318 /* First block, b_0 */ 318 /* First block, b_0 */
@@ -320,7 +320,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
320 b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ 320 b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
321 /* Nonce: QoS Priority | A2 | PN */ 321 /* Nonce: QoS Priority | A2 | PN */
322 b_0[1] = qos_tid; 322 b_0[1] = qos_tid;
323 memcpy(&b_0[2], hdr->addr2, 6); 323 memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
324 memcpy(&b_0[8], pn, CCMP_PN_LEN); 324 memcpy(&b_0[8], pn, CCMP_PN_LEN);
325 /* l(m) */ 325 /* l(m) */
326 b_0[14] = (data_len >> 8) & 0xff; 326 b_0[14] = (data_len >> 8) & 0xff;
@@ -332,7 +332,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
332 332
333 len_a = a4_included ? 28 : 22; 333 len_a = a4_included ? 28 : 22;
334 if (qos_included) 334 if (qos_included)
335 len_a += 2; 335 len_a += IEEE80211_QOS_CTL_LEN;
336 336
337 aad[0] = 0; /* (len_a >> 8) & 0xff; */ 337 aad[0] = 0; /* (len_a >> 8) & 0xff; */
338 aad[1] = len_a & 0xff; 338 aad[1] = len_a & 0xff;
@@ -340,17 +340,17 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
340 aad[2] = fc_pos[0] & ~(BIT(4) | BIT(5) | BIT(6)); 340 aad[2] = fc_pos[0] & ~(BIT(4) | BIT(5) | BIT(6));
341 /* Retry, PwrMgt, MoreData; set Protected */ 341 /* Retry, PwrMgt, MoreData; set Protected */
342 aad[3] = (fc_pos[1] & ~(BIT(3) | BIT(4) | BIT(5))) | BIT(6); 342 aad[3] = (fc_pos[1] & ~(BIT(3) | BIT(4) | BIT(5))) | BIT(6);
343 memcpy(&aad[4], &hdr->addr1, 18); 343 memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
344 344
345 /* Mask Seq#, leave Frag# */ 345 /* Mask Seq#, leave Frag# */
346 aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; 346 aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f;
347 aad[23] = 0; 347 aad[23] = 0;
348 if (a4_included) { 348 if (a4_included) {
349 memcpy(&aad[24], hdr->addr4, 6); 349 memcpy(&aad[24], hdr->addr4, ETH_ALEN);
350 aad[30] = 0; 350 aad[30] = 0;
351 aad[31] = 0; 351 aad[31] = 0;
352 } else 352 } else
353 memset(&aad[24], 0, 8); 353 memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
354 if (qos_included) { 354 if (qos_included) {
355 u8 *dpos = &aad[a4_included ? 30 : 24]; 355 u8 *dpos = &aad[a4_included ? 30 : 24];
356 356