add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / combo_mt66xx / mt6628 / wlan / include / mgmt / rsn.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rsn.h#1 $
3 */
4
5 /*! \file   rsn.h
6     \brief  The wpa/rsn related define, macro and structure are described here.
7 */
8
9
10
11 /*
12 ** $Log: rsn.h $
13  *
14  * 10 12 2011 wh.su
15  * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
16  * adding the 802.11w related function and define .
17  *
18  * 06 22 2011 wh.su
19  * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h and let the sw structure not align at byte
20  * Move the WAPI/RSN IE to mac.h and SW structure not align to byte, 
21  * Notice needed update P2P.ko.
22  *
23  * 03 17 2011 chinglan.wang
24  * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature
25  * .
26  *
27  * 02 09 2011 wh.su
28  * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode
29  * adding the code for check STA privacy bit at AP mode, .
30  *
31  * 11 05 2010 wh.su
32  * [WCXRP00000165] [MT6620 Wi-Fi] [Pre-authentication] Assoc req rsn ie use wrong pmkid value
33  * fixed the.pmkid value mismatch issue
34  *
35  * 10 04 2010 wh.su
36  * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P
37  * add a kal function for set cipher.
38  *
39  * 09 01 2010 wh.su
40  * NULL
41  * adding the wapi support for integration test.
42  *
43  * 08 30 2010 wh.su
44  * NULL
45  * remove non-used code.
46  *
47  * 08 19 2010 wh.su
48  * NULL
49  * adding the tx pkt call back handle for countermeasure.
50  *
51  * 07 08 2010 cp.wu
52  *
53  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
54  *
55  * 06 18 2010 wh.su
56  * [WPD00003840][MT6620 5931] Security migration
57  * migration from MT6620 firmware.
58  *
59  * 03 03 2010 wh.su
60  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
61  * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype.
62  *
63  * 01 27 2010 wh.su
64  * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
65  * add and fixed some security function.
66  *
67  * Dec 4 2009 mtk01088
68  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
69  * adjust the function prototype for generate wap/rsn ie
70  *
71  * Dec 3 2009 mtk01088
72  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
73  * adjust the function input parameter
74  *
75  * Dec 1 2009 mtk01088
76  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
77  * adding some event function declaration
78  *
79  * Nov 26 2009 mtk01088
80  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
81  * move the internal data structure for pmkid to rsn.h
82  *
83  * Nov 23 2009 mtk01088
84  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
85  * adding the port control and class error function
86  *
87  * Nov 19 2009 mtk01088
88  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
89  * adding the pmkid candidate
90  *
91  * Nov 18 2009 mtk01088
92  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
93  *
94 **
95 */
96
97 #ifndef _RSN_H
98 #define _RSN_H
99
100 /*******************************************************************************
101 *                         C O M P I L E R   F L A G S
102 ********************************************************************************
103 */
104
105 /*******************************************************************************
106 *                    E X T E R N A L   R E F E R E N C E S
107 ********************************************************************************
108 */
109
110 /*******************************************************************************
111 *                              C O N S T A N T S
112 ********************************************************************************
113 */
114 /* ----- Definitions for Cipher Suite Selectors ----- */
115 #define RSN_CIPHER_SUITE_USE_GROUP_KEY  0x00AC0F00
116 #define RSN_CIPHER_SUITE_WEP40          0x01AC0F00
117 #define RSN_CIPHER_SUITE_TKIP           0x02AC0F00
118 #define RSN_CIPHER_SUITE_CCMP           0x04AC0F00
119 #define RSN_CIPHER_SUITE_WEP104         0x05AC0F00
120 #if CFG_SUPPORT_802_11W
121 #define RSN_CIPHER_SUITE_AES_128_CMAC   0x06AC0F00
122 #endif
123
124 #define WPA_CIPHER_SUITE_NONE           0x00F25000
125 #define WPA_CIPHER_SUITE_WEP40          0x01F25000
126 #define WPA_CIPHER_SUITE_TKIP           0x02F25000
127 #define WPA_CIPHER_SUITE_CCMP           0x04F25000
128 #define WPA_CIPHER_SUITE_WEP104         0x05F25000
129
130 /* ----- Definitions for Authentication and Key Management Suite Selectors ----- */
131 #define RSN_AKM_SUITE_NONE              0x00AC0F00
132 #define RSN_AKM_SUITE_802_1X            0x01AC0F00
133 #define RSN_AKM_SUITE_PSK               0x02AC0F00
134 #if CFG_SUPPORT_802_11W
135 #define RSN_AKM_SUITE_802_1X_SHA256     0x05AC0F00
136 #define RSN_AKM_SUITE_PSK_SHA256        0x06AC0F00
137 #endif
138
139 #define WPA_AKM_SUITE_NONE              0x00F25000
140 #define WPA_AKM_SUITE_802_1X            0x01F25000
141 #define WPA_AKM_SUITE_PSK               0x02F25000
142
143 #define ELEM_ID_RSN_LEN_FIXED           20  /* The RSN IE len for associate request */
144
145 #define ELEM_ID_WPA_LEN_FIXED           22  /* The RSN IE len for associate request */
146
147 #define MASK_RSNIE_CAP_PREAUTH          BIT(0)
148
149 #define GET_SELECTOR_TYPE(x)           ((UINT_8)(((x) >> 24) & 0x000000FF))
150 #define SET_SELECTOR_TYPE(x, y)         x = (((x) & 0x00FFFFFF) | (((UINT_32)(y) << 24) & 0xFF000000))
151
152 #define AUTH_CIPHER_CCMP                0x00000008
153
154 /* Cihpher suite flags */
155 #define CIPHER_FLAG_NONE                        0x00000000
156 #define CIPHER_FLAG_WEP40                       0x00000001 /* BIT 1 */
157 #define CIPHER_FLAG_TKIP                        0x00000002 /* BIT 2 */
158 #define CIPHER_FLAG_CCMP                        0x00000008 /* BIT 4 */
159 #define CIPHER_FLAG_WEP104                      0x00000010 /* BIT 5 */
160 #define CIPHER_FLAG_WEP128                      0x00000020 /* BIT 6 */
161
162 #define WAIT_TIME_IND_PMKID_CANDICATE_SEC       6 /* seconds */
163 #define TKIP_COUNTERMEASURE_SEC                 60 /* seconds */
164
165 #if CFG_SUPPORT_802_11W
166 #define RSN_AUTH_MFP_DISABLED   0   /* MFP disabled */
167 #define RSN_AUTH_MFP_OPTIONAL   1   /* MFP optional */
168 #define RSN_AUTH_MFP_REQUIRED   2   /* MFP required */
169 #endif
170
171 /*******************************************************************************
172 *                             D A T A   T Y P E S
173 ********************************************************************************
174 */
175
176 /* Flags for PMKID Candidate list structure */
177 #define EVENT_PMKID_CANDIDATE_PREAUTH_ENABLED   0x01
178
179
180 #define CONTROL_FLAG_UC_MGMT_NO_ENC             BIT(5)
181
182 /*******************************************************************************
183 *                            P U B L I C   D A T A
184 ********************************************************************************
185 */
186
187 /*******************************************************************************
188 *                           P R I V A T E   D A T A
189 ********************************************************************************
190 */
191
192 /*******************************************************************************
193 *                                 M A C R O S
194 ********************************************************************************
195 */
196 #define RSN_IE(fp)              ((P_RSN_INFO_ELEM_T) fp)
197 #define WPA_IE(fp)              ((P_WPA_INFO_ELEM_T) fp)
198
199
200 /*******************************************************************************
201 *                  F U N C T I O N   D E C L A R A T I O N S
202 ********************************************************************************
203 */
204 BOOLEAN
205 rsnParseRsnIE(
206     IN  P_ADAPTER_T       prAdapter,
207     IN  P_RSN_INFO_ELEM_T prInfoElem,
208     OUT P_RSN_INFO_T      prRsnInfo
209     );
210
211 BOOLEAN
212 rsnParseWpaIE(
213     IN  P_ADAPTER_T       prAdapter,
214     IN  P_WPA_INFO_ELEM_T prInfoElem,
215     OUT P_RSN_INFO_T      prWpaInfo
216     );
217
218 BOOLEAN
219 rsnSearchSupportedCipher(
220     IN  P_ADAPTER_T       prAdapter,
221     IN  UINT_32           u4Cipher,
222     OUT PUINT_32          pu4Index
223     );
224
225 BOOLEAN
226 rsnSearchAKMSuite(
227     IN  P_ADAPTER_T       prAdapter,
228     IN  UINT_32           u4AkmSuite,
229     OUT PUINT_32          pu4Index
230     );
231
232 BOOLEAN
233 rsnPerformPolicySelection(
234     IN  P_ADAPTER_T       prAdapter,
235     IN  P_BSS_DESC_T      prBss
236     );
237
238 VOID
239 rsnGenerateWpaNoneIE(
240     IN  P_ADAPTER_T       prAdapter,
241     IN  P_MSDU_INFO_T     prMsduInfo
242     );
243
244 VOID
245 rsnGenerateWPAIE(
246     IN  P_ADAPTER_T       prAdapter,
247     IN  P_MSDU_INFO_T     prMsduInfo
248     );
249
250 VOID
251 rsnGenerateRSNIE(
252     IN  P_ADAPTER_T       prAdapter,
253     IN  P_MSDU_INFO_T     prMsduInfo
254     );
255
256 BOOLEAN
257 rsnParseCheckForWFAInfoElem(
258     IN  P_ADAPTER_T       prAdapter,
259     IN  PUINT_8           pucBuf,
260     OUT PUINT_8           pucOuiType,
261     OUT PUINT_16          pu2SubTypeVersion
262     );
263
264 BOOLEAN
265 rsnIsSuitableBSS (
266     IN P_ADAPTER_T          prAdapter,
267     IN P_RSN_INFO_T         prBssRsnInfo
268     );
269
270 #if CFG_SUPPORT_AAA
271 void
272 rsnParserCheckForRSNCCMPPSK (
273     P_ADAPTER_T           prAdapter,
274     P_RSN_INFO_ELEM_T     prIe,
275     PUINT_16              pu2StatusCode
276     );
277 #endif
278
279 VOID
280 rsnTkipHandleMICFailure(
281     IN  P_ADAPTER_T       prAdapter,
282     IN  P_STA_RECORD_T    prSta,
283     IN  BOOLEAN           fgErrorKeyType
284     );
285
286 VOID
287 rsnSelectPmkidCandidateList(
288     IN  P_ADAPTER_T       prAdapter,
289     IN  P_BSS_DESC_T      prBssDesc
290     );
291
292 VOID
293 rsnUpdatePmkidCandidateList(
294     IN  P_ADAPTER_T       prAdapter,
295     IN  P_BSS_DESC_T      prBssDesc
296     );
297
298 BOOLEAN
299 rsnSearchPmkidEntry(
300     IN  P_ADAPTER_T       prAdapter,
301     IN  PUINT_8           pucBssid,
302     OUT PUINT_32          pu4EntryIndex
303     );
304
305 BOOLEAN
306 rsnCheckPmkidCandicate(
307     IN  P_ADAPTER_T       prAdapter
308    );
309
310 VOID
311 rsnCheckPmkidCache(
312     IN  P_ADAPTER_T       prAdapter,
313     IN  P_BSS_DESC_T      prBss
314     );
315
316 VOID
317 rsnGeneratePmkidIndication(
318     IN  P_ADAPTER_T       prAdapter
319     );
320
321 VOID
322 rsnIndicatePmkidCand(
323     IN  P_ADAPTER_T       prAdapter,
324     IN  UINT_32           u4Parm
325     );
326 #if CFG_SUPPORT_WPS2
327 VOID
328 rsnGenerateWSCIE(
329     IN  P_ADAPTER_T       prAdapter,
330     IN  P_MSDU_INFO_T     prMsduInfo
331     );
332 #endif
333
334 #if CFG_SUPPORT_802_11W
335 UINT_32
336 rsnCheckBipKeyInstalled(
337     IN P_ADAPTER_T        prAdapter,
338     IN P_STA_RECORD_T     prStaRec
339     );
340
341 UINT_8
342 rsnCheckSaQueryTimeout(
343     IN P_ADAPTER_T        prAdapter
344     );
345
346 void
347 rsnStartSaQueryTimer(
348     IN  P_ADAPTER_T       prAdapter
349     );
350
351 void
352 rsnStartSaQuery(
353     IN P_ADAPTER_T        prAdapter
354     );
355
356 void
357 rsnStopSaQuery(
358     IN P_ADAPTER_T        prAdapter
359     );
360
361 void
362 rsnSaQueryRequest(
363     IN P_ADAPTER_T        prAdapter,
364     IN P_SW_RFB_T         prSwRfb
365     );
366
367 void
368 rsnSaQueryAction(
369     IN P_ADAPTER_T        prAdapter,
370     IN P_SW_RFB_T         prSwRfb
371     );
372
373 BOOLEAN
374 rsnCheckRxMgmt(
375     IN P_ADAPTER_T        prAdapter,
376     IN P_SW_RFB_T         prSwRfb,
377     IN UINT_8             ucSubtype
378     );
379 #endif
380 /*******************************************************************************
381 *                              F U N C T I O N S
382 ********************************************************************************
383 */
384
385 #endif /* _RSN_H */
386