rsn.h 11 KB

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