privacy.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 24 2010 wh.su
  11. *
  12. * .support the Wi-Fi RSN
  13. *
  14. * 07 08 2010 cp.wu
  15. *
  16. * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
  17. *
  18. * 06 21 2010 wh.su
  19. * [WPD00003840][MT6620 5931] Security migration
  20. * modify some code for concurrent network.
  21. *
  22. * 06 19 2010 wh.su
  23. * [WPD00003840][MT6620 5931] Security migration
  24. * consdier the concurrent network setting.
  25. *
  26. * 06 18 2010 wh.su
  27. * [WPD00003840][MT6620 5931] Security migration
  28. * migration the security related function from firmware.
  29. *
  30. * 03 01 2010 wh.su
  31. * [BORA00000605][WIFISYS] Phase3 Integration
  32. * Refine the variable and parameter for security.
  33. *
  34. * 02 25 2010 wh.su
  35. * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing
  36. * For support the WHQL test, do the remove key code refine.
  37. *
  38. * Dec 10 2009 mtk01088
  39. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  40. * change the cmd return type
  41. *
  42. * Dec 8 2009 mtk01088
  43. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  44. * adding the function declaration for auth mode and encryption status setting from build connection command
  45. *
  46. * Dec 7 2009 mtk01088
  47. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  48. * adding the function declaration for wapi
  49. *
  50. * Dec 7 2009 mtk01088
  51. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  52. * adding the tx done callback handle function
  53. *
  54. * Dec 7 2009 mtk01088
  55. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  56. * adding the function declaration for mac header privacy bit setting
  57. *
  58. * Dec 4 2009 mtk01088
  59. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  60. * adding the structure for parsing the EAPoL frame
  61. *
  62. * Dec 3 2009 mtk01088
  63. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  64. * adjust the class error function parameter
  65. *
  66. * Dec 1 2009 mtk01088
  67. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  68. * adding some security function declaration
  69. *
  70. * Nov 19 2009 mtk01088
  71. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  72. * adding the ap selection structure
  73. *
  74. * Nov 18 2009 mtk01088
  75. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  76. *
  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 WPA_KEY_INFO_KEY_TYPE BIT(3) /* 1 = Pairwise, 0 = Group key */
  118. #define WPA_KEY_INFO_MIC BIT(8)
  119. #define WPA_KEY_INFO_SECURE BIT(9)
  120. #define MASK_2ND_EAPOL (WPA_KEY_INFO_KEY_TYPE | WPA_KEY_INFO_MIC)
  121. /*******************************************************************************
  122. * D A T A T Y P E S
  123. ********************************************************************************
  124. */
  125. typedef struct _IEEE_802_1X_HDR {
  126. UINT_8 ucVersion;
  127. UINT_8 ucType;
  128. UINT_16 u2Length;
  129. /* followed by length octets of data */
  130. } IEEE_802_1X_HDR, *P_IEEE_802_1X_HDR;
  131. typedef struct _EAPOL_KEY {
  132. UINT_8 ucType;
  133. /* Note: key_info, key_length, and key_data_length are unaligned */
  134. UINT_8 aucKeyInfo[2]; /* big endian */
  135. UINT_8 aucKeyLength[2]; /* big endian */
  136. UINT_8 aucReplayCounter[8];
  137. UINT_8 aucKeyNonce[16];
  138. UINT_8 aucKeyIv[16];
  139. UINT_8 aucKeyRsc[8];
  140. UINT_8 aucKeyId[8]; /* Reserved in IEEE 802.11i/RSN */
  141. UINT_8 aucKeyMic[16];
  142. UINT_8 aucKeyDataLength[2]; /* big endian */
  143. /* followed by key_data_length bytes of key_data */
  144. } EAPOL_KEY, *P_EAPOL_KEY;
  145. /* WPA2 PMKID candicate structure */
  146. typedef struct _PMKID_CANDICATE_T {
  147. UINT_8 aucBssid[MAC_ADDR_LEN];
  148. UINT_32 u4PreAuthFlags;
  149. } PMKID_CANDICATE_T, *P_PMKID_CANDICATE_T;
  150. #if 0
  151. /* WPA2 PMKID cache structure */
  152. typedef struct _PMKID_ENTRY_T {
  153. PARAM_BSSID_INFO_T rBssidInfo;
  154. BOOLEAN fgPmkidExist;
  155. } PMKID_ENTRY_T, *P_PMKID_ENTRY_T;
  156. #endif
  157. /*******************************************************************************
  158. * P U B L I C D A T A
  159. ********************************************************************************
  160. */
  161. /*******************************************************************************
  162. * P R I V A T E D A T A
  163. ********************************************************************************
  164. */
  165. /*******************************************************************************
  166. * M A C R O S
  167. ********************************************************************************
  168. */
  169. /*******************************************************************************
  170. * F U N C T I O N D E C L A R A T I O N S
  171. ********************************************************************************
  172. */
  173. VOID secInit(IN P_ADAPTER_T prAdapter, IN UINT_8 ucNetTypeIdx);
  174. VOID secSetPortBlocked(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta, IN BOOLEAN fgPort);
  175. BOOLEAN secCheckClassError(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb, IN P_STA_RECORD_T prStaRec);
  176. BOOLEAN secTxPortControlCheck(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo, IN P_STA_RECORD_T prStaRec);
  177. BOOLEAN secRxPortControlCheck(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSWRfb);
  178. VOID secSetCipherSuite(IN P_ADAPTER_T prAdapter, IN UINT_32 u4CipherSuitesFlags);
  179. BOOLEAN
  180. secProcessEAPOL(IN P_ADAPTER_T prAdapter,
  181. IN P_MSDU_INFO_T prMsduInfo,
  182. IN P_STA_RECORD_T prStaRec, IN PUINT_8 pucPayload, IN UINT_16 u2PayloadLen);
  183. VOID
  184. secHandleTxDoneCallback(IN P_ADAPTER_T prAdapter,
  185. IN P_MSDU_INFO_T pMsduInfo, IN P_STA_RECORD_T prStaRec, IN WLAN_STATUS rStatus);
  186. BOOLEAN secIsProtectedFrame(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsdu, IN P_STA_RECORD_T prStaRec);
  187. VOID secClearPmkid(IN P_ADAPTER_T prAdapter);
  188. BOOLEAN secRsnKeyHandshakeEnabled(IN P_ADAPTER_T prAdapter);
  189. BOOLEAN secTransmitKeyExist(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta);
  190. BOOLEAN secEnabledInAis(IN P_ADAPTER_T prAdapter);
  191. /*******************************************************************************
  192. * F U N C T I O N S
  193. ********************************************************************************
  194. */
  195. #endif /* _PRIVACY_H */