diff options
author | M. Vefa Bicakci <m.v.b@runbox.com> | 2015-03-28 21:07:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 09:25:46 -0400 |
commit | 1d6b1ac0b654e5d94b6f92292a7047d33af44d2e (patch) | |
tree | 1dc792a9a06c666741e07e096a7a399678d88804 | |
parent | 268523aa6a408f9b9ea04fdd8b344c2b5fbcf2e4 (diff) |
staging: rtl8723au: Adjust whitespace in and around comments
As the subject indicates, adjust whitespace in and around comments
in rtl8723au's rtw_security.c.
Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_security.c | 113 |
1 files changed, 57 insertions, 56 deletions
diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 31ef1bce1e2a..8e0e9fa0efdc 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c | |||
@@ -135,12 +135,12 @@ static u32 getcrc32(u8 *buf, int len) | |||
135 | if (bcrc32initialized == 0) | 135 | if (bcrc32initialized == 0) |
136 | crc32_init(); | 136 | crc32_init(); |
137 | 137 | ||
138 | crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ | 138 | crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ |
139 | 139 | ||
140 | for (p = buf; len > 0; ++p, --len) | 140 | for (p = buf; len > 0; ++p, --len) |
141 | crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8); | 141 | crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8); |
142 | 142 | ||
143 | return ~crc; /* transmit complement, per CRC-32 spec */ | 143 | return ~crc; /* transmit complement, per CRC-32 spec */ |
144 | } | 144 | } |
145 | 145 | ||
146 | /* Need to consider the fragment situation */ | 146 | /* Need to consider the fragment situation */ |
@@ -152,7 +152,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter, | |||
152 | struct arc4context mycontext; | 152 | struct arc4context mycontext; |
153 | int curfragnum, length, index; | 153 | int curfragnum, length, index; |
154 | u32 keylength; | 154 | u32 keylength; |
155 | u8 *pframe, *payload, *iv; /* wepkey */ | 155 | u8 *pframe, *payload, *iv; /* wepkey */ |
156 | u8 wepkey[16]; | 156 | u8 wepkey[16]; |
157 | u8 hw_hdr_offset = 0; | 157 | u8 hw_hdr_offset = 0; |
158 | struct pkt_attrib *pattrib = &pxmitframe->attrib; | 158 | struct pkt_attrib *pattrib = &pxmitframe->attrib; |
@@ -370,15 +370,15 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, | |||
370 | priority[0] = pri; | 370 | priority[0] = pri; |
371 | 371 | ||
372 | /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ | 372 | /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ |
373 | if (header[1]&1) { /* ToDS == 1 */ | 373 | if (header[1]&1) { /* ToDS == 1 */ |
374 | rtw_secmicappend23a(&micdata, &header[16], 6); /* DA */ | 374 | rtw_secmicappend23a(&micdata, &header[16], 6); /* DA */ |
375 | if (header[1]&2) /* From Ds == 1 */ | 375 | if (header[1]&2) /* From Ds == 1 */ |
376 | rtw_secmicappend23a(&micdata, &header[24], 6); | 376 | rtw_secmicappend23a(&micdata, &header[24], 6); |
377 | else | 377 | else |
378 | rtw_secmicappend23a(&micdata, &header[10], 6); | 378 | rtw_secmicappend23a(&micdata, &header[10], 6); |
379 | } else { /* ToDS == 0 */ | 379 | } else { /* ToDS == 0 */ |
380 | rtw_secmicappend23a(&micdata, &header[4], 6); /* DA */ | 380 | rtw_secmicappend23a(&micdata, &header[4], 6); /* DA */ |
381 | if (header[1]&2) /* From Ds == 1 */ | 381 | if (header[1]&2) /* From Ds == 1 */ |
382 | rtw_secmicappend23a(&micdata, &header[16], 6); | 382 | rtw_secmicappend23a(&micdata, &header[16], 6); |
383 | else | 383 | else |
384 | rtw_secmicappend23a(&micdata, &header[10], 6); | 384 | rtw_secmicappend23a(&micdata, &header[10], 6); |
@@ -400,7 +400,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, | |||
400 | #define Hi16(v32) ((u16)(((v32) >> 16) & 0xFFFF)) | 400 | #define Hi16(v32) ((u16)(((v32) >> 16) & 0xFFFF)) |
401 | #define Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8)) | 401 | #define Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8)) |
402 | 402 | ||
403 | /* select the Nth 16-bit word of the temporal key unsigned char array TK[] */ | 403 | /* select the Nth 16-bit word of the temporal key unsigned char array TK[] */ |
404 | #define TK16(N) Mk16(tk[2 * (N) + 1], tk[2 * (N)]) | 404 | #define TK16(N) Mk16(tk[2 * (N) + 1], tk[2 * (N)]) |
405 | 405 | ||
406 | /* S-box lookup: 16 bits --> 16 bits */ | 406 | /* S-box lookup: 16 bits --> 16 bits */ |
@@ -507,7 +507,7 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) | |||
507 | { | 507 | { |
508 | int i; | 508 | int i; |
509 | 509 | ||
510 | /* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */ | 510 | /* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */ |
511 | p1k[0] = Lo16(iv32); | 511 | p1k[0] = Lo16(iv32); |
512 | p1k[1] = Hi16(iv32); | 512 | p1k[1] = Hi16(iv32); |
513 | p1k[2] = Mk16(ta[1], ta[0]); /* use TA[] as little-endian */ | 513 | p1k[2] = Mk16(ta[1], ta[0]); /* use TA[] as little-endian */ |
@@ -523,7 +523,7 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) | |||
523 | p1k[2] += _S_(p1k[1] ^ TK16((i & 1) + 4)); | 523 | p1k[2] += _S_(p1k[1] ^ TK16((i & 1) + 4)); |
524 | p1k[3] += _S_(p1k[2] ^ TK16((i & 1) + 6)); | 524 | p1k[3] += _S_(p1k[2] ^ TK16((i & 1) + 6)); |
525 | p1k[4] += _S_(p1k[3] ^ TK16((i & 1) + 0)); | 525 | p1k[4] += _S_(p1k[3] ^ TK16((i & 1) + 0)); |
526 | p1k[4] += (unsigned short)i; /* avoid "slide attacks" */ | 526 | p1k[4] += (unsigned short) i; /* avoid "slide attacks" */ |
527 | } | 527 | } |
528 | 528 | ||
529 | } | 529 | } |
@@ -554,41 +554,41 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) | |||
554 | static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) | 554 | static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) |
555 | { | 555 | { |
556 | int i; | 556 | int i; |
557 | u16 PPK[6]; /* temporary key for mixing */ | 557 | u16 PPK[6]; /* temporary key for mixing */ |
558 | 558 | ||
559 | /* Note: all adds in the PPK[] equations below are mod 2**16 */ | 559 | /* Note: all adds in the PPK[] equations below are mod 2**16 */ |
560 | for (i = 0; i < 5; i++) | 560 | for (i = 0; i < 5; i++) |
561 | PPK[i] = p1k[i]; /* first, copy P1K to PPK */ | 561 | PPK[i] = p1k[i]; /* first, copy P1K to PPK */ |
562 | 562 | ||
563 | PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ | 563 | PPK[5] = p1k[4] + iv16; /* next, add in IV16 */ |
564 | 564 | ||
565 | /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ | 565 | /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ |
566 | PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ | 566 | PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ |
567 | PPK[1] += _S_(PPK[0] ^ TK16(1)); | 567 | PPK[1] += _S_(PPK[0] ^ TK16(1)); |
568 | PPK[2] += _S_(PPK[1] ^ TK16(2)); | 568 | PPK[2] += _S_(PPK[1] ^ TK16(2)); |
569 | PPK[3] += _S_(PPK[2] ^ TK16(3)); | 569 | PPK[3] += _S_(PPK[2] ^ TK16(3)); |
570 | PPK[4] += _S_(PPK[3] ^ TK16(4)); | 570 | PPK[4] += _S_(PPK[3] ^ TK16(4)); |
571 | PPK[5] += _S_(PPK[4] ^ TK16(5)); /* Total # S-box lookups == 6 */ | 571 | PPK[5] += _S_(PPK[4] ^ TK16(5)); /* Total # S-box lookups == 6 */ |
572 | 572 | ||
573 | /* Final sweep: bijective, "linear". Rotates kill LSB correlations */ | 573 | /* Final sweep: bijective, "linear". Rotates kill LSB correlations */ |
574 | PPK[0] += RotR1(PPK[5] ^ TK16(6)); | 574 | PPK[0] += RotR1(PPK[5] ^ TK16(6)); |
575 | PPK[1] += RotR1(PPK[0] ^ TK16(7)); /* Use all of TK[] in Phase2 */ | 575 | PPK[1] += RotR1(PPK[0] ^ TK16(7)); /* Use all of TK[] in Phase2 */ |
576 | PPK[2] += RotR1(PPK[1]); | 576 | PPK[2] += RotR1(PPK[1]); |
577 | PPK[3] += RotR1(PPK[2]); | 577 | PPK[3] += RotR1(PPK[2]); |
578 | PPK[4] += RotR1(PPK[3]); | 578 | PPK[4] += RotR1(PPK[3]); |
579 | PPK[5] += RotR1(PPK[4]); | 579 | PPK[5] += RotR1(PPK[4]); |
580 | /* Note: At this point, for a given key TK[0..15], the 96-bit output */ | 580 | /* Note: At this point, for a given key TK[0..15], the 96-bit output */ |
581 | /* value PPK[0..5] is guaranteed to be unique, as a function */ | 581 | /* value PPK[0..5] is guaranteed to be unique, as a function */ |
582 | /* of the 96-bit "input" value {TA, IV32, IV16}. That is, P1K */ | 582 | /* of the 96-bit "input" value {TA, IV32, IV16}. That is, */ |
583 | /* is now a keyed permutation of {TA, IV32, IV16}. */ | 583 | /* P1K is now a keyed permutation of {TA, IV32, IV16}. */ |
584 | 584 | ||
585 | /* Set RC4KEY[0..3], which includes "cleartext" portion of RC4 key */ | 585 | /* Set RC4KEY[0..3], which includes "cleartext" portion of RC4 key */ |
586 | rc4key[0] = Hi8(iv16); /* RC4KEY[0..2] is the WEP IV */ | 586 | rc4key[0] = Hi8(iv16); /* RC4KEY[0..2] is the WEP IV */ |
587 | rc4key[1] = (Hi8(iv16) | 0x20) & 0x7F; /* Help avoid weak (FMS) keys */ | 587 | rc4key[1] = (Hi8(iv16) | 0x20) & 0x7F; /* Help avoid weak (FMS) keys */ |
588 | rc4key[2] = Lo8(iv16); | 588 | rc4key[2] = Lo8(iv16); |
589 | rc4key[3] = Lo8((PPK[5] ^ TK16(0)) >> 1); | 589 | rc4key[3] = Lo8((PPK[5] ^ TK16(0)) >> 1); |
590 | 590 | ||
591 | /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ | 591 | /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ |
592 | for (i = 0; i < 6; i++) { | 592 | for (i = 0; i < 6; i++) { |
593 | rc4key[4 + 2 * i] = Lo8(PPK[i]); | 593 | rc4key[4 + 2 * i] = Lo8(PPK[i]); |
594 | rc4key[5 + 2 * i] = Hi8(PPK[i]); | 594 | rc4key[5 + 2 * i] = Hi8(PPK[i]); |
@@ -671,7 +671,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, | |||
671 | 671 | ||
672 | phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); | 672 | phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); |
673 | 673 | ||
674 | if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ | 674 | if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ |
675 | length = (pattrib->last_txcmdsz - | 675 | length = (pattrib->last_txcmdsz - |
676 | pattrib->hdrlen - | 676 | pattrib->hdrlen - |
677 | pattrib->iv_len - | 677 | pattrib->iv_len - |
@@ -681,7 +681,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, | |||
681 | "pattrib->iv_len =%x, pattrib->icv_len =%x\n", | 681 | "pattrib->iv_len =%x, pattrib->icv_len =%x\n", |
682 | pattrib->iv_len, | 682 | pattrib->iv_len, |
683 | pattrib->icv_len); | 683 | pattrib->icv_len); |
684 | *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ | 684 | *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy */ |
685 | 685 | ||
686 | arcfour_init(&mycontext, rc4key, 16); | 686 | arcfour_init(&mycontext, rc4key, 16); |
687 | arcfour_encrypt(&mycontext, payload, payload, length); | 687 | arcfour_encrypt(&mycontext, payload, payload, length); |
@@ -693,7 +693,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, | |||
693 | pattrib->iv_len - | 693 | pattrib->iv_len - |
694 | pattrib->icv_len); | 694 | pattrib->icv_len); |
695 | 695 | ||
696 | *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));/* modified by Amy*/ | 696 | *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy */ |
697 | arcfour_init(&mycontext, rc4key, 16); | 697 | arcfour_init(&mycontext, rc4key, 16); |
698 | arcfour_encrypt(&mycontext, payload, payload, length); | 698 | arcfour_encrypt(&mycontext, payload, payload, length); |
699 | arcfour_encrypt(&mycontext, payload + length, crc, 4); | 699 | arcfour_encrypt(&mycontext, payload + length, crc, 4); |
@@ -934,12 +934,12 @@ static void mix_column(u8 *in, u8 *out) | |||
934 | add1b[i] = 0x00; | 934 | add1b[i] = 0x00; |
935 | } | 935 | } |
936 | 936 | ||
937 | swap_halfs[0] = in[2]; /* Swap halfs */ | 937 | swap_halfs[0] = in[2]; /* Swap halfs */ |
938 | swap_halfs[1] = in[3]; | 938 | swap_halfs[1] = in[3]; |
939 | swap_halfs[2] = in[0]; | 939 | swap_halfs[2] = in[0]; |
940 | swap_halfs[3] = in[1]; | 940 | swap_halfs[3] = in[1]; |
941 | 941 | ||
942 | rotl[0] = in[3]; /* Rotate left 8 bits */ | 942 | rotl[0] = in[3]; /* Rotate left 8 bits */ |
943 | rotl[1] = in[0]; | 943 | rotl[1] = in[0]; |
944 | rotl[2] = in[1]; | 944 | rotl[2] = in[1]; |
945 | rotl[3] = in[2]; | 945 | rotl[3] = in[2]; |
@@ -961,7 +961,7 @@ static void mix_column(u8 *in, u8 *out) | |||
961 | 961 | ||
962 | xor_32(in, add1bf7, rotr); | 962 | xor_32(in, add1bf7, rotr); |
963 | 963 | ||
964 | temp[0] = rotr[0]; /* Rotate right 8 bits */ | 964 | temp[0] = rotr[0]; /* Rotate right 8 bits */ |
965 | rotr[0] = rotr[1]; | 965 | rotr[0] = rotr[1]; |
966 | rotr[1] = rotr[2]; | 966 | rotr[1] = rotr[2]; |
967 | rotr[2] = rotr[3]; | 967 | rotr[2] = rotr[3]; |
@@ -1017,9 +1017,9 @@ static void construct_mic_iv(u8 *mic_iv, int qc_exists, int a4_exists, u8 *mpdu, | |||
1017 | 1017 | ||
1018 | mic_iv[0] = 0x59; | 1018 | mic_iv[0] = 0x59; |
1019 | if (qc_exists && a4_exists) | 1019 | if (qc_exists && a4_exists) |
1020 | mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ | 1020 | mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ |
1021 | if (qc_exists && !a4_exists) | 1021 | if (qc_exists && !a4_exists) |
1022 | mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ | 1022 | mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ |
1023 | if (!qc_exists) | 1023 | if (!qc_exists) |
1024 | mic_iv[1] = 0x00; | 1024 | mic_iv[1] = 0x00; |
1025 | for (i = 2; i < 8; i++) | 1025 | for (i = 2; i < 8; i++) |
@@ -1039,15 +1039,15 @@ static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu) | |||
1039 | { | 1039 | { |
1040 | mic_header1[0] = (u8)((header_length - 2) / 256); | 1040 | mic_header1[0] = (u8)((header_length - 2) / 256); |
1041 | mic_header1[1] = (u8)((header_length - 2) % 256); | 1041 | mic_header1[1] = (u8)((header_length - 2) % 256); |
1042 | mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ | 1042 | mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ |
1043 | mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ | 1043 | mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ |
1044 | mic_header1[4] = mpdu[4]; /* A1 */ | 1044 | mic_header1[4] = mpdu[4]; /* A1 */ |
1045 | mic_header1[5] = mpdu[5]; | 1045 | mic_header1[5] = mpdu[5]; |
1046 | mic_header1[6] = mpdu[6]; | 1046 | mic_header1[6] = mpdu[6]; |
1047 | mic_header1[7] = mpdu[7]; | 1047 | mic_header1[7] = mpdu[7]; |
1048 | mic_header1[8] = mpdu[8]; | 1048 | mic_header1[8] = mpdu[8]; |
1049 | mic_header1[9] = mpdu[9]; | 1049 | mic_header1[9] = mpdu[9]; |
1050 | mic_header1[10] = mpdu[10]; /* A2 */ | 1050 | mic_header1[10] = mpdu[10]; /* A2 */ |
1051 | mic_header1[11] = mpdu[11]; | 1051 | mic_header1[11] = mpdu[11]; |
1052 | mic_header1[12] = mpdu[12]; | 1052 | mic_header1[12] = mpdu[12]; |
1053 | mic_header1[13] = mpdu[13]; | 1053 | mic_header1[13] = mpdu[13]; |
@@ -1057,7 +1057,7 @@ static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu) | |||
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | /************************************************/ | 1059 | /************************************************/ |
1060 | /* construct_mic_header2() */ | 1060 | /* construct_mic_header2() */ |
1061 | /* Builds the last MIC header block from */ | 1061 | /* Builds the last MIC header block from */ |
1062 | /* header fields. */ | 1062 | /* header fields. */ |
1063 | /************************************************/ | 1063 | /************************************************/ |
@@ -1069,7 +1069,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, | |||
1069 | for (i = 0; i < 16; i++) | 1069 | for (i = 0; i < 16; i++) |
1070 | mic_header2[i] = 0x00; | 1070 | mic_header2[i] = 0x00; |
1071 | 1071 | ||
1072 | mic_header2[0] = mpdu[16]; /* A3 */ | 1072 | mic_header2[0] = mpdu[16]; /* A3 */ |
1073 | mic_header2[1] = mpdu[17]; | 1073 | mic_header2[1] = mpdu[17]; |
1074 | mic_header2[2] = mpdu[18]; | 1074 | mic_header2[2] = mpdu[18]; |
1075 | mic_header2[3] = mpdu[19]; | 1075 | mic_header2[3] = mpdu[19]; |
@@ -1081,7 +1081,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, | |||
1081 | 1081 | ||
1082 | if (!qc_exists && a4_exists) { | 1082 | if (!qc_exists && a4_exists) { |
1083 | for (i = 0; i < 6; i++) | 1083 | for (i = 0; i < 6; i++) |
1084 | mic_header2[8+i] = mpdu[24+i]; /* A4 */ | 1084 | mic_header2[8+i] = mpdu[24+i]; /* A4 */ |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | if (qc_exists && !a4_exists) { | 1087 | if (qc_exists && !a4_exists) { |
@@ -1091,7 +1091,7 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, | |||
1091 | 1091 | ||
1092 | if (qc_exists && a4_exists) { | 1092 | if (qc_exists && a4_exists) { |
1093 | for (i = 0; i < 6; i++) | 1093 | for (i = 0; i < 6; i++) |
1094 | mic_header2[8+i] = mpdu[24+i]; /* A4 */ | 1094 | mic_header2[8+i] = mpdu[24+i]; /* A4 */ |
1095 | 1095 | ||
1096 | mic_header2[14] = mpdu[30] & 0x0f; | 1096 | mic_header2[14] = mpdu[30] & 0x0f; |
1097 | mic_header2[15] = mpdu[31] & 0x00; | 1097 | mic_header2[15] = mpdu[31] & 0x00; |
@@ -1114,16 +1114,16 @@ static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, | |||
1114 | 1114 | ||
1115 | i = 0; | 1115 | i = 0; |
1116 | 1116 | ||
1117 | ctr_preload[0] = 0x01; /* flag */ | 1117 | ctr_preload[0] = 0x01; /* flag */ |
1118 | if (qc_exists && a4_exists) | 1118 | if (qc_exists && a4_exists) |
1119 | ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ | 1119 | ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ |
1120 | if (qc_exists && !a4_exists) | 1120 | if (qc_exists && !a4_exists) |
1121 | ctr_preload[1] = mpdu[24] & 0x0f; | 1121 | ctr_preload[1] = mpdu[24] & 0x0f; |
1122 | 1122 | ||
1123 | for (i = 2; i < 8; i++) | 1123 | for (i = 2; i < 8; i++) |
1124 | ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ | 1124 | ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ |
1125 | for (i = 8; i < 14; i++) | 1125 | for (i = 8; i < 14; i++) |
1126 | ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ | 1126 | ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ |
1127 | ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ | 1127 | ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ |
1128 | ctr_preload[15] = (unsigned char) (c % 256); | 1128 | ctr_preload[15] = (unsigned char) (c % 256); |
1129 | 1129 | ||
@@ -1287,11 +1287,11 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) | |||
1287 | 1287 | ||
1288 | int rtw_aes_encrypt23a(struct rtw_adapter *padapter, | 1288 | int rtw_aes_encrypt23a(struct rtw_adapter *padapter, |
1289 | struct xmit_frame *pxmitframe) | 1289 | struct xmit_frame *pxmitframe) |
1290 | { /* exclude ICV */ | 1290 | { /* exclude ICV */ |
1291 | /* Intermediate Buffers */ | 1291 | /* Intermediate Buffers */ |
1292 | int curfragnum, length; | 1292 | int curfragnum, length; |
1293 | u32 prwskeylen; | 1293 | u32 prwskeylen; |
1294 | u8 *pframe, *prwskey; /* *payload,*iv */ | 1294 | u8 *pframe, *prwskey; /* *payload, *iv */ |
1295 | u8 hw_hdr_offset = 0; | 1295 | u8 hw_hdr_offset = 0; |
1296 | struct sta_info *stainfo; | 1296 | struct sta_info *stainfo; |
1297 | struct pkt_attrib *pattrib = &pxmitframe->attrib; | 1297 | struct pkt_attrib *pattrib = &pxmitframe->attrib; |
@@ -1427,7 +1427,7 @@ static int aes_decipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) | |||
1427 | qc_exists = 0; | 1427 | qc_exists = 0; |
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | /* now, decrypt pframe with hdrlen offset and plen long */ | 1430 | /* now, decrypt pframe with hdrlen offset and plen long */ |
1431 | 1431 | ||
1432 | payload_index = hdrlen + 8; /* 8 is for extiv */ | 1432 | payload_index = hdrlen + 8; /* 8 is for extiv */ |
1433 | 1433 | ||
@@ -1577,7 +1577,7 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, | |||
1577 | struct security_priv *psecuritypriv = &padapter->securitypriv; | 1577 | struct security_priv *psecuritypriv = &padapter->securitypriv; |
1578 | struct sk_buff *skb = precvframe->pkt; | 1578 | struct sk_buff *skb = precvframe->pkt; |
1579 | int length; | 1579 | int length; |
1580 | u8 *pframe, *prwskey; /* *payload,*iv */ | 1580 | u8 *pframe, *prwskey; /* *payload, *iv */ |
1581 | int res = _SUCCESS; | 1581 | int res = _SUCCESS; |
1582 | 1582 | ||
1583 | pframe = skb->data; | 1583 | pframe = skb->data; |
@@ -1597,8 +1597,9 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter, | |||
1597 | "rtw_aes_decrypt23a: stainfo!= NULL!!!\n"); | 1597 | "rtw_aes_decrypt23a: stainfo!= NULL!!!\n"); |
1598 | 1598 | ||
1599 | if (is_multicast_ether_addr(prxattrib->ra)) { | 1599 | if (is_multicast_ether_addr(prxattrib->ra)) { |
1600 | /* in concurrent we should use sw decrypt in group key, | 1600 | /* in concurrent we should use sw decrypt in |
1601 | so we remove this message */ | 1601 | * group key, so we remove this message |
1602 | */ | ||
1602 | if (!psecuritypriv->binstallGrpkey) { | 1603 | if (!psecuritypriv->binstallGrpkey) { |
1603 | res = _FAIL; | 1604 | res = _FAIL; |
1604 | DBG_8723A("%s:rx bc/mc packets, but didn't install " | 1605 | DBG_8723A("%s:rx bc/mc packets, but didn't install " |