提交 73e1f7c8 编写于 作者: H Harvey Harrison 提交者: John W. Linville

mac80211: use symbolic defines in wpa.c

ETH_ALEN and IEEE80211_QOS_CTL_LEN
Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 238f74a2
...@@ -38,7 +38,7 @@ static int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da, ...@@ -38,7 +38,7 @@ static int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
*data_len = skb->len - hdrlen; *data_len = skb->len - hdrlen;
if (ieee80211_is_data_qos(fc)) if (ieee80211_is_data_qos(fc))
*qos_tid = (*ieee80211_get_qos_ctl(hdr) & 0x0f) | 0x80; *qos_tid = (*ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK) | 0x80;
else else
*qos_tid = 0; *qos_tid = 0;
...@@ -312,7 +312,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad, ...@@ -312,7 +312,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
data_len -= CCMP_HDR_LEN + (encrypted ? CCMP_MIC_LEN : 0); data_len -= CCMP_HDR_LEN + (encrypted ? CCMP_MIC_LEN : 0);
if (qos_tid & 0x80) { if (qos_tid & 0x80) {
qos_included = 1; qos_included = 1;
qos_tid &= 0x0f; qos_tid &= IEEE80211_QOS_CTL_TID_MASK;
} else } else
qos_included = 0; qos_included = 0;
/* First block, b_0 */ /* 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,7 +320,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
/* Nonce: QoS Priority | A2 | PN */ /* Nonce: QoS Priority | A2 | PN */
b_0[1] = qos_tid; b_0[1] = qos_tid;
memcpy(&b_0[2], hdr->addr2, 6); memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
memcpy(&b_0[8], pn, CCMP_PN_LEN); memcpy(&b_0[8], pn, CCMP_PN_LEN);
/* l(m) */ /* l(m) */
b_0[14] = (data_len >> 8) & 0xff; 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,7 +332,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
len_a = a4_included ? 28 : 22; len_a = a4_included ? 28 : 22;
if (qos_included) if (qos_included)
len_a += 2; len_a += IEEE80211_QOS_CTL_LEN;
aad[0] = 0; /* (len_a >> 8) & 0xff; */ aad[0] = 0; /* (len_a >> 8) & 0xff; */
aad[1] = len_a & 0xff; 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,17 +340,17 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
aad[2] = fc_pos[0] & ~(BIT(4) | BIT(5) | BIT(6)); aad[2] = fc_pos[0] & ~(BIT(4) | BIT(5) | BIT(6));
/* Retry, PwrMgt, MoreData; set Protected */ /* Retry, PwrMgt, MoreData; set Protected */
aad[3] = (fc_pos[1] & ~(BIT(3) | BIT(4) | BIT(5))) | BIT(6); aad[3] = (fc_pos[1] & ~(BIT(3) | BIT(4) | BIT(5))) | BIT(6);
memcpy(&aad[4], &hdr->addr1, 18); memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
/* Mask Seq#, leave Frag# */ /* Mask Seq#, leave Frag# */
aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f;
aad[23] = 0; aad[23] = 0;
if (a4_included) { if (a4_included) {
memcpy(&aad[24], hdr->addr4, 6); memcpy(&aad[24], hdr->addr4, ETH_ALEN);
aad[30] = 0; aad[30] = 0;
aad[31] = 0; aad[31] = 0;
} else } else
memset(&aad[24], 0, 8); memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
if (qos_included) { if (qos_included) {
u8 *dpos = &aad[a4_included ? 30 : 24]; u8 *dpos = &aad[a4_included ? 30 : 24];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册