add MTK-combo-module,continue with commit 17f39ed917874e77e80411f33faba1b7ee8138c8
[firefly-linux-kernel-4.4.55.git] / drivers / mtk_wcn_combo / drv_wlan / wlan / mgmt / wapi.c
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_2/mgmt/wapi.c#1 $
3 */
4
5 /*! \file   "wapi.c"
6     \brief  This file including the WAPI related function.
7
8     This file provided the macros and functions library support the wapi ie parsing,
9     cipher and AKM check to help the AP seleced deciding.
10 */
11
12 /*******************************************************************************
13 * Copyright (c) 2009 MediaTek Inc.
14 *
15 * All rights reserved. Copying, compilation, modification, distribution
16 * or any other use whatsoever of this material is strictly prohibited
17 * except in accordance with a Software License Agreement with
18 * MediaTek Inc.
19 ********************************************************************************
20 */
21
22 /*******************************************************************************
23 * LEGAL DISCLAIMER
24
25 * Copyright (c) 2008 MediaTek Inc.  ALL RIGHTS RESERVED.
26
27 * BY OPENING OR USING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES
28 * AND AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (¡§MEDIATEK
29 * SOFTWARE¡¨)RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
30 * PROVIDED TO BUYER ON AN ¡§AS IS¡¨ BASIS ONLY.  MEDIATEK EXPRESSLY
31 * DISCLAIMS ANY AND ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING
32 * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
33 * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. NOR DOES MEDIATEK PROVIDE
34 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTIES
35 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE.
36 * BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTIES FOR ANY AND ALL
37 * WARRANTY CLAIMS RELATING THERETO. MEDIATEK SHALL NOT BE RESPONSIBLE FOR
38 * ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER¡¦S SPECIFICATION OR CONFORMING
39 * TO A PARTICULAR STANDARD OR OPEN FORUM.
40
41 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
42 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER SHALL BE,
43 * AT MEDIATEK'S SOLE OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE
44 * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGES PAID BY BUYER TO
45 * MEDIATEK FOR SUCH MEDIATEK SOFTWARE.
46
47 * THE MEDIATEK SOFTWARE IS PROVIDED FOR AND ONLY FOR USE WITH MEDIATEK CHIPS
48 * OR PRODUCTS.  EXCEPT AS EXPRESSLY PROVIDED, NO LICENSE IS GRANTED BY
49 * IMPLICATION OR OTHERWISE UNDER ANY INTELLECTUAL PROPERTY RIGHTS, INCLUDING
50 * PATENT OR COPYRIGHTS, OF MEDIATEK.  UNAUTHORIZED USE, REPRODUCTION, OR
51 * DISCLOSURE OF THE MEDIATEK SOFTWARE IN WHOLE OR IN PART IS STRICTLY PROHIBITED.
52
53 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE WITH
54 * THE LAWS OF THE REPUBLIC OF SINGAPORE, EXCLUDING ITS CONFLICT OF LAWS
55 * PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS RELATING HERETO OR ARISING
56 * HEREFROM SHALL BE EXCLUSIVELY SETTLED VIA ARBITRATION IN SINGAPORE UNDER THE
57 * THEN CURRENT ARBITRAL RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE.
58 * THE LANGUAGE OF ARBITRATION SHALL BE ENGLISH. THE AWARDS OF THE ARBITRATION
59 * SHALL BE FINAL AND BINDING UPON BOTH PARTIES AND SHALL BE ENTERED AND
60 * ENFORCEABLE IN ANY COURT OF COMPETENT JURISDICTION.
61 ********************************************************************************
62 */
63
64 /*
65 ** $Log: wapi.c $
66  *
67  * 11 10 2011 wh.su
68  * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
69  * change the debug module level.
70  *
71  * 03 18 2011 cp.wu
72  * [WCXRP00000577] [MT6620 Wi-Fi][Driver][FW] Create V2.0 branch for firmware and driver
73  * create V2.0 driver release based on label "MT6620_WIFI_DRIVER_V2_0_110318_1600" from main trunk
74  *
75  * 10 20 2010 wh.su
76  * [WCXRP00000067] [MT6620 Wi-Fi][Driver] Support the android+ WAPI function
77  * fixed the network type
78  *
79  * 09 01 2010 wh.su
80  * NULL
81  * adding the wapi support for integration test.
82  *
83  * 07 20 2010 wh.su
84  *
85  * .
86  *
87  * 04 06 2010 wh.su
88  * [BORA00000680][MT6620] Support the statistic for Microsoft os query
89  * fixed the firmware return the broadcast frame at wrong tc.
90  *
91  * 03 03 2010 wh.su
92  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
93  * move the AIS specific variable for security to AIS specific structure.
94  *
95  * 12 18 2009 cm.chang
96  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
97  * .
98  *
99  * Dec 8 2009 mtk01088
100  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
101  * adding the function to check and update the default wapi tx
102  *
103  * Dec 7 2009 mtk01088
104  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
105  * adding the generate wapi ie function, and replace the tabe by space
106  *
107  * Nov 23 2009 mtk01088
108  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
109  *
110 */
111
112 /*******************************************************************************
113 *                         C O M P I L E R   F L A G S
114 ********************************************************************************
115 */
116
117 /*******************************************************************************
118 *                    E X T E R N A L   R E F E R E N C E S
119 ********************************************************************************
120 */
121
122 #include "precomp.h"
123 #if CFG_SUPPORT_WAPI
124
125 /*******************************************************************************
126 *                              C O N S T A N T S
127 ********************************************************************************
128 */
129
130 /*******************************************************************************
131 *                             D A T A   T Y P E S
132 ********************************************************************************
133 */
134
135 /*******************************************************************************
136 *                            P U B L I C   D A T A
137 ********************************************************************************
138 */
139
140 /*******************************************************************************
141 *                           P R I V A T E   D A T A
142 ********************************************************************************
143 */
144
145 /*******************************************************************************
146 *                                 M A C R O S
147 ********************************************************************************
148 */
149
150 /*******************************************************************************
151 *                   F U N C T I O N   D E C L A R A T I O N S
152 ********************************************************************************
153 */
154
155 /*******************************************************************************
156 *                              F U N C T I O N S
157 ********************************************************************************
158 */
159
160 /*----------------------------------------------------------------------------*/
161 /*!
162 *
163 * \brief This routine is called to generate WPA IE for
164 *        associate request frame.
165 *
166 * \param[in]  prCurrentBss     The Selected BSS description
167 *
168 * \retval The append WPA IE length
169 *
170 * \note
171 *      Called by: AIS module, Associate request
172 */
173 /*----------------------------------------------------------------------------*/
174 VOID
175 wapiGenerateWAPIIE (
176     IN P_ADAPTER_T          prAdapter,
177     IN P_MSDU_INFO_T        prMsduInfo
178     )
179 {
180     PUINT_8                 pucBuffer;
181
182     ASSERT(prAdapter);
183     ASSERT(prMsduInfo);
184
185     if (prMsduInfo->ucNetworkType != NETWORK_TYPE_AIS_INDEX)
186         return;
187
188     pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket +
189                           (UINT_32)prMsduInfo->u2FrameLength);
190
191     /* ASSOC INFO IE ID: 68 :0x44 */
192     if (/* prWlanInfo->fgWapiMode && */ prAdapter->prGlueInfo->u2WapiAssocInfoIESz) {
193         kalMemCopy(pucBuffer, &prAdapter->prGlueInfo->aucWapiAssocInfoIEs, prAdapter->prGlueInfo->u2WapiAssocInfoIESz);
194         prMsduInfo->u2FrameLength += prAdapter->prGlueInfo->u2WapiAssocInfoIESz;
195     }
196
197 }
198
199
200 /*----------------------------------------------------------------------------*/
201 /*!
202 * \brief This routine is called to parse WAPI IE.
203 *
204 * \param[in]  prInfoElem Pointer to the RSN IE
205 * \param[out] prRsnInfo Pointer to the BSSDescription structure to store the
206 **                  WAPI information from the given WAPI IE
207 *
208 * \retval TRUE - Succeeded
209 * \retval FALSE - Failed
210 */
211 /*----------------------------------------------------------------------------*/
212 BOOLEAN
213 wapiParseWapiIE (
214     IN  P_WAPI_INFO_ELEM_T prInfoElem,
215     OUT P_WAPI_INFO_T      prWapiInfo
216     )
217 {
218     UINT_32                i;
219     INT_32                 u4RemainWapiIeLen;
220     UINT_16                u2Version;
221     UINT_16                u2Cap = 0;
222     UINT_32                u4GroupSuite = WAPI_CIPHER_SUITE_WPI;
223     UINT_16                u2PairSuiteCount = 0;
224     UINT_16                u2AuthSuiteCount = 0;
225     PUCHAR                 pucPairSuite = NULL;
226     PUCHAR                 pucAuthSuite = NULL;
227     PUCHAR                 cp;
228
229     DEBUGFUNC("wapiParseWapiIE");
230
231     ASSERT(prInfoElem);
232     ASSERT(prWapiInfo);
233
234     /* Verify the length of the WAPI IE. */
235     if (prInfoElem->ucLength < 6) {
236         DBGLOG(SEC, TRACE, ("WAPI IE length too short (length=%d)\n", prInfoElem->ucLength));
237         return FALSE;
238     }
239
240     /* Check WAPI version: currently, we only support version 1. */
241     WLAN_GET_FIELD_16(&prInfoElem->u2Version, &u2Version);
242     if (u2Version != 1) {
243         DBGLOG(SEC, TRACE, ("Unsupported WAPI IE version: %d\n", u2Version));
244         return FALSE;
245     }
246
247     cp = (PUCHAR) &prInfoElem->u2AuthKeyMgtSuiteCount;
248     u4RemainWapiIeLen = (INT_32) prInfoElem->ucLength - 2;
249
250     do {
251         if (u4RemainWapiIeLen == 0) {
252             break;
253         }
254
255         /*
256            AuthCount    : 2
257            AuthSuite    : 4 * authSuiteCount
258            PairwiseCount: 2
259            PairwiseSuite: 4 * pairSuiteCount
260            GroupSuite   : 4
261            Cap          : 2 */
262
263         /* Parse the Authentication and Key Management Cipher Suite Count
264            field. */
265         if (u4RemainWapiIeLen < 2) {
266             DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in auth & key mgt suite count (IE len: %d)\n",
267                 prInfoElem->ucLength));
268             return FALSE;
269         }
270
271         WLAN_GET_FIELD_16(cp, &u2AuthSuiteCount);
272         cp += 2;
273         u4RemainWapiIeLen -= 2;
274
275         /* Parse the Authentication and Key Management Cipher Suite List
276            field. */
277         i = (UINT_32) u2AuthSuiteCount * 4;
278         if (u4RemainWapiIeLen < (INT_32) i) {
279             DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in auth & key mgt suite list (IE len: %d)\n",
280                 prInfoElem->ucLength));
281             return FALSE;
282         }
283
284         pucAuthSuite = cp;
285
286         cp += i;
287         u4RemainWapiIeLen -= (INT_32) i;
288
289         if (u4RemainWapiIeLen == 0) {
290             break;
291         }
292
293         /* Parse the Pairwise Key Cipher Suite Count field. */
294         if (u4RemainWapiIeLen < 2) {
295             DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in pairwise cipher suite count (IE len: %d)\n",
296                 prInfoElem->ucLength));
297             return FALSE;
298         }
299
300         WLAN_GET_FIELD_16(cp, &u2PairSuiteCount);
301         cp += 2;
302         u4RemainWapiIeLen -= 2;
303
304         /* Parse the Pairwise Key Cipher Suite List field. */
305         i = (UINT_32) u2PairSuiteCount * 4;
306         if (u4RemainWapiIeLen < (INT_32) i) {
307             DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in pairwise cipher suite list (IE len: %d)\n",
308                 prInfoElem->ucLength));
309             return FALSE;
310         }
311
312         pucPairSuite = cp;
313
314         cp += i;
315         u4RemainWapiIeLen -= (INT_32) i;
316
317         /* Parse the Group Key Cipher Suite field. */
318         if (u4RemainWapiIeLen < 4) {
319             DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in group cipher suite (IE len: %d)\n",
320                 prInfoElem->ucLength));
321             return FALSE;
322         }
323
324         WLAN_GET_FIELD_32(cp, &u4GroupSuite);
325         cp += 4;
326         u4RemainWapiIeLen -= 4;
327
328         /* Parse the WAPI u2Capabilities field. */
329         if (u4RemainWapiIeLen < 2) {
330             DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in WAPI capabilities (IE len: %d)\n",
331                 prInfoElem->ucLength));
332             return FALSE;
333         }
334
335         WLAN_GET_FIELD_16(cp, &u2Cap);
336         u4RemainWapiIeLen -= 2;
337
338         /* Todo:: BKID support */
339     } while (FALSE);
340
341     /* Save the WAPI information for the BSS. */
342
343     prWapiInfo->ucElemId = ELEM_ID_WAPI;
344
345     prWapiInfo->u2Version = u2Version;
346
347     prWapiInfo->u4GroupKeyCipherSuite = u4GroupSuite;
348
349     DBGLOG(SEC, LOUD, ("WAPI: version %d, group key cipher suite %02x-%02x-%02x-%02x\n",
350         u2Version, (UCHAR) (u4GroupSuite & 0x000000FF),
351         (UCHAR) ((u4GroupSuite >> 8) & 0x000000FF),
352         (UCHAR) ((u4GroupSuite >> 16) & 0x000000FF),
353         (UCHAR) ((u4GroupSuite >> 24) & 0x000000FF)));
354
355     if (pucPairSuite) {
356         /* The information about the pairwise key cipher suites is present. */
357         if (u2PairSuiteCount > MAX_NUM_SUPPORTED_CIPHER_SUITES) {
358             u2PairSuiteCount = MAX_NUM_SUPPORTED_CIPHER_SUITES;
359         }
360
361         prWapiInfo->u4PairwiseKeyCipherSuiteCount = (UINT_32) u2PairSuiteCount;
362
363         for (i = 0; i < (UINT_32) u2PairSuiteCount; i++) {
364             WLAN_GET_FIELD_32(pucPairSuite,
365                               &prWapiInfo->au4PairwiseKeyCipherSuite[i]);
366             pucPairSuite += 4;
367
368             DBGLOG(SEC, LOUD,("WAPI: pairwise key cipher suite [%d]: %02x-%02x-%02x-%02x\n",
369                 (UINT_8)i, (UCHAR) (prWapiInfo->au4PairwiseKeyCipherSuite[i] & 0x000000FF),
370                 (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[i] >> 8) & 0x000000FF),
371                 (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[i] >> 16) & 0x000000FF),
372                 (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[i] >> 24) & 0x000000FF)));
373         }
374     }
375     else {
376         /* The information about the pairwise key cipher suites is not present.
377            Use the default chipher suite for WAPI: WPI. */
378         prWapiInfo->u4PairwiseKeyCipherSuiteCount = 1;
379         prWapiInfo->au4PairwiseKeyCipherSuite[0] = WAPI_CIPHER_SUITE_WPI;
380
381         DBGLOG(SEC, LOUD, ("WAPI: pairwise key cipher suite: %02x-%02x-%02x-%02x (default)\n",
382             (UCHAR) (prWapiInfo->au4PairwiseKeyCipherSuite[0] & 0x000000FF),
383             (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[0] >> 8) & 0x000000FF),
384             (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[0] >> 16) & 0x000000FF),
385             (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[0] >> 24) & 0x000000FF)));
386     }
387
388     if (pucAuthSuite) {
389         /* The information about the authentication and key management suites
390            is present. */
391         if (u2AuthSuiteCount > MAX_NUM_SUPPORTED_AKM_SUITES) {
392             u2AuthSuiteCount = MAX_NUM_SUPPORTED_AKM_SUITES;
393         }
394
395         prWapiInfo->u4AuthKeyMgtSuiteCount = (UINT_32) u2AuthSuiteCount;
396
397         for (i = 0; i < (UINT_32) u2AuthSuiteCount; i++) {
398             WLAN_GET_FIELD_32(pucAuthSuite, &prWapiInfo->au4AuthKeyMgtSuite[i]);
399             pucAuthSuite += 4;
400
401             DBGLOG(SEC, LOUD, ("WAPI: AKM suite [%d]: %02x-%02x-%02x-%02x\n",
402                 (UINT_8)i, (UCHAR) (prWapiInfo->au4AuthKeyMgtSuite[i] & 0x000000FF),
403                 (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[i] >> 8) & 0x000000FF),
404                 (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[i] >> 16) & 0x000000FF),
405                 (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[i] >> 24) & 0x000000FF)));
406         }
407     }
408     else {
409         /* The information about the authentication and key management suites
410            is not present. Use the default AKM suite for WAPI. */
411         prWapiInfo->u4AuthKeyMgtSuiteCount = 1;
412         prWapiInfo->au4AuthKeyMgtSuite[0] = WAPI_AKM_SUITE_802_1X;
413
414         DBGLOG(SEC, LOUD, ("WAPI: AKM suite: %02x-%02x-%02x-%02x (default)\n",
415             (UCHAR) (prWapiInfo->au4AuthKeyMgtSuite[0] & 0x000000FF),
416             (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[0] >> 8) & 0x000000FF),
417             (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[0] >> 16) & 0x000000FF),
418             (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[0] >> 24) & 0x000000FF)));
419     }
420
421     prWapiInfo->u2WapiCap = u2Cap;
422     DBGLOG(SEC, LOUD, ("WAPI: cap: 0x%04x\n", prWapiInfo->u2WapiCap));
423
424     return TRUE;
425 }   /* wapiParseWapiIE */
426
427
428 /*----------------------------------------------------------------------------*/
429 /*!
430 * \brief This routine is called to perform WAPI policy selection for a given BSS.
431 *
432 * \param[in]  prAdapter Pointer to the adapter object data area.
433 * \param[in]  prBss Pointer to the BSS description
434 *
435 * \retval TRUE - The WAPI policy selection for the given BSS is
436 *                successful. The selected pairwise and group cipher suites
437 *                are returned in the BSS description.
438 * \retval FALSE - The WAPI policy selection for the given BSS is failed.
439 *                 The driver shall not attempt to join the given BSS.
440 *
441 * \note The Encrypt status matched score will save to bss for final ap select.
442 */
443 /*----------------------------------------------------------------------------*/
444 BOOLEAN
445 wapiPerformPolicySelection (
446     IN  P_ADAPTER_T         prAdapter,
447     IN  P_BSS_DESC_T        prBss
448     )
449 {
450     UINT_32                 i;
451     UINT_32                 u4PairwiseCipher = 0;
452     UINT_32                 u4GroupCipher = 0;
453     UINT_32                 u4AkmSuite = 0;
454     P_WAPI_INFO_T           prBssWapiInfo;
455     P_WLAN_INFO_T           prWlanInfo;
456
457     DEBUGFUNC("wapiPerformPolicySelection");
458
459     ASSERT(prBss);
460
461     /* Notice!!!! WAPI AP not set the privacy bit for WAI and WAI-PSK at WZC configuration mode */
462     prWlanInfo = &prAdapter->rWlanInfo;
463
464     if (prBss->fgIEWAPI) {
465         prBssWapiInfo = &prBss->rIEWAPI;
466     }
467     else {
468         if (prAdapter->rWifiVar.rConnSettings.fgWapiMode == FALSE) {
469             DBGLOG(SEC, TRACE,("-- No Protected BSS\n"));
470             return TRUE;
471         }
472         else {
473             DBGLOG(SEC, TRACE, ("WAPI Information Element does not exist.\n"));
474             return FALSE;
475         }
476     }
477
478     /* Select pairwise/group ciphers */
479     for (i = 0; i < prBssWapiInfo->u4PairwiseKeyCipherSuiteCount; i++) {
480         if (prBssWapiInfo->au4PairwiseKeyCipherSuite[i] ==
481             prAdapter->rWifiVar.rConnSettings.u4WapiSelectedPairwiseCipher) {
482                 u4PairwiseCipher = prBssWapiInfo->au4PairwiseKeyCipherSuite[i];
483         }
484     }
485     if (prBssWapiInfo->u4GroupKeyCipherSuite ==
486         prAdapter->rWifiVar.rConnSettings.u4WapiSelectedGroupCipher)
487         u4GroupCipher = prBssWapiInfo->u4GroupKeyCipherSuite;
488
489     /* Exception handler */
490     /* If we cannot find proper pairwise and group cipher suites to join the
491        BSS, do not check the supported AKM suites. */
492     if (u4PairwiseCipher == 0 || u4GroupCipher == 0) {
493         DBGLOG(SEC, TRACE, ("Failed to select pairwise/group cipher (0x%08lx/0x%08lx)\n",
494             u4PairwiseCipher, u4GroupCipher));
495         return FALSE;
496     }
497
498     /* Select AKM */
499     /* If the driver cannot support any authentication suites advertised in
500        the given BSS, we fail to perform RSNA policy selection. */
501     /* Attempt to find any overlapping supported AKM suite. */
502     for (i = 0; i < prBssWapiInfo->u4AuthKeyMgtSuiteCount; i++) {
503         if (prBssWapiInfo->au4AuthKeyMgtSuite[i] == prAdapter->rWifiVar.rConnSettings.u4WapiSelectedAKMSuite) {
504             u4AkmSuite = prBssWapiInfo->au4AuthKeyMgtSuite[i];
505             break;
506         }
507     }
508
509     if (u4AkmSuite == 0) {
510         DBGLOG(SEC, TRACE, ("Cannot support any AKM suites\n"));
511         return FALSE;
512     }
513
514     DBGLOG(SEC, TRACE, ("Selected pairwise/group cipher: %02x-%02x-%02x-%02x/%02x-%02x-%02x-%02x\n",
515         (UINT_8) (u4PairwiseCipher & 0x000000FF),
516         (UINT_8) ((u4PairwiseCipher >> 8) & 0x000000FF),
517         (UINT_8) ((u4PairwiseCipher >> 16) & 0x000000FF),
518         (UINT_8) ((u4PairwiseCipher >> 24) & 0x000000FF),
519         (UINT_8) (u4GroupCipher & 0x000000FF),
520         (UINT_8) ((u4GroupCipher >> 8) & 0x000000FF),
521         (UINT_8) ((u4GroupCipher >> 16) & 0x000000FF),
522         (UINT_8) ((u4GroupCipher >> 24) & 0x000000FF)));
523
524     DBGLOG(SEC, TRACE, ("Selected AKM suite: %02x-%02x-%02x-%02x\n",
525         (UINT_8) (u4AkmSuite & 0x000000FF),
526         (UINT_8) ((u4AkmSuite >> 8) & 0x000000FF),
527         (UINT_8) ((u4AkmSuite >> 16) & 0x000000FF),
528         (UINT_8) ((u4AkmSuite >> 24) & 0x000000FF)));
529
530     return TRUE;
531 }  /* wapiPerformPolicySelection */
532
533 #if 0
534 /*----------------------------------------------------------------------------*/
535 /*!
536 * \brief This routine is use for wapi mode, to update the current wpi tx idx ? 0 :1 .
537 *
538 * \param[in]  prStaRec Pointer to the Sta record
539 * \param[out] ucWlanIdx The Rx status->wlanidx field
540 *
541 * \retval TRUE - Succeeded
542 * \retval FALSE - Failed
543 */
544 /*----------------------------------------------------------------------------*/
545 BOOLEAN
546 wapiUpdateTxKeyIdx (
547     IN  P_STA_RECORD_T     prStaRec,
548     IN  UINT_8             ucWlanIdx
549     )
550 {
551     UINT_8 ucKeyId;
552
553     if ((ucWlanIdx & BITS(0, 3)) == CIPHER_SUITE_WPI) {
554
555         ucKeyId = ((ucWlanIdx & BITS(4, 5)) >> 4);
556
557         if (ucKeyId != g_prWifiVar->rAisSpecificBssInfo.ucWpiActivedPWKey) {
558             DBGLOG(RSN, STATE, ("Change wapi key index from %d->%d\n", g_prWifiVar->rAisSpecificBssInfo.ucWpiActivedPWKey, ucKeyId));
559             g_prWifiVar->rAisSpecificBssInfo.ucWpiActivedPWKey = ucKeyId;
560
561             prStaRec->ucWTEntry =
562                 (ucKeyId == WTBL_AIS_BSSID_WAPI_IDX_0) ? WTBL_AIS_BSSID_WAPI_IDX_0 : WTBL_AIS_BSSID_WAPI_IDX_1;
563         }
564     }
565 }
566 #endif
567 #endif
568