privacy.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/privacy.h#1
  3. */
  4. /*! \file privacy.h
  5. * \brief This file contains the function declaration for privacy.c.
  6. */
  7. /*
  8. ** Log: privacy.h
  9. **
  10. ** 07 25 2014 eason.tsai
  11. ** AOSP
  12. **
  13. ** 07 30 2013 wh.su
  14. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  15. ** Add Rx TKIP mic check
  16. **
  17. ** 07 30 2013 wh.su
  18. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  19. ** Add a function, for rx, input the rx wlan index to get the bss index
  20. **
  21. ** 07 26 2013 terry.wu
  22. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  23. ** 1. Reduce extra Tx frame header parsing
  24. ** 2. Add TX port control
  25. ** 3. Add net interface to BSS binding
  26. **
  27. ** 07 19 2013 wh.su
  28. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  29. ** wapi 1x frame don't need encrypt
  30. **
  31. ** 07 17 2013 wh.su
  32. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  33. ** fix and modify some security code
  34. **
  35. ** 07 05 2013 wh.su
  36. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  37. ** Fix to let the wpa-psk ok
  38. **
  39. ** 07 04 2013 wh.su
  40. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  41. ** Add a <<temp function>> to decide data frame need encrypted or not
  42. **
  43. ** 07 04 2013 wh.su
  44. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  45. ** Add the function to got the STA index via the wlan index
  46. ** report at Rx status
  47. **
  48. ** 07 02 2013 wh.su
  49. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  50. ** Refine some secutity code
  51. **
  52. ** 07 02 2013 wh.su
  53. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  54. ** Refine security BMC wlan index assign
  55. ** Fix some compiling warning
  56. **
  57. ** 03 29 2013 wh.su
  58. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  59. ** Do more sta record free mechanism check
  60. ** remove non-used code
  61. **
  62. ** 03 27 2013 wh.su
  63. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  64. ** add default ket handler
  65. **
  66. ** 03 20 2013 wh.su
  67. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  68. ** Add the security code for wlan table assign operation
  69. **
  70. ** 03 14 2013 wh.su
  71. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  72. ** .modify some code define and flow
  73. **
  74. ** 03 13 2013 wh.su
  75. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  76. ** .remove non-used code
  77. **
  78. */
  79. #ifndef _PRIVACY_H
  80. #define _PRIVACY_H
  81. /*******************************************************************************
  82. * C O M P I L E R F L A G S
  83. ********************************************************************************
  84. */
  85. /*******************************************************************************
  86. * E X T E R N A L R E F E R E N C E S
  87. ********************************************************************************
  88. */
  89. /*******************************************************************************
  90. * C O N S T A N T S
  91. ********************************************************************************
  92. */
  93. #define MAX_KEY_NUM 4
  94. #define WEP_40_LEN 5
  95. #define WEP_104_LEN 13
  96. #define LEGACY_KEY_MAX_LEN 16
  97. #define CCMP_KEY_LEN 16
  98. #define TKIP_KEY_LEN 32
  99. #define MAX_KEY_LEN 32
  100. #define MIC_RX_KEY_OFFSET 16
  101. #define MIC_TX_KEY_OFFSET 24
  102. #define MIC_KEY_LEN 8
  103. #define WEP_KEY_ID_FIELD BITS(0, 29)
  104. #define KEY_ID_FIELD BITS(0, 7)
  105. #define IS_TRANSMIT_KEY BIT(31)
  106. #define IS_UNICAST_KEY BIT(30)
  107. #define IS_AUTHENTICATOR BIT(28)
  108. #define CIPHER_SUITE_NONE 0
  109. #define CIPHER_SUITE_WEP40 1
  110. #define CIPHER_SUITE_TKIP 2
  111. #define CIPHER_SUITE_TKIP_WO_MIC 3
  112. #define CIPHER_SUITE_CCMP 4
  113. #define CIPHER_SUITE_WEP104 5
  114. #define CIPHER_SUITE_BIP 6
  115. #define CIPHER_SUITE_WEP128 7
  116. #define CIPHER_SUITE_WPI 8
  117. #define CIPHER_SUITE_CCMP_W_CCX 9
  118. #define CIPHER_SUITE_GCMP 10
  119. /* Todo:: Move to register */
  120. #if defined(MT6630)
  121. #define WTBL_RESERVED_ENTRY 255
  122. #else
  123. #define WTBL_RESERVED_ENTRY 255
  124. #endif
  125. #define WTBL_SIZE 32 /* Max wlan table size, the max+1 used for probe request,... mgmt frame
  126. *sending use basic rate and no security */
  127. #define WTBL_ALLOC_FAIL WTBL_RESERVED_ENTRY
  128. #define WTBL_DEFAULT_ENTRY 0
  129. #define WTBL_STA_IDX_0 0
  130. #define WTBL_STA_IDX_MAX 17
  131. #define WTBL_IBSS_STA_IDX_MAX 7
  132. #define WTBL_AIS_BIP_IDX 18
  133. #define WTBL_IBSS_BC_IDX_0 9
  134. #define WTBL_BC_IDX_0 19
  135. #define WTBL_BC_IDX_MAX 27
  136. #define WTBL_AIS_DLS_MAX_IDX (WTBL_STA_IDX_MAX - 7) /* Reserved for DLS:end entry, Todo:: Max DLS entry
  137. *define */
  138. #define WTBL_AIS_IBSS_NO_SEC_BC_IDX 28 /* Reserved for Ad-hoc No sec index */
  139. #define WTBL_AP_NO_SEC_BC_IDX 28 /* Reserved for AP mode No Sec index */
  140. /*******************************************************************************
  141. * D A T A T Y P E S
  142. ********************************************************************************
  143. */
  144. typedef struct _IEEE_802_1X_HDR {
  145. UINT_8 ucVersion;
  146. UINT_8 ucType;
  147. UINT_16 u2Length;
  148. /* followed by length octets of data */
  149. } IEEE_802_1X_HDR, *P_IEEE_802_1X_HDR;
  150. typedef struct _EAPOL_KEY {
  151. UINT_8 ucType;
  152. /* Note: key_info, key_length, and key_data_length are unaligned */
  153. UINT_8 aucKeyInfo[2]; /* big endian */
  154. UINT_8 aucKeyLength[2]; /* big endian */
  155. UINT_8 aucReplayCounter[8];
  156. UINT_8 aucKeyNonce[16];
  157. UINT_8 aucKeyIv[16];
  158. UINT_8 aucKeyRsc[8];
  159. UINT_8 aucKeyId[8]; /* Reserved in IEEE 802.11i/RSN */
  160. UINT_8 aucKeyMic[16];
  161. UINT_8 aucKeyDataLength[2]; /* big endian */
  162. /* followed by key_data_length bytes of key_data */
  163. } EAPOL_KEY, *P_EAPOL_KEY;
  164. /* WPA2 PMKID candicate structure */
  165. typedef struct _PMKID_CANDICATE_T {
  166. UINT_8 aucBssid[MAC_ADDR_LEN];
  167. UINT_32 u4PreAuthFlags;
  168. } PMKID_CANDICATE_T, *P_PMKID_CANDICATE_T;
  169. #if 0
  170. /* WPA2 PMKID cache structure */
  171. typedef struct _PMKID_ENTRY_T {
  172. PARAM_BSSID_INFO_T rBssidInfo;
  173. BOOLEAN fgPmkidExist;
  174. } PMKID_ENTRY_T, *P_PMKID_ENTRY_T;
  175. #endif
  176. /*******************************************************************************
  177. * P U B L I C D A T A
  178. ********************************************************************************
  179. */
  180. /*******************************************************************************
  181. * P R I V A T E D A T A
  182. ********************************************************************************
  183. */
  184. /*******************************************************************************
  185. * M A C R O S
  186. ********************************************************************************
  187. */
  188. /*******************************************************************************
  189. * F U N C T I O N D E C L A R A T I O N S
  190. ********************************************************************************
  191. */
  192. VOID secInit(IN P_ADAPTER_T prAdapter, IN UINT_8 ucBssIndex);
  193. VOID secSetPortBlocked(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta, IN BOOLEAN fgPort);
  194. BOOL secCheckClassError(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb, IN P_STA_RECORD_T prStaRec);
  195. BOOL secTxPortControlCheck(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo, IN P_STA_RECORD_T prStaRec);
  196. BOOLEAN secRxPortControlCheck(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSWRfb);
  197. VOID secSetCipherSuite(IN P_ADAPTER_T prAdapter, IN UINT_32 u4CipherSuitesFlags);
  198. BOOLEAN secIsProtectedFrame(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsdu, IN P_STA_RECORD_T prStaRec);
  199. VOID secClearPmkid(IN P_ADAPTER_T prAdapter);
  200. BOOLEAN secRsnKeyHandshakeEnabled(IN P_ADAPTER_T prAdapter);
  201. UINT_8 secGetBmcWlanIndex(IN P_ADAPTER_T prAdapter, IN ENUM_NETWORK_TYPE_T eNetType, IN P_STA_RECORD_T prStaRec);
  202. BOOLEAN secTransmitKeyExist(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta);
  203. BOOLEAN secEnabledInAis(IN P_ADAPTER_T prAdapter);
  204. BOOL secPrivacySeekForEntry(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta);
  205. VOID secPrivacyFreeForEntry(IN P_ADAPTER_T prAdapter, IN UINT_8 ucEntry);
  206. VOID secPrivacyFreeSta(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prStaRec);
  207. UINT_8
  208. secPrivacySeekForBcEntry(IN P_ADAPTER_T prAdapter, IN UINT_8 ucBssIndex, IN PUINT_8 pucAddr, IN UINT_8 ucStaIdx, IN
  209. UINT_8 ucAlg, IN UINT_8 ucKeyId, IN UINT_8 ucCurrentKeyId, IN UINT_8 ucTxRx);
  210. UINT_8 secGetStaIdxByWlanIdx(P_ADAPTER_T prAdapter, UINT_8 ucWlanIdx);
  211. UINT_8 secGetBssIdxByWlanIdx(P_ADAPTER_T prAdapter, UINT_8 ucWlanIdx);
  212. UINT_8 secLookupStaRecIndexFromTA(P_ADAPTER_T prAdapter, PUINT_8 pucMacAddress);
  213. void secPrivacyDumpWTBL(IN P_ADAPTER_T prAdapter);
  214. BOOLEAN secCheckWTBLAssign(IN P_ADAPTER_T prAdapter);
  215. void secPrivacyDumpWTBL3(IN P_ADAPTER_T prAdapter, IN UINT_8 ucIndex);
  216. BOOLEAN secIsProtected1xFrame(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prStaRec);
  217. BOOLEAN secIsProtectedBss(IN P_ADAPTER_T prAdapter, IN P_BSS_INFO_T prBssInfo);
  218. BOOLEAN tkipMicDecapsulate(IN P_SW_RFB_T prSwRfb, IN PUINT_8 pucMicKey);
  219. /*******************************************************************************
  220. * F U N C T I O N S
  221. ********************************************************************************
  222. */
  223. #endif /* _PRIVACY_H */