1 /*
2 * admCtrlNone.c
3 *
4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name Texas Instruments nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 /** \file admCtrl.c
35 * \brief Admission control API implimentation
36 *
37 * \see admCtrl.h
38 */
39
40 /****************************************************************************
41 * *
42 * MODULE: Admission Control *
43 * PURPOSE: Admission Control Module API *
44 * *
45 ****************************************************************************/
46
47 #define __FILE_ID__ FILE_ID_17
48 #include "osApi.h"
49 #include "paramOut.h"
50 #include "fsm.h"
51 #include "report.h"
52 #include "mlmeApi.h"
53 #include "DataCtrl_Api.h"
54 #include "rsn.h"
55 #include "admCtrl.h"
56 #include "admCtrlNone.h"
57 #ifdef XCC_MODULE_INCLUDED
58 #include "XCCMngr.h"
59 #include "admCtrlWpa.h"
60 #include "admCtrlXCC.h"
61 #endif
62 #include "TWDriver.h"
63
64
65 /* Constants */
66
67 /* Enumerations */
68
69 /* Typedefs */
70
71 /* Structures */
72
73 /* External data definitions */
74
75 /* Local functions definitions */
76
77 /* Global variables */
78
79 /* Function prototypes */
80
81 /**
82 *
83 * admCtrlNone_config - Configure empty admission control.
84 *
85 * \b Description:
86 *
87 * Configure empty admission control.
88 *
89 * \b ARGS:
90 *
91 * I - pAdmCtrl - context \n
92 *
93 * \b RETURNS:
94 *
95 * TI_OK on success, TI_NOK on failure.
96 *
97 * \sa
98 */
admCtrlNone_config(admCtrl_t * pAdmCtrl)99 TI_STATUS admCtrlNone_config(admCtrl_t *pAdmCtrl)
100 {
101 TI_STATUS status;
102 TRsnPaeConfig paeConfig;
103
104 #ifdef XCC_MODULE_INCLUDED
105 TTwdParamInfo tTwdParam;
106 #endif
107
108 if ((pAdmCtrl->authSuite != RSN_AUTH_OPEN ) &&
109 (pAdmCtrl->authSuite != RSN_AUTH_SHARED_KEY) &&
110 (pAdmCtrl->authSuite != RSN_AUTH_AUTO_SWITCH)) {
111 /* The default is OPEN */
112 pAdmCtrl->authSuite = RSN_AUTH_OPEN;
113 }
114
115 /* set admission control parameters */
116 pAdmCtrl->keyMngSuite = RSN_KEY_MNG_NONE;
117 pAdmCtrl->externalAuthMode = (EExternalAuthMode)pAdmCtrl->authSuite;
118
119 /* set callback functions (API) */
120 pAdmCtrl->getInfoElement = admCtrlNone_getInfoElement;
121 pAdmCtrl->setSite = admCtrlNone_setSite;
122 pAdmCtrl->evalSite = admCtrlNone_evalSite;
123
124 pAdmCtrl->getPmkidList = admCtrl_nullGetPMKIDlist;
125 pAdmCtrl->setPmkidList = admCtrl_nullSetPMKIDlist;
126 pAdmCtrl->resetPmkidList = admCtrl_resetPMKIDlist;
127 pAdmCtrl->getPreAuthStatus = admCtrl_nullGetPreAuthStatus;
128 pAdmCtrl->startPreAuth = admCtrl_nullStartPreAuth;
129 pAdmCtrl->get802_1x_AkmExists = admCtrl_nullGet802_1x_AkmExists;
130
131
132
133 /* set cipher suite */
134 pAdmCtrl->broadcastSuite = TWD_CIPHER_NONE;
135 pAdmCtrl->unicastSuite = TWD_CIPHER_NONE;
136
137
138 /* set PAE parametrs */
139 paeConfig.authProtocol = pAdmCtrl->externalAuthMode;
140 paeConfig.unicastSuite = pAdmCtrl->unicastSuite;
141 paeConfig.broadcastSuite = pAdmCtrl->broadcastSuite;
142 paeConfig.keyExchangeProtocol = pAdmCtrl->keyMngSuite;
143 /* set default PAE configuration */
144 status = pAdmCtrl->pRsn->setPaeConfig(pAdmCtrl->pRsn, &paeConfig);
145
146 #ifdef XCC_MODULE_INCLUDED
147 /* Clean MIC and KP in HAL and re-send WEP-keys */
148 tTwdParam.paramType = TWD_RSN_XCC_SW_ENC_ENABLE_PARAM_ID;
149 tTwdParam.content.rsnXCCSwEncFlag = TI_FALSE;
150 status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam);
151
152 tTwdParam.paramType = TWD_RSN_XCC_MIC_FIELD_ENABLE_PARAM_ID;
153 tTwdParam.content.rsnXCCMicFieldFlag = TI_FALSE;
154 status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam);
155 #endif /*XCC_MODULE_INCLUDED*/
156
157 return status;
158 }
159
160
161 /**
162 *
163 * admCtrlNone_getInfoElement - Get the current information element.
164 *
165 * \b Description:
166 *
167 * Get the current information element.
168 *
169 * \b ARGS:
170 *
171 * I - pAdmCtrl - context \n
172 * I - pIe - IE buffer \n
173 * I - pLength - length of IE \n
174 *
175 * \b RETURNS:
176 *
177 * TI_OK on success, TI_NOK on failure.
178 *
179 * \sa
180 */
admCtrlNone_getInfoElement(admCtrl_t * pAdmCtrl,TI_UINT8 * pIe,TI_UINT32 * pLength)181 TI_STATUS admCtrlNone_getInfoElement(admCtrl_t *pAdmCtrl, TI_UINT8 *pIe, TI_UINT32 *pLength)
182 {
183 *pLength = 0;
184 pIe = NULL;
185
186 TI_VOIDCAST(pIe);
187 return TI_OK;
188 }
189 /**
190 *
191 * admCtrlNone_setSite - Set current primary site parameters for registration.
192 *
193 * \b Description:
194 *
195 * Set current primary site parameters for registration.
196 *
197 * \b ARGS:
198 *
199 * I - pAdmCtrl - context \n
200 * I - pRsnData - site's RSN data \n
201 * O - pAssocIe - result IE of evaluation \n
202 * O - pAssocIeLen - length of result IE of evaluation \n
203 *
204 * \b RETURNS:
205 *
206 * TI_OK on site is aproved, TI_NOK on site is rejected.
207 *
208 * \sa
209 */
admCtrlNone_setSite(admCtrl_t * pAdmCtrl,TRsnData * pRsnData,TI_UINT8 * pAssocIe,TI_UINT8 * pAssocIeLen)210 TI_STATUS admCtrlNone_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 *pAssocIe, TI_UINT8 *pAssocIeLen)
211 {
212 TI_STATUS status;
213 paramInfo_t param;
214 TTwdParamInfo tTwdParam;
215 EAuthSuite authSuite;
216
217 admCtrlNone_config(pAdmCtrl);
218
219 authSuite = pAdmCtrl->authSuite;
220
221 /* Config the default keys */
222 if ((authSuite == RSN_AUTH_SHARED_KEY) || (authSuite == RSN_AUTH_AUTO_SWITCH))
223 { /* Configure Security status in HAL */
224 tTwdParam.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID;
225 tTwdParam.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP;
226 status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam);
227 /* Configure the keys in HAL */
228 rsn_setDefaultKeys(pAdmCtrl->pRsn);
229 }
230
231 #ifdef XCC_MODULE_INCLUDED
232 admCtrlXCC_setExtendedParams(pAdmCtrl, pRsnData);
233 #endif
234
235 /* Now we configure the MLME module with the 802.11 legacy authentication suite,
236 THe MLME will configure later the authentication module */
237 param.paramType = MLME_LEGACY_TYPE_PARAM;
238 switch (authSuite)
239 {
240 case RSN_AUTH_OPEN:
241 param.content.mlmeLegacyAuthType = AUTH_LEGACY_OPEN_SYSTEM;
242 break;
243
244 case RSN_AUTH_SHARED_KEY:
245 param.content.mlmeLegacyAuthType = AUTH_LEGACY_SHARED_KEY;
246 break;
247
248 case RSN_AUTH_AUTO_SWITCH:
249 param.content.mlmeLegacyAuthType = AUTH_LEGACY_AUTO_SWITCH;
250 break;
251
252 default:
253 return TI_NOK;
254 }
255
256 status = mlme_setParam(pAdmCtrl->hMlme, ¶m);
257 if (status != TI_OK)
258 {
259 return status;
260 }
261
262 param.paramType = RX_DATA_EAPOL_DESTINATION_PARAM;
263 param.content.rxDataEapolDestination = OS_ABS_LAYER;
264 status = rxData_setParam(pAdmCtrl->hRx, ¶m);
265 if (status != TI_OK)
266 {
267 return status;
268 }
269
270 /* Configure privacy status in HAL */
271 if (authSuite == RSN_AUTH_OPEN)
272 {
273 tTwdParam.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID;
274 tTwdParam.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_NONE;
275 status = TWD_SetParam(pAdmCtrl->pRsn->hTWD, &tTwdParam);
276 }
277
278 return status;
279 }
280
281 /**
282 *
283 * admCtrlNone_evalSite - Evaluate site for registration.
284 *
285 * \b Description:
286 *
287 * evaluate site RSN capabilities against the station's cap.
288 * If the BSS type is infrastructure, the station matches the site only if it's WEP status is same as the site
289 * In IBSS, it does not matter
290 *
291 * \b ARGS:
292 *
293 * I - pAdmCtrl - Context \n
294 * I - pRsnData - site's RSN data \n
295 * O - pEvaluation - Result of evaluation \n
296 *
297 * \b RETURNS:
298 *
299 * TI_OK
300 *
301 * \sa
302 */
admCtrlNone_evalSite(admCtrl_t * pAdmCtrl,TRsnData * pRsnData,TRsnSiteParams * pRsnSiteParams,TI_UINT32 * pEvaluation)303 TI_STATUS admCtrlNone_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteParams *pRsnSiteParams, TI_UINT32 *pEvaluation)
304 {
305 if ((pAdmCtrl==NULL) || (pEvaluation==NULL)){
306 return TI_NOK;
307 }
308 *pEvaluation = 1;
309
310 /* Check privacy bit if not in mixed mode */
311 if (!pAdmCtrl->mixedMode)
312 { /* There's no mixed mode, so make sure that the privacy Bit is off*/
313 if (pRsnData->privacy)
314 {
315 *pEvaluation = 0;
316 return TI_NOK;
317 }
318 }
319
320 TRACE1(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "admCtrlNone_evalSite: pEvaluation=%d\n\n", *pEvaluation);
321
322 return TI_OK;
323
324 }
325
326
327