rsn.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rsn.h#1
  3. */
  4. /*! \file rsn.h
  5. \brief The wpa/rsn related define, macro and structure are described here.
  6. */
  7. /*
  8. ** Log: rsn.h
  9. *
  10. * 10 12 2011 wh.su
  11. * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
  12. * adding the 802.11w related function and define .
  13. *
  14. * 06 22 2011 wh.su
  15. * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h
  16. * and let the sw structure not align at byte
  17. * Move the WAPI/RSN IE to mac.h and SW structure not align to byte,
  18. * Notice needed update P2P.ko.
  19. *
  20. * 03 17 2011 chinglan.wang
  21. * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature
  22. * .
  23. *
  24. * 02 09 2011 wh.su
  25. * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode
  26. * adding the code for check STA privacy bit at AP mode, .
  27. *
  28. * 11 05 2010 wh.su
  29. * [WCXRP00000165] [MT6620 Wi-Fi] [Pre-authentication] Assoc req rsn ie use wrong pmkid value
  30. * fixed the.pmkid value mismatch issue
  31. *
  32. * 10 04 2010 wh.su
  33. * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P
  34. * add a kal function for set cipher.
  35. *
  36. * 09 01 2010 wh.su
  37. * NULL
  38. * adding the wapi support for integration test.
  39. *
  40. * 08 30 2010 wh.su
  41. * NULL
  42. * remove non-used code.
  43. *
  44. * 08 19 2010 wh.su
  45. * NULL
  46. * adding the tx pkt call back handle for countermeasure.
  47. *
  48. * 07 08 2010 cp.wu
  49. *
  50. * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
  51. *
  52. * 06 18 2010 wh.su
  53. * [WPD00003840][MT6620 5931] Security migration
  54. * migration from MT6620 firmware.
  55. *
  56. * 03 03 2010 wh.su
  57. * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
  58. * Fixed the pre-authentication timer not correctly init issue, and modify
  59. * the security related callback function prototype.
  60. *
  61. * 01 27 2010 wh.su
  62. * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
  63. * add and fixed some security function.
  64. *
  65. * Dec 4 2009 mtk01088
  66. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  67. * adjust the function prototype for generate wap/rsn ie
  68. *
  69. * Dec 3 2009 mtk01088
  70. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  71. * adjust the function input parameter
  72. *
  73. * Dec 1 2009 mtk01088
  74. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  75. * adding some event function declaration
  76. *
  77. * Nov 26 2009 mtk01088
  78. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  79. * move the internal data structure for pmkid to rsn.h
  80. *
  81. * Nov 23 2009 mtk01088
  82. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  83. * adding the port control and class error function
  84. *
  85. * Nov 19 2009 mtk01088
  86. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  87. * adding the pmkid candidate
  88. *
  89. * Nov 18 2009 mtk01088
  90. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  91. *
  92. **
  93. */
  94. #ifndef _RSN_H
  95. #define _RSN_H
  96. /*******************************************************************************
  97. * C O M P I L E R F L A G S
  98. ********************************************************************************
  99. */
  100. /*******************************************************************************
  101. * E X T E R N A L R E F E R E N C E S
  102. ********************************************************************************
  103. */
  104. /*******************************************************************************
  105. * C O N S T A N T S
  106. ********************************************************************************
  107. */
  108. /* ----- Definitions for Cipher Suite Selectors ----- */
  109. #define RSN_CIPHER_SUITE_USE_GROUP_KEY 0x00AC0F00
  110. #define RSN_CIPHER_SUITE_WEP40 0x01AC0F00
  111. #define RSN_CIPHER_SUITE_TKIP 0x02AC0F00
  112. #define RSN_CIPHER_SUITE_CCMP 0x04AC0F00
  113. #define RSN_CIPHER_SUITE_WEP104 0x05AC0F00
  114. #if CFG_SUPPORT_802_11W
  115. #define RSN_CIPHER_SUITE_AES_128_CMAC 0x06AC0F00
  116. #endif
  117. #define WPA_CIPHER_SUITE_NONE 0x00F25000
  118. #define WPA_CIPHER_SUITE_WEP40 0x01F25000
  119. #define WPA_CIPHER_SUITE_TKIP 0x02F25000
  120. #define WPA_CIPHER_SUITE_CCMP 0x04F25000
  121. #define WPA_CIPHER_SUITE_WEP104 0x05F25000
  122. /* ----- Definitions for Authentication and Key Management Suite Selectors ----- */
  123. #define RSN_AKM_SUITE_NONE 0x00AC0F00
  124. #define RSN_AKM_SUITE_802_1X 0x01AC0F00
  125. #define RSN_AKM_SUITE_PSK 0x02AC0F00
  126. #if CFG_SUPPORT_802_11W
  127. #define RSN_AKM_SUITE_802_1X_SHA256 0x05AC0F00
  128. #define RSN_AKM_SUITE_PSK_SHA256 0x06AC0F00
  129. #endif
  130. #define WPA_AKM_SUITE_NONE 0x00F25000
  131. #define WPA_AKM_SUITE_802_1X 0x01F25000
  132. #define WPA_AKM_SUITE_PSK 0x02F25000
  133. #define ELEM_ID_RSN_LEN_FIXED 20 /* The RSN IE len for associate request */
  134. #define ELEM_ID_WPA_LEN_FIXED 22 /* The RSN IE len for associate request */
  135. #define MASK_RSNIE_CAP_PREAUTH BIT(0)
  136. #define GET_SELECTOR_TYPE(x) ((UINT_8)(((x) >> 24) & 0x000000FF))
  137. #define SET_SELECTOR_TYPE(x, y) {x = (((x) & 0x00FFFFFF) | (((UINT_32)(y) << 24) & 0xFF000000))}
  138. #define AUTH_CIPHER_CCMP 0x00000008
  139. /* Cihpher suite flags */
  140. #define CIPHER_FLAG_NONE 0x00000000
  141. #define CIPHER_FLAG_WEP40 0x00000001 /* BIT 1 */
  142. #define CIPHER_FLAG_TKIP 0x00000002 /* BIT 2 */
  143. #define CIPHER_FLAG_CCMP 0x00000008 /* BIT 4 */
  144. #define CIPHER_FLAG_WEP104 0x00000010 /* BIT 5 */
  145. #define CIPHER_FLAG_WEP128 0x00000020 /* BIT 6 */
  146. #define WAIT_TIME_IND_PMKID_CANDICATE_SEC 6 /* seconds */
  147. #define TKIP_COUNTERMEASURE_SEC 60 /* seconds */
  148. #if CFG_SUPPORT_802_11W
  149. #define RSN_AUTH_MFP_DISABLED 0 /* MFP disabled */
  150. #define RSN_AUTH_MFP_OPTIONAL 1 /* MFP optional */
  151. #define RSN_AUTH_MFP_REQUIRED 2 /* MFP required */
  152. #endif
  153. /*******************************************************************************
  154. * D A T A T Y P E S
  155. ********************************************************************************
  156. */
  157. /* Flags for PMKID Candidate list structure */
  158. #define EVENT_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
  159. #define CONTROL_FLAG_UC_MGMT_NO_ENC BIT(5)
  160. /*******************************************************************************
  161. * P U B L I C D A T A
  162. ********************************************************************************
  163. */
  164. /*******************************************************************************
  165. * P R I V A T E D A T A
  166. ********************************************************************************
  167. */
  168. /*******************************************************************************
  169. * M A C R O S
  170. ********************************************************************************
  171. */
  172. #define RSN_IE(fp) ((P_RSN_INFO_ELEM_T) fp)
  173. #define WPA_IE(fp) ((P_WPA_INFO_ELEM_T) fp)
  174. /*******************************************************************************
  175. * F U N C T I O N D E C L A R A T I O N S
  176. ********************************************************************************
  177. */
  178. BOOLEAN rsnParseRsnIE(IN P_ADAPTER_T prAdapter, IN P_RSN_INFO_ELEM_T prInfoElem, OUT P_RSN_INFO_T prRsnInfo);
  179. BOOLEAN rsnParseWpaIE(IN P_ADAPTER_T prAdapter, IN P_WPA_INFO_ELEM_T prInfoElem, OUT P_RSN_INFO_T prWpaInfo);
  180. BOOLEAN rsnSearchSupportedCipher(IN P_ADAPTER_T prAdapter, IN UINT_32 u4Cipher, OUT PUINT_32 pu4Index);
  181. BOOLEAN rsnSearchAKMSuite(IN P_ADAPTER_T prAdapter, IN UINT_32 u4AkmSuite, OUT PUINT_32 pu4Index);
  182. BOOLEAN rsnPerformPolicySelection(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBss);
  183. VOID rsnGenerateWpaNoneIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
  184. VOID rsnGenerateWPAIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
  185. VOID rsnGenerateRSNIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
  186. BOOLEAN
  187. rsnParseCheckForWFAInfoElem(IN P_ADAPTER_T prAdapter,
  188. IN PUINT_8 pucBuf, OUT PUINT_8 pucOuiType, OUT PUINT_16 pu2SubTypeVersion);
  189. BOOLEAN rsnIsSuitableBSS(IN P_ADAPTER_T prAdapter, IN P_RSN_INFO_T prBssRsnInfo);
  190. #if CFG_SUPPORT_AAA
  191. void rsnParserCheckForRSNCCMPPSK(P_ADAPTER_T prAdapter, P_RSN_INFO_ELEM_T prIe, PUINT_16 pu2StatusCode);
  192. #endif
  193. VOID rsnTkipHandleMICFailure(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta, IN BOOLEAN fgErrorKeyType);
  194. VOID rsnSelectPmkidCandidateList(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBssDesc);
  195. VOID rsnUpdatePmkidCandidateList(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBssDesc);
  196. BOOLEAN rsnSearchPmkidEntry(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBssid, OUT PUINT_32 pu4EntryIndex);
  197. BOOLEAN rsnCheckPmkidCandicate(IN P_ADAPTER_T prAdapter);
  198. VOID rsnCheckPmkidCache(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBss);
  199. VOID rsnGeneratePmkidIndication(IN P_ADAPTER_T prAdapter);
  200. VOID rsnIndicatePmkidCand(IN P_ADAPTER_T prAdapter, IN ULONG ulParm);
  201. #if CFG_SUPPORT_WPS2
  202. VOID rsnGenerateWSCIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
  203. #endif
  204. #if CFG_SUPPORT_802_11W
  205. UINT_32 rsnCheckBipKeyInstalled(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prStaRec);
  206. UINT_8 rsnCheckSaQueryTimeout(IN P_ADAPTER_T prAdapter);
  207. void rsnStartSaQueryTimer(IN P_ADAPTER_T prAdapter);
  208. void rsnStartSaQuery(IN P_ADAPTER_T prAdapter);
  209. void rsnStopSaQuery(IN P_ADAPTER_T prAdapter);
  210. void rsnSaQueryRequest(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb);
  211. void rsnSaQueryAction(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb);
  212. BOOLEAN rsnCheckRxMgmt(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb, IN UINT_8 ucSubtype);
  213. #endif
  214. BOOLEAN rsnCheckSecurityModeChanged(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo, P_BSS_DESC_T prBssDesc);
  215. /*******************************************************************************
  216. * F U N C T I O N S
  217. ********************************************************************************
  218. */
  219. #endif /* _RSN_H */