rtw_wapi_sms4.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2016 - 2017 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. *****************************************************************************/
  15. #ifdef CONFIG_WAPI_SUPPORT
  16. #include <linux/unistd.h>
  17. #include <linux/etherdevice.h>
  18. #include <drv_types.h>
  19. #include <rtw_wapi.h>
  20. #ifdef CONFIG_WAPI_SW_SMS4
  21. #define WAPI_LITTLE_ENDIAN
  22. /* #define BIG_ENDIAN */
  23. #define ENCRYPT 0
  24. #define DECRYPT 1
  25. /**********************************************************
  26. **********************************************************/
  27. const u8 Sbox[256] = {
  28. 0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
  29. 0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99,
  30. 0x9c, 0x42, 0x50, 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62,
  31. 0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08, 0xe8, 0x95, 0x80, 0xdf, 0x94, 0xfa, 0x75, 0x8f, 0x3f, 0xa6,
  32. 0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, 0x83, 0x59, 0x3c, 0x19, 0xe6, 0x85, 0x4f, 0xa8,
  33. 0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b, 0xf8, 0xeb, 0x0f, 0x4b, 0x70, 0x56, 0x9d, 0x35,
  34. 0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1, 0xa2, 0x25, 0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78, 0x87,
  35. 0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3, 0x27, 0x52, 0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e,
  36. 0xea, 0xbf, 0x8a, 0xd2, 0x40, 0xc7, 0x38, 0xb5, 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1,
  37. 0xe0, 0xae, 0x5d, 0xa4, 0x9b, 0x34, 0x1a, 0x55, 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3,
  38. 0x1d, 0xf6, 0xe2, 0x2e, 0x82, 0x66, 0xca, 0x60, 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f,
  39. 0xd5, 0xdb, 0x37, 0x45, 0xde, 0xfd, 0x8e, 0x2f, 0x03, 0xff, 0x6a, 0x72, 0x6d, 0x6c, 0x5b, 0x51,
  40. 0x8d, 0x1b, 0xaf, 0x92, 0xbb, 0xdd, 0xbc, 0x7f, 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10, 0x5a, 0xd8,
  41. 0x0a, 0xc1, 0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4, 0xb0,
  42. 0x89, 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84,
  43. 0x18, 0xf0, 0x7d, 0xec, 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48
  44. };
  45. const u32 CK[32] = {
  46. 0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
  47. 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
  48. 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
  49. 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
  50. 0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
  51. 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
  52. 0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
  53. 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
  54. };
  55. #define Rotl(_x, _y) (((_x) << (_y)) | ((_x) >> (32 - (_y))))
  56. #define ByteSub(_A) (Sbox[(_A) >> 24 & 0xFF] << 24 | \
  57. Sbox[(_A) >> 16 & 0xFF] << 16 | \
  58. Sbox[(_A) >> 8 & 0xFF] << 8 | \
  59. Sbox[(_A) & 0xFF])
  60. #define L1(_B) ((_B) ^ Rotl(_B, 2) ^ Rotl(_B, 10) ^ Rotl(_B, 18) ^ Rotl(_B, 24))
  61. #define L2(_B) ((_B) ^ Rotl(_B, 13) ^ Rotl(_B, 23))
  62. static void
  63. xor_block(void *dst, void *src1, void *src2)
  64. /* 128-bit xor: *dst = *src1 xor *src2. Pointers must be 32-bit aligned */
  65. {
  66. ((u32 *)dst)[0] = ((u32 *)src1)[0] ^ ((u32 *)src2)[0];
  67. ((u32 *)dst)[1] = ((u32 *)src1)[1] ^ ((u32 *)src2)[1];
  68. ((u32 *)dst)[2] = ((u32 *)src1)[2] ^ ((u32 *)src2)[2];
  69. ((u32 *)dst)[3] = ((u32 *)src1)[3] ^ ((u32 *)src2)[3];
  70. }
  71. void SMS4Crypt(u8 *Input, u8 *Output, u32 *rk)
  72. {
  73. u32 r, mid, x0, x1, x2, x3, *p;
  74. p = (u32 *)Input;
  75. x0 = p[0];
  76. x1 = p[1];
  77. x2 = p[2];
  78. x3 = p[3];
  79. #ifdef WAPI_LITTLE_ENDIAN
  80. x0 = Rotl(x0, 16);
  81. x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
  82. x1 = Rotl(x1, 16);
  83. x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
  84. x2 = Rotl(x2, 16);
  85. x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
  86. x3 = Rotl(x3, 16);
  87. x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
  88. #endif
  89. for (r = 0; r < 32; r += 4) {
  90. mid = x1 ^ x2 ^ x3 ^ rk[r + 0];
  91. mid = ByteSub(mid);
  92. x0 ^= L1(mid);
  93. mid = x2 ^ x3 ^ x0 ^ rk[r + 1];
  94. mid = ByteSub(mid);
  95. x1 ^= L1(mid);
  96. mid = x3 ^ x0 ^ x1 ^ rk[r + 2];
  97. mid = ByteSub(mid);
  98. x2 ^= L1(mid);
  99. mid = x0 ^ x1 ^ x2 ^ rk[r + 3];
  100. mid = ByteSub(mid);
  101. x3 ^= L1(mid);
  102. }
  103. #ifdef WAPI_LITTLE_ENDIAN
  104. x0 = Rotl(x0, 16);
  105. x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
  106. x1 = Rotl(x1, 16);
  107. x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
  108. x2 = Rotl(x2, 16);
  109. x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
  110. x3 = Rotl(x3, 16);
  111. x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
  112. #endif
  113. p = (u32 *)Output;
  114. p[0] = x3;
  115. p[1] = x2;
  116. p[2] = x1;
  117. p[3] = x0;
  118. }
  119. void SMS4KeyExt(u8 *Key, u32 *rk, u32 CryptFlag)
  120. {
  121. u32 r, mid, x0, x1, x2, x3, *p;
  122. p = (u32 *)Key;
  123. x0 = p[0];
  124. x1 = p[1];
  125. x2 = p[2];
  126. x3 = p[3];
  127. #ifdef WAPI_LITTLE_ENDIAN
  128. x0 = Rotl(x0, 16);
  129. x0 = ((x0 & 0xFF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
  130. x1 = Rotl(x1, 16);
  131. x1 = ((x1 & 0xFF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
  132. x2 = Rotl(x2, 16);
  133. x2 = ((x2 & 0xFF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
  134. x3 = Rotl(x3, 16);
  135. x3 = ((x3 & 0xFF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
  136. #endif
  137. x0 ^= 0xa3b1bac6;
  138. x1 ^= 0x56aa3350;
  139. x2 ^= 0x677d9197;
  140. x3 ^= 0xb27022dc;
  141. for (r = 0; r < 32; r += 4) {
  142. mid = x1 ^ x2 ^ x3 ^ CK[r + 0];
  143. mid = ByteSub(mid);
  144. rk[r + 0] = x0 ^= L2(mid);
  145. mid = x2 ^ x3 ^ x0 ^ CK[r + 1];
  146. mid = ByteSub(mid);
  147. rk[r + 1] = x1 ^= L2(mid);
  148. mid = x3 ^ x0 ^ x1 ^ CK[r + 2];
  149. mid = ByteSub(mid);
  150. rk[r + 2] = x2 ^= L2(mid);
  151. mid = x0 ^ x1 ^ x2 ^ CK[r + 3];
  152. mid = ByteSub(mid);
  153. rk[r + 3] = x3 ^= L2(mid);
  154. }
  155. if (CryptFlag == DECRYPT) {
  156. for (r = 0; r < 16; r++)
  157. mid = rk[r], rk[r] = rk[31 - r], rk[31 - r] = mid;
  158. }
  159. }
  160. void WapiSMS4Cryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
  161. u8 *Output, u16 *OutputLength, u32 CryptFlag)
  162. {
  163. u32 blockNum, i, j, rk[32];
  164. u16 remainder;
  165. u8 blockIn[16], blockOut[16], tempIV[16], k;
  166. *OutputLength = 0;
  167. remainder = InputLength & 0x0F;
  168. blockNum = InputLength >> 4;
  169. if (remainder != 0)
  170. blockNum++;
  171. else
  172. remainder = 16;
  173. for (k = 0; k < 16; k++)
  174. tempIV[k] = IV[15 - k];
  175. memcpy(blockIn, tempIV, 16);
  176. SMS4KeyExt((u8 *)Key, rk, CryptFlag);
  177. for (i = 0; i < blockNum - 1; i++) {
  178. SMS4Crypt((u8 *)blockIn, blockOut, rk);
  179. xor_block(&Output[i * 16], &Input[i * 16], blockOut);
  180. memcpy(blockIn, blockOut, 16);
  181. }
  182. *OutputLength = i * 16;
  183. SMS4Crypt((u8 *)blockIn, blockOut, rk);
  184. for (j = 0; j < remainder; j++)
  185. Output[i * 16 + j] = Input[i * 16 + j] ^ blockOut[j];
  186. *OutputLength += remainder;
  187. }
  188. void WapiSMS4Encryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
  189. u8 *Output, u16 *OutputLength)
  190. {
  191. WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
  192. }
  193. void WapiSMS4Decryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
  194. u8 *Output, u16 *OutputLength)
  195. {
  196. /* OFB mode: is also ENCRYPT flag */
  197. WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
  198. }
  199. void WapiSMS4CalculateMic(u8 *Key, u8 *IV, u8 *Input1, u8 Input1Length,
  200. u8 *Input2, u16 Input2Length, u8 *Output, u8 *OutputLength)
  201. {
  202. u32 blockNum, i, remainder, rk[32];
  203. u8 BlockIn[16], BlockOut[16], TempBlock[16], tempIV[16], k;
  204. *OutputLength = 0;
  205. remainder = Input1Length & 0x0F;
  206. blockNum = Input1Length >> 4;
  207. for (k = 0; k < 16; k++)
  208. tempIV[k] = IV[15 - k];
  209. memcpy(BlockIn, tempIV, 16);
  210. SMS4KeyExt((u8 *)Key, rk, ENCRYPT);
  211. SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
  212. for (i = 0; i < blockNum; i++) {
  213. xor_block(BlockIn, (Input1 + i * 16), BlockOut);
  214. SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
  215. }
  216. if (remainder != 0) {
  217. memset(TempBlock, 0, 16);
  218. memcpy(TempBlock, (Input1 + blockNum * 16), remainder);
  219. xor_block(BlockIn, TempBlock, BlockOut);
  220. SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
  221. }
  222. remainder = Input2Length & 0x0F;
  223. blockNum = Input2Length >> 4;
  224. for (i = 0; i < blockNum; i++) {
  225. xor_block(BlockIn, (Input2 + i * 16), BlockOut);
  226. SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
  227. }
  228. if (remainder != 0) {
  229. memset(TempBlock, 0, 16);
  230. memcpy(TempBlock, (Input2 + blockNum * 16), remainder);
  231. xor_block(BlockIn, TempBlock, BlockOut);
  232. SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
  233. }
  234. memcpy(Output, BlockOut, 16);
  235. *OutputLength = 16;
  236. }
  237. void SecCalculateMicSMS4(
  238. u8 KeyIdx,
  239. u8 *MicKey,
  240. u8 *pHeader,
  241. u8 *pData,
  242. u16 DataLen,
  243. u8 *MicBuffer
  244. )
  245. {
  246. #if 0
  247. struct ieee80211_hdr_3addr_qos *header;
  248. u8 TempBuf[34], TempLen = 32, MicLen, QosOffset, *IV;
  249. u16 *pTemp, fc;
  250. WAPI_TRACE(WAPI_TX | WAPI_RX, "=========>%s\n", __FUNCTION__);
  251. header = (struct ieee80211_hdr_3addr_qos *)pHeader;
  252. memset(TempBuf, 0, 34);
  253. memcpy(TempBuf, pHeader, 2); /* FrameCtrl */
  254. pTemp = (u16 *)TempBuf;
  255. *pTemp &= 0xc78f; /* bit4,5,6,11,12,13 */
  256. memcpy((TempBuf + 2), (pHeader + 4), 12); /* Addr1, Addr2 */
  257. memcpy((TempBuf + 14), (pHeader + 22), 2); /* SeqCtrl */
  258. pTemp = (u16 *)(TempBuf + 14);
  259. *pTemp &= 0x000f;
  260. memcpy((TempBuf + 16), (pHeader + 16), 6); /* Addr3 */
  261. fc = le16_to_cpu(header->frame_ctl);
  262. if (GetFrDs((u16 *)&fc) && GetToDs((u16 *)&fc)) {
  263. memcpy((TempBuf + 22), (pHeader + 24), 6);
  264. QosOffset = 30;
  265. } else {
  266. memset((TempBuf + 22), 0, 6);
  267. QosOffset = 24;
  268. }
  269. if ((fc & 0x0088) == 0x0088) {
  270. memcpy((TempBuf + 28), (pHeader + QosOffset), 2);
  271. TempLen += 2;
  272. /* IV = pHeader + QosOffset + 2 + SNAP_SIZE + sizeof(u16) + 2; */
  273. IV = pHeader + QosOffset + 2 + 2;
  274. } else {
  275. IV = pHeader + QosOffset + 2;
  276. /* IV = pHeader + QosOffset + SNAP_SIZE + sizeof(u16) + 2; */
  277. }
  278. TempBuf[TempLen - 1] = (u8)(DataLen & 0xff);
  279. TempBuf[TempLen - 2] = (u8)((DataLen & 0xff00) >> 8);
  280. TempBuf[TempLen - 4] = KeyIdx;
  281. WAPI_DATA(WAPI_TX, "CalculateMic - KEY", MicKey, 16);
  282. WAPI_DATA(WAPI_TX, "CalculateMic - IV", IV, 16);
  283. WAPI_DATA(WAPI_TX, "CalculateMic - TempBuf", TempBuf, TempLen);
  284. WAPI_DATA(WAPI_TX, "CalculateMic - pData", pData, DataLen);
  285. WapiSMS4CalculateMic(MicKey, IV, TempBuf, TempLen,
  286. pData, DataLen, MicBuffer, &MicLen);
  287. if (MicLen != 16)
  288. WAPI_TRACE(WAPI_ERR, "%s: MIC Length Error!!\n", __FUNCTION__);
  289. WAPI_TRACE(WAPI_TX | WAPI_RX, "<=========%s\n", __FUNCTION__);
  290. #endif
  291. }
  292. /* AddCount: 1 or 2.
  293. * If overflow, return 1,
  294. * else return 0.
  295. */
  296. u8 WapiIncreasePN(u8 *PN, u8 AddCount)
  297. {
  298. u8 i;
  299. if (NULL == PN)
  300. return 1;
  301. /* YJ,test,091102 */
  302. /*
  303. if(AddCount == 2){
  304. RTW_INFO("############################%s(): PN[0]=0x%x\n", __FUNCTION__, PN[0]);
  305. if(PN[0] == 0x48){
  306. PN[0] += AddCount;
  307. return 1;
  308. }else{
  309. PN[0] += AddCount;
  310. return 0;
  311. }
  312. }
  313. */
  314. /* YJ,test,091102,end */
  315. for (i = 0; i < 16; i++) {
  316. if (PN[i] + AddCount <= 0xff) {
  317. PN[i] += AddCount;
  318. return 0;
  319. } else {
  320. PN[i] += AddCount;
  321. AddCount = 1;
  322. }
  323. }
  324. return 1;
  325. }
  326. void WapiGetLastRxUnicastPNForQoSData(
  327. u8 UserPriority,
  328. PRT_WAPI_STA_INFO pWapiStaInfo,
  329. u8 *PNOut
  330. )
  331. {
  332. WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
  333. switch (UserPriority) {
  334. case 0:
  335. case 3:
  336. memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNBEQueue, 16);
  337. break;
  338. case 1:
  339. case 2:
  340. memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNBKQueue, 16);
  341. break;
  342. case 4:
  343. case 5:
  344. memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNVIQueue, 16);
  345. break;
  346. case 6:
  347. case 7:
  348. memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNVOQueue, 16);
  349. break;
  350. default:
  351. WAPI_TRACE(WAPI_ERR, "%s: Unknown TID\n", __FUNCTION__);
  352. break;
  353. }
  354. WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
  355. }
  356. void WapiSetLastRxUnicastPNForQoSData(
  357. u8 UserPriority,
  358. u8 *PNIn,
  359. PRT_WAPI_STA_INFO pWapiStaInfo
  360. )
  361. {
  362. WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
  363. switch (UserPriority) {
  364. case 0:
  365. case 3:
  366. memcpy(pWapiStaInfo->lastRxUnicastPNBEQueue, PNIn, 16);
  367. break;
  368. case 1:
  369. case 2:
  370. memcpy(pWapiStaInfo->lastRxUnicastPNBKQueue, PNIn, 16);
  371. break;
  372. case 4:
  373. case 5:
  374. memcpy(pWapiStaInfo->lastRxUnicastPNVIQueue, PNIn, 16);
  375. break;
  376. case 6:
  377. case 7:
  378. memcpy(pWapiStaInfo->lastRxUnicastPNVOQueue, PNIn, 16);
  379. break;
  380. default:
  381. WAPI_TRACE(WAPI_ERR, "%s: Unknown TID\n", __FUNCTION__);
  382. break;
  383. }
  384. WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
  385. }
  386. /****************************************************************************
  387. FALSE not RX-Reorder
  388. TRUE do RX Reorder
  389. add to support WAPI to N-mode
  390. *****************************************************************************/
  391. u8 WapiCheckPnInSwDecrypt(
  392. _adapter *padapter,
  393. struct sk_buff *pskb
  394. )
  395. {
  396. u8 ret = false;
  397. #if 0
  398. struct ieee80211_hdr_3addr_qos *header;
  399. u16 fc;
  400. u8 *pDaddr, *pTaddr, *pRaddr;
  401. header = (struct ieee80211_hdr_3addr_qos *)pskb->data;
  402. pTaddr = header->addr2;
  403. pRaddr = header->addr1;
  404. fc = le16_to_cpu(header->frame_ctl);
  405. if (GetToDs(&fc))
  406. pDaddr = header->addr3;
  407. else
  408. pDaddr = header->addr1;
  409. if ((_rtw_memcmp(pRaddr, padapter->pnetdev->dev_addr, ETH_ALEN) == 0)
  410. && !(pDaddr)
  411. && (GetFrameType(&fc) == WIFI_QOS_DATA_TYPE))
  412. /* && ieee->pHTInfo->bCurrentHTSupport && */
  413. /* ieee->pHTInfo->bCurRxReorderEnable) */
  414. ret = false;
  415. else
  416. ret = true;
  417. #endif
  418. WAPI_TRACE(WAPI_RX, "%s: return %d\n", __FUNCTION__, ret);
  419. return ret;
  420. }
  421. int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe)
  422. {
  423. struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
  424. u8 *frame = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
  425. u8 *pSecHeader = NULL, *pos = NULL, *pRA = NULL;
  426. u8 bPNOverflow = false, bFindMatchPeer = false, hdr_len = 0;
  427. PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
  428. PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
  429. PRT_WAPI_STA_INFO pWapiSta = NULL;
  430. int ret = 0;
  431. WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
  432. return ret;
  433. #if 0
  434. hdr_len = sMacHdrLng;
  435. if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE)
  436. hdr_len += 2;
  437. /* hdr_len += SNAP_SIZE + sizeof(u16); */
  438. pos = skb_push(pskb, padapter->wapiInfo.extra_prefix_len);
  439. memmove(pos, pos + padapter->wapiInfo.extra_prefix_len, hdr_len);
  440. pSecHeader = pskb->data + hdr_len;
  441. pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)pSecHeader;
  442. pRA = pskb->data + 4;
  443. WAPI_DATA(WAPI_TX, "FillIV - Before Fill IV", pskb->data, pskb->len);
  444. /* Address 1 is always receiver's address */
  445. if (IS_MCAST(pRA)) {
  446. if (!pWapiInfo->wapiTxMsk.bTxEnable) {
  447. WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__);
  448. return -2;
  449. }
  450. if (pWapiInfo->wapiTxMsk.keyId <= 1) {
  451. pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
  452. pWapiExt->Reserved = 0;
  453. bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
  454. memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
  455. if (bPNOverflow) {
  456. /* Update MSK Notification. */
  457. WAPI_TRACE(WAPI_ERR, "===============>%s():multicast PN overflow\n", __FUNCTION__);
  458. rtw_wapi_app_event_handler(padapter, NULL, 0, pRA, false, false, true, 0, false);
  459. }
  460. } else {
  461. WAPI_TRACE(WAPI_ERR, "%s: Invalid Wapi Multicast KeyIdx!!\n", __FUNCTION__);
  462. ret = -3;
  463. }
  464. } else {
  465. list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
  466. if (!memcmp(pWapiSta->PeerMacAddr, pRA, 6)) {
  467. bFindMatchPeer = true;
  468. break;
  469. }
  470. }
  471. if (bFindMatchPeer) {
  472. if ((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable)) {
  473. WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__);
  474. return -4;
  475. }
  476. if (pWapiSta->wapiUsk.keyId <= 1) {
  477. if (pWapiSta->wapiUskUpdate.bTxEnable)
  478. pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
  479. else
  480. pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
  481. pWapiExt->Reserved = 0;
  482. bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
  483. memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
  484. if (bPNOverflow) {
  485. /* Update USK Notification. */
  486. WAPI_TRACE(WAPI_ERR, "===============>%s():unicast PN overflow\n", __FUNCTION__);
  487. rtw_wapi_app_event_handler(padapter, NULL, 0, pWapiSta->PeerMacAddr, false, true, false, 0, false);
  488. }
  489. } else {
  490. WAPI_TRACE(WAPI_ERR, "%s: Invalid Wapi Unicast KeyIdx!!\n", __FUNCTION__);
  491. ret = -5;
  492. }
  493. } else {
  494. WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT"!!\n", __FUNCTION__, MAC_ARG(pRA));
  495. ret = -6;
  496. }
  497. }
  498. WAPI_DATA(WAPI_TX, "FillIV - After Fill IV", pskb->data, pskb->len);
  499. WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
  500. return ret;
  501. #endif
  502. }
  503. /* WAPI SW Enc: must have done Coalesce! */
  504. void SecSWSMS4Encryption(
  505. _adapter *padapter,
  506. u8 *pxmitframe
  507. )
  508. {
  509. PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
  510. PRT_WAPI_STA_INFO pWapiSta = NULL;
  511. u8 *pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_SIZE;
  512. struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
  513. u8 *SecPtr = NULL, *pRA, *pMicKey = NULL, *pDataKey = NULL, *pIV = NULL;
  514. u8 IVOffset, DataOffset, bFindMatchPeer = false, KeyIdx = 0, MicBuffer[16];
  515. u16 OutputLength;
  516. WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
  517. WAPI_TRACE(WAPI_TX, "hdrlen: %d\n", pattrib->hdrlen);
  518. return;
  519. DataOffset = pattrib->hdrlen + pattrib->iv_len;
  520. pRA = pframe + 4;
  521. if (IS_MCAST(pRA)) {
  522. KeyIdx = pWapiInfo->wapiTxMsk.keyId;
  523. pIV = pWapiInfo->lastTxMulticastPN;
  524. pMicKey = pWapiInfo->wapiTxMsk.micKey;
  525. pDataKey = pWapiInfo->wapiTxMsk.dataKey;
  526. } else {
  527. if (!list_empty(&(pWapiInfo->wapiSTAUsedList))) {
  528. list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
  529. if (0 == memcmp(pWapiSta->PeerMacAddr, pRA, 6)) {
  530. bFindMatchPeer = true;
  531. break;
  532. }
  533. }
  534. if (bFindMatchPeer) {
  535. if (pWapiSta->wapiUskUpdate.bTxEnable) {
  536. KeyIdx = pWapiSta->wapiUskUpdate.keyId;
  537. WAPI_TRACE(WAPI_TX, "%s(): Use update USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
  538. pIV = pWapiSta->lastTxUnicastPN;
  539. pMicKey = pWapiSta->wapiUskUpdate.micKey;
  540. pDataKey = pWapiSta->wapiUskUpdate.dataKey;
  541. } else {
  542. KeyIdx = pWapiSta->wapiUsk.keyId;
  543. WAPI_TRACE(WAPI_TX, "%s(): Use USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
  544. pIV = pWapiSta->lastTxUnicastPN;
  545. pMicKey = pWapiSta->wapiUsk.micKey;
  546. pDataKey = pWapiSta->wapiUsk.dataKey;
  547. }
  548. } else {
  549. WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta!!\n", __FUNCTION__);
  550. return;
  551. }
  552. } else {
  553. WAPI_TRACE(WAPI_ERR, "%s: wapiSTAUsedList is empty!!\n", __FUNCTION__);
  554. return;
  555. }
  556. }
  557. SecPtr = pframe;
  558. SecCalculateMicSMS4(KeyIdx, pMicKey, SecPtr, (SecPtr + DataOffset), pattrib->pktlen, MicBuffer);
  559. WAPI_DATA(WAPI_TX, "Encryption - MIC", MicBuffer, padapter->wapiInfo.extra_postfix_len);
  560. memcpy(pframe + pattrib->hdrlen + pattrib->iv_len + pattrib->pktlen - pattrib->icv_len,
  561. (u8 *)MicBuffer,
  562. padapter->wapiInfo.extra_postfix_len
  563. );
  564. WapiSMS4Encryption(pDataKey, pIV, (SecPtr + DataOffset), pattrib->pktlen + pattrib->icv_len, (SecPtr + DataOffset), &OutputLength);
  565. WAPI_DATA(WAPI_TX, "Encryption - After SMS4 encryption", pframe, pattrib->hdrlen + pattrib->iv_len + pattrib->pktlen);
  566. WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
  567. }
  568. u8 SecSWSMS4Decryption(
  569. _adapter *padapter,
  570. u8 *precv_frame,
  571. struct recv_priv *precv_priv
  572. )
  573. {
  574. PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
  575. struct recv_frame_hdr *precv_hdr;
  576. PRT_WAPI_STA_INFO pWapiSta = NULL;
  577. u8 IVOffset, DataOffset, bFindMatchPeer = false, bUseUpdatedKey = false;
  578. u8 KeyIdx, MicBuffer[16], lastRxPNforQoS[16];
  579. u8 *pRA, *pTA, *pMicKey, *pDataKey, *pLastRxPN, *pRecvPN, *pSecData, *pRecvMic, *pos;
  580. u8 TID = 0;
  581. u16 OutputLength, DataLen;
  582. u8 bQosData;
  583. struct sk_buff *pskb;
  584. WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
  585. return 0;
  586. precv_hdr = &((union recv_frame *)precv_frame)->u.hdr;
  587. pskb = (struct sk_buff *)(precv_hdr->rx_data);
  588. precv_hdr->bWapiCheckPNInDecrypt = WapiCheckPnInSwDecrypt(padapter, pskb);
  589. WAPI_TRACE(WAPI_RX, "=========>%s: check PN %d\n", __FUNCTION__, precv_hdr->bWapiCheckPNInDecrypt);
  590. WAPI_DATA(WAPI_RX, "Decryption - Before decryption", pskb->data, pskb->len);
  591. IVOffset = sMacHdrLng;
  592. bQosData = GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE;
  593. if (bQosData)
  594. IVOffset += 2;
  595. /* if(GetHTC()) */
  596. /* IVOffset += 4; */
  597. /* IVOffset += SNAP_SIZE + sizeof(u16); */
  598. DataOffset = IVOffset + padapter->wapiInfo.extra_prefix_len;
  599. pRA = pskb->data + 4;
  600. pTA = pskb->data + 10;
  601. KeyIdx = *(pskb->data + IVOffset);
  602. pRecvPN = pskb->data + IVOffset + 2;
  603. pSecData = pskb->data + DataOffset;
  604. DataLen = pskb->len - DataOffset;
  605. pRecvMic = pskb->data + pskb->len - padapter->wapiInfo.extra_postfix_len;
  606. TID = GetTid(pskb->data);
  607. if (!list_empty(&(pWapiInfo->wapiSTAUsedList))) {
  608. list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
  609. if (0 == memcmp(pWapiSta->PeerMacAddr, pTA, 6)) {
  610. bFindMatchPeer = true;
  611. break;
  612. }
  613. }
  614. }
  615. if (!bFindMatchPeer) {
  616. WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT" for Key Info!!!\n", __FUNCTION__, MAC_ARG(pTA));
  617. return false;
  618. }
  619. if (IS_MCAST(pRA)) {
  620. WAPI_TRACE(WAPI_RX, "%s: Multicast decryption !!!\n", __FUNCTION__);
  621. if (pWapiSta->wapiMsk.keyId == KeyIdx && pWapiSta->wapiMsk.bSet) {
  622. pLastRxPN = pWapiSta->lastRxMulticastPN;
  623. if (!WapiComparePN(pRecvPN, pLastRxPN)) {
  624. WAPI_TRACE(WAPI_ERR, "%s: MSK PN is not larger than last, Dropped!!!\n", __FUNCTION__);
  625. WAPI_DATA(WAPI_ERR, "pRecvPN:", pRecvPN, 16);
  626. WAPI_DATA(WAPI_ERR, "pLastRxPN:", pLastRxPN, 16);
  627. return false;
  628. }
  629. memcpy(pLastRxPN, pRecvPN, 16);
  630. pMicKey = pWapiSta->wapiMsk.micKey;
  631. pDataKey = pWapiSta->wapiMsk.dataKey;
  632. } else if (pWapiSta->wapiMskUpdate.keyId == KeyIdx && pWapiSta->wapiMskUpdate.bSet) {
  633. WAPI_TRACE(WAPI_RX, "%s: Use Updated MSK for Decryption !!!\n", __FUNCTION__);
  634. bUseUpdatedKey = true;
  635. memcpy(pWapiSta->lastRxMulticastPN, pRecvPN, 16);
  636. pMicKey = pWapiSta->wapiMskUpdate.micKey;
  637. pDataKey = pWapiSta->wapiMskUpdate.dataKey;
  638. } else {
  639. WAPI_TRACE(WAPI_ERR, "%s: Can not find MSK with matched KeyIdx(%d), Dropped !!!\n", __FUNCTION__, KeyIdx);
  640. return false;
  641. }
  642. } else {
  643. WAPI_TRACE(WAPI_RX, "%s: Unicast decryption !!!\n", __FUNCTION__);
  644. if (pWapiSta->wapiUsk.keyId == KeyIdx && pWapiSta->wapiUsk.bSet) {
  645. WAPI_TRACE(WAPI_RX, "%s: Use USK for Decryption!!!\n", __FUNCTION__);
  646. if (precv_hdr->bWapiCheckPNInDecrypt) {
  647. if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE) {
  648. WapiGetLastRxUnicastPNForQoSData(TID, pWapiSta, lastRxPNforQoS);
  649. pLastRxPN = lastRxPNforQoS;
  650. } else
  651. pLastRxPN = pWapiSta->lastRxUnicastPN;
  652. if (!WapiComparePN(pRecvPN, pLastRxPN))
  653. return false;
  654. if (bQosData)
  655. WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
  656. else
  657. memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
  658. } else
  659. memcpy(precv_hdr->WapiTempPN, pRecvPN, 16);
  660. if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE)) {
  661. if ((pRecvPN[0] & 0x1) == 0) {
  662. WAPI_TRACE(WAPI_ERR, "%s: Rx USK PN is not odd when Infra STA mode, Dropped !!!\n", __FUNCTION__);
  663. return false;
  664. }
  665. }
  666. pMicKey = pWapiSta->wapiUsk.micKey;
  667. pDataKey = pWapiSta->wapiUsk.dataKey;
  668. } else if (pWapiSta->wapiUskUpdate.keyId == KeyIdx && pWapiSta->wapiUskUpdate.bSet) {
  669. WAPI_TRACE(WAPI_RX, "%s: Use Updated USK for Decryption!!!\n", __FUNCTION__);
  670. if (pWapiSta->bAuthenticatorInUpdata)
  671. bUseUpdatedKey = true;
  672. else
  673. bUseUpdatedKey = false;
  674. if (bQosData)
  675. WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
  676. else
  677. memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
  678. pMicKey = pWapiSta->wapiUskUpdate.micKey;
  679. pDataKey = pWapiSta->wapiUskUpdate.dataKey;
  680. } else {
  681. WAPI_TRACE(WAPI_ERR, "%s: No valid USK!!!KeyIdx=%d pWapiSta->wapiUsk.keyId=%d pWapiSta->wapiUskUpdate.keyId=%d\n", __FUNCTION__, KeyIdx, pWapiSta->wapiUsk.keyId,
  682. pWapiSta->wapiUskUpdate.keyId);
  683. /* dump_buf(pskb->data,pskb->len); */
  684. return false;
  685. }
  686. }
  687. WAPI_DATA(WAPI_RX, "Decryption - DataKey", pDataKey, 16);
  688. WAPI_DATA(WAPI_RX, "Decryption - IV", pRecvPN, 16);
  689. WapiSMS4Decryption(pDataKey, pRecvPN, pSecData, DataLen, pSecData, &OutputLength);
  690. if (OutputLength != DataLen)
  691. WAPI_TRACE(WAPI_ERR, "%s: Output Length Error!!!!\n", __FUNCTION__);
  692. WAPI_DATA(WAPI_RX, "Decryption - After decryption", pskb->data, pskb->len);
  693. DataLen -= padapter->wapiInfo.extra_postfix_len;
  694. SecCalculateMicSMS4(KeyIdx, pMicKey, pskb->data, pSecData, DataLen, MicBuffer);
  695. WAPI_DATA(WAPI_RX, "Decryption - MIC received", pRecvMic, SMS4_MIC_LEN);
  696. WAPI_DATA(WAPI_RX, "Decryption - MIC calculated", MicBuffer, SMS4_MIC_LEN);
  697. if (0 == memcmp(MicBuffer, pRecvMic, padapter->wapiInfo.extra_postfix_len)) {
  698. WAPI_TRACE(WAPI_RX, "%s: Check MIC OK!!\n", __FUNCTION__);
  699. if (bUseUpdatedKey) {
  700. /* delete the old key */
  701. if (IS_MCAST(pRA)) {
  702. WAPI_TRACE(WAPI_API, "%s(): AE use new update MSK!!\n", __FUNCTION__);
  703. pWapiSta->wapiMsk.keyId = pWapiSta->wapiMskUpdate.keyId;
  704. memcpy(pWapiSta->wapiMsk.dataKey, pWapiSta->wapiMskUpdate.dataKey, 16);
  705. memcpy(pWapiSta->wapiMsk.micKey, pWapiSta->wapiMskUpdate.micKey, 16);
  706. pWapiSta->wapiMskUpdate.bTxEnable = pWapiSta->wapiMskUpdate.bSet = false;
  707. } else {
  708. WAPI_TRACE(WAPI_API, "%s(): AE use new update USK!!\n", __FUNCTION__);
  709. pWapiSta->wapiUsk.keyId = pWapiSta->wapiUskUpdate.keyId;
  710. memcpy(pWapiSta->wapiUsk.dataKey, pWapiSta->wapiUskUpdate.dataKey, 16);
  711. memcpy(pWapiSta->wapiUsk.micKey, pWapiSta->wapiUskUpdate.micKey, 16);
  712. pWapiSta->wapiUskUpdate.bTxEnable = pWapiSta->wapiUskUpdate.bSet = false;
  713. }
  714. }
  715. } else {
  716. WAPI_TRACE(WAPI_ERR, "%s: Check MIC Error, Dropped !!!!\n", __FUNCTION__);
  717. return false;
  718. }
  719. pos = pskb->data;
  720. memmove(pos + padapter->wapiInfo.extra_prefix_len, pos, IVOffset);
  721. skb_pull(pskb, padapter->wapiInfo.extra_prefix_len);
  722. WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
  723. return true;
  724. }
  725. u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
  726. {
  727. u8 *pframe;
  728. u32 res = _SUCCESS;
  729. WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
  730. if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable)) {
  731. WAPI_TRACE(WAPI_TX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
  732. return _FAIL;
  733. }
  734. if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
  735. return _FAIL;
  736. pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
  737. SecSWSMS4Encryption(padapter, pxmitframe);
  738. WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
  739. return res;
  740. }
  741. u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
  742. {
  743. u8 *pframe;
  744. u32 res = _SUCCESS;
  745. WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
  746. if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable)) {
  747. WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
  748. return _FAIL;
  749. }
  750. /* drop packet when hw decrypt fail
  751. * return tempraily */
  752. return _FAIL;
  753. /* pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; */
  754. if (false == SecSWSMS4Decryption(padapter, precvframe, &padapter->recvpriv)) {
  755. WAPI_TRACE(WAPI_ERR, "%s():SMS4 decrypt frame error\n", __FUNCTION__);
  756. return _FAIL;
  757. }
  758. WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
  759. return res;
  760. }
  761. #else
  762. u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
  763. {
  764. WAPI_TRACE(WAPI_TX, "=========>Dummy %s\n", __FUNCTION__);
  765. WAPI_TRACE(WAPI_TX, "<=========Dummy %s\n", __FUNCTION__);
  766. return _SUCCESS;
  767. }
  768. u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
  769. {
  770. WAPI_TRACE(WAPI_RX, "=========>Dummy %s\n", __FUNCTION__);
  771. WAPI_TRACE(WAPI_RX, "<=========Dummy %s\n", __FUNCTION__);
  772. return _SUCCESS;
  773. }
  774. #endif
  775. #endif