blob: aa86ac9f076978b03975a1dd1aaeb97cfa11dbbe [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +05302 * Copyright (c) 2011-2015, 2018 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limSmeReqUtils.cc contains the utility functions
31 * for processing SME request messages.
32 * Author: Chandra Modumudi
33 * Date: 02/11/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 * 05/26/10 js WPA handling in (Re)Assoc frames
Jeff Johnson3c3e1782013-02-27 10:48:42 -080038 *
Jeff Johnson295189b2012-06-20 16:38:30 -070039 */
40
41#include "wniApi.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053042#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070043#include "cfgApi.h"
44#include "sirApi.h"
45#include "schApi.h"
46#include "utilsApi.h"
47#include "limTypes.h"
48#include "limUtils.h"
49#include "limAssocUtils.h"
50#include "limSecurityUtils.h"
51#include "limSerDesUtils.h"
52
53
54
55/**
56 * limIsRSNieValidInSmeReqMessage()
57 *
58 *FUNCTION:
59 * This function is called to verify if the RSN IE
60 * received in various SME_REQ messages is valid or not
61 *
62 *LOGIC:
63 * RSN IE validity checks are performed in this function
64 *
65 *ASSUMPTIONS:
66 *
67 *NOTE:
68 *
69 * @param pMac Pointer to Global MAC structure
70 * @param pRSNie Pointer to received RSN IE
71 * @return true when RSN IE is valid, false otherwise
72 */
73
74static tANI_U8
75limIsRSNieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirRSNie pRSNie)
76{
77 tANI_U8 startPos = 0;
78 tANI_U32 privacy, val;
79 int len;
80
81 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
82 &privacy) != eSIR_SUCCESS)
83 {
84 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070085 FL("Unable to retrieve POI from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -070086 }
87
88 if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED,
89 &val) != eSIR_SUCCESS)
90 {
91 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070092 FL("Unable to retrieve RSN_ENABLED from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -070093 }
94
95 if (pRSNie->length && (!privacy || !val))
96 {
97 // Privacy & RSN not enabled in CFG.
98 /**
99 * In order to allow mixed mode for Guest access
100 * allow BSS creation/join with no Privacy capability
101 * yet advertising WPA IE
102 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700103 PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 pRSNie->length, privacy, val);)
105 }
106
107 if (pRSNie->length)
108 {
109 if ((pRSNie->rsnIEdata[0] != DOT11F_EID_RSN) &&
110 (pRSNie->rsnIEdata[0] != DOT11F_EID_WPA)
111#ifdef FEATURE_WLAN_WAPI
112 && (pRSNie->rsnIEdata[0] != DOT11F_EID_WAPI)
113#endif
114 )
115 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700116 limLog(pMac, LOGE, FL("RSN/WPA/WAPI EID %d not [%d || %d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 pRSNie->rsnIEdata[0], DOT11F_EID_RSN,
118 DOT11F_EID_WPA);
119 return false;
120 }
121
122 len = pRSNie->length;
123 startPos = 0;
124 while(len > 0)
125 {
126 // Check validity of RSN IE
127 if (pRSNie->rsnIEdata[startPos] == DOT11F_EID_RSN)
128 {
129 if((pRSNie->rsnIEdata[startPos+1] > DOT11F_IE_RSN_MAX_LEN) ||
130 (pRSNie->rsnIEdata[startPos+1] < DOT11F_IE_RSN_MIN_LEN))
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700131 {
132 limLog(pMac, LOGE, FL("RSN IE len %d not [%d,%d]"),
133 pRSNie->rsnIEdata[startPos+1], DOT11F_IE_RSN_MIN_LEN,
134 DOT11F_IE_RSN_MAX_LEN);
135 return false;
136 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 }
138 else if(pRSNie->rsnIEdata[startPos] == DOT11F_EID_WPA)
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700140 // Check validity of WPA IE
141 if (SIR_MAC_MAX_IE_LENGTH > startPos)
142 {
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -0700143 if (startPos <= (SIR_MAC_MAX_IE_LENGTH - sizeof(tANI_U32)))
144 val = sirReadU32((tANI_U8 *) &pRSNie->rsnIEdata[startPos + 2]);
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700145 if((pRSNie->rsnIEdata[startPos + 1] < DOT11F_IE_WPA_MIN_LEN) ||
146 (pRSNie->rsnIEdata[startPos + 1] > DOT11F_IE_WPA_MAX_LEN) ||
147 (SIR_MAC_WPA_OUI != val))
148 {
149 limLog(pMac, LOGE,
150 FL("WPA IE len %d not [%d,%d] OR data 0x%x not 0x%x"),
151 pRSNie->rsnIEdata[startPos+1], DOT11F_IE_WPA_MIN_LEN,
152 DOT11F_IE_WPA_MAX_LEN, val, SIR_MAC_WPA_OUI);
Jeff Johnson295189b2012-06-20 16:38:30 -0700153
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700154 return false;
155 }
156 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700157 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700158#ifdef FEATURE_WLAN_WAPI
159 else if(pRSNie->rsnIEdata[startPos] == DOT11F_EID_WAPI)
160 {
161 if((pRSNie->rsnIEdata[startPos+1] > DOT11F_IE_WAPI_MAX_LEN) ||
162 (pRSNie->rsnIEdata[startPos+1] < DOT11F_IE_WAPI_MIN_LEN))
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700163 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700165 FL("WAPI IE len %d not [%d,%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 pRSNie->rsnIEdata[startPos+1], DOT11F_IE_WAPI_MIN_LEN,
167 DOT11F_IE_WAPI_MAX_LEN);
168
169 return false;
170 }
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700171 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700172#endif
173 else
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700174 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700175 //we will never be here, simply for completeness
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700176 return false;
177 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 startPos += 2 + pRSNie->rsnIEdata[startPos+1]; //EID + length field + length
179 len -= startPos;
180 }//while
181
182 }
183
184 return true;
185} /*** end limIsRSNieValidInSmeReqMessage() ***/
186
187/**
188 * limIsAddieValidInSmeReqMessage()
189 *
190 *FUNCTION:
191 * This function is called to verify if the Add IE
192 * received in various SME_REQ messages is valid or not
193 *
194 *LOGIC:
195 * Add IE validity checks are performed on only length
196 *
197 *ASSUMPTIONS:
198 *
199 *NOTE:
200 *
201 * @param pMac Pointer to Global MAC structure
202 * @param pWSCie Pointer to received WSC IE
203 * @return true when WSC IE is valid, false otherwise
204 */
205
206static tANI_U8
207limIsAddieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirAddie pAddie)
208{
209 int left = pAddie->length;
210 tANI_U8 *ptr = pAddie->addIEdata;
211 tANI_U8 elem_id, elem_len;
212
213 if (left == 0)
214 return true;
215
216 while(left >= 2)
217 {
218 elem_id = ptr[0];
219 elem_len = ptr[1];
220 left -= 2;
221 if(elem_len > left)
222 {
223 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700224 FL("****Invalid Add IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 elem_id,elem_len,left);
226 return false;
227 }
228
229 left -= elem_len;
230 ptr += (elem_len + 2);
231 }
232 // there shouldn't be any left byte
233
234
235 return true;
236} /*** end limIsAddieValidInSmeReqMessage() ***/
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238/**
239 * limSetRSNieWPAiefromSmeStartBSSReqMessage()
240 *
241 *FUNCTION:
242 * This function is called to verify if the RSN IE
243 * received in various SME_REQ messages is valid or not
244 *
245 *LOGIC:
246 * RSN IE validity checks are performed in this function
247 *
248 *ASSUMPTIONS:
249 *
250 *NOTE:
251 *
252 * @param pMac Pointer to Global MAC structure
253 * @param pRSNie Pointer to received RSN IE
254 * @return true when RSN IE is valid, false otherwise
255 */
256
257tANI_U8
258limSetRSNieWPAiefromSmeStartBSSReqMessage(tpAniSirGlobal pMac,
259 tpSirRSNie pRSNie,
260 tpPESession pSessionEntry)
261{
262 tANI_U8 wpaIndex = 0;
263 tANI_U32 privacy, val;
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530264 tANI_U32 status;
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
266 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
267 &privacy) != eSIR_SUCCESS)
268 {
269 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 FL("Unable to retrieve POI from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 }
272
273 if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED,
274 &val) != eSIR_SUCCESS)
275 {
276 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700277 FL("Unable to retrieve RSN_ENABLED from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 }
279
280 if (pRSNie->length && (!privacy || !val))
281 {
282 // Privacy & RSN not enabled in CFG.
283 /**
284 * In order to allow mixed mode for Guest access
285 * allow BSS creation/join with no Privacy capability
286 * yet advertising WPA IE
287 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 pRSNie->length, privacy, val);)
290 }
291
292 if (pRSNie->length)
293 {
294 if ((pRSNie->rsnIEdata[0] != SIR_MAC_RSN_EID) &&
295 (pRSNie->rsnIEdata[0] != SIR_MAC_WPA_EID))
296 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700297 limLog(pMac, LOGE, FL("RSN/WPA EID %d not [%d || %d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 pRSNie->rsnIEdata[0], SIR_MAC_RSN_EID,
299 SIR_MAC_WPA_EID);
300 return false;
301 }
302
303 // Check validity of RSN IE
304 if ((pRSNie->rsnIEdata[0] == SIR_MAC_RSN_EID) &&
305#if 0 // Comparison always false
306 (pRSNie->rsnIEdata[1] > SIR_MAC_RSN_IE_MAX_LENGTH) ||
307#endif
308 (pRSNie->rsnIEdata[1] < SIR_MAC_RSN_IE_MIN_LENGTH))
309 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 limLog(pMac, LOGE, FL("RSN IE len %d not [%d,%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 pRSNie->rsnIEdata[1], SIR_MAC_RSN_IE_MIN_LENGTH,
312 SIR_MAC_RSN_IE_MAX_LENGTH);
313 return false;
314 }
315
316 if (pRSNie->length > pRSNie->rsnIEdata[1] + 2)
317 {
318 if (pRSNie->rsnIEdata[0] != SIR_MAC_RSN_EID)
319 {
320 limLog(pMac,
321 LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 FL("First byte[%d] in rsnIEdata is not RSN_EID"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 pRSNie->rsnIEdata[1]);
324 return false;
325 }
326
327 limLog(pMac,
328 LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 FL("WPA IE is present along with WPA2 IE"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 wpaIndex = 2 + pRSNie->rsnIEdata[1];
331 }
332 else if ((pRSNie->length == pRSNie->rsnIEdata[1] + 2) &&
333 (pRSNie->rsnIEdata[0] == SIR_MAC_RSN_EID))
334 {
335 limLog(pMac,
336 LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 FL("Only RSN IE is present"));
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530338 status = dot11fUnpackIeRSN(pMac,&pRSNie->rsnIEdata[2],
Abhinav Kumare58f3bc2018-04-03 12:59:05 +0530339 pRSNie->rsnIEdata[1],
340 &pSessionEntry->gStartBssRSNIe);
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530341 if (DOT11F_FAILED(status))
342 {
343 limLog(pMac,
344 LOGE,FL("unpack failed for RSN IE (0x%08x)"),
345 status);
346 return false;
347 }
348 return true;
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 }
350 else if ((pRSNie->length == pRSNie->rsnIEdata[1] + 2) &&
351 (pRSNie->rsnIEdata[0] == SIR_MAC_WPA_EID))
352 {
353 limLog(pMac,
354 LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 FL("Only WPA IE is present"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530357 status = dot11fUnpackIeWPA(pMac,&pRSNie->rsnIEdata[6],
Abhinav Kumare58f3bc2018-04-03 12:59:05 +0530358 pRSNie->rsnIEdata[1] - 4,
359 &pSessionEntry->gStartBssWPAIe);
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530360 if (DOT11F_FAILED(status))
361 {
362 limLog(pMac,
363 LOGE,FL("unpack failed for WPA IE (0x%08x)"),
364 status);
365 return false;
366 }
367 return true;
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 }
369
370 // Check validity of WPA IE
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530371 if(wpaIndex +4 < SIR_MAC_MAX_IE_LENGTH )
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 {
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530373 val = sirReadU32((tANI_U8 *) &pRSNie->rsnIEdata[wpaIndex + 2]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700374
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530375 if ((pRSNie->rsnIEdata[wpaIndex] == SIR_MAC_WPA_EID) &&
376#if 0 // Comparison always false
377 (pRSNie->rsnIEdata[wpaIndex + 1] > SIR_MAC_WPA_IE_MAX_LENGTH) ||
378#endif
379 ((pRSNie->rsnIEdata[wpaIndex + 1] < SIR_MAC_WPA_IE_MIN_LENGTH) ||
380 (SIR_MAC_WPA_OUI != val)))
381 {
382 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 FL("WPA IE len %d not [%d,%d] OR data 0x%x not 0x%x"),
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530384 pRSNie->rsnIEdata[1], SIR_MAC_RSN_IE_MIN_LENGTH,
385 SIR_MAC_RSN_IE_MAX_LENGTH, val, SIR_MAC_WPA_OUI);
386
387 return false;
388 }
389 else
390 {
391 /* Both RSN and WPA IEs are present */
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530392 status = dot11fUnpackIeRSN(pMac,&pRSNie->rsnIEdata[2],
393 pRSNie->rsnIEdata[1], &pSessionEntry->gStartBssRSNIe);
394 if (DOT11F_FAILED(status))
395 {
396 limLog(pMac,LOGE,FL("unpack failed for RSN IE status:(0x%08x)"),
397 status);
398 return false;
399 }
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530400
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530401 status = dot11fUnpackIeWPA(pMac,&pRSNie->rsnIEdata[wpaIndex + 6],
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530402 pRSNie->rsnIEdata[wpaIndex + 1]-4,
403 &pSessionEntry->gStartBssWPAIe);
Pragaspathi Thilagarajb2041e82018-03-28 17:14:02 +0530404 if (DOT11F_FAILED(status))
405 {
406 limLog(pMac, LOGE,FL("unpack failed for WPA IE status:(0x%08x)"),
407 status);
408 return false;
409 }
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530410
411 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 }
413 else
414 {
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530415 return false;
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 }
417 }
418
419 return true;
420} /*** end limSetRSNieWPAiefromSmeStartBSSReqMessage() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700421
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
423
424
425/**
426 * limIsBssDescrValidInSmeReqMessage()
427 *
428 *FUNCTION:
429 * This function is called to verify if the BSS Descr
430 * received in various SME_REQ messages is valid or not
431 *
432 *LOGIC:
433 * BSS Descritipion validity checks are performed in this function
434 *
435 *ASSUMPTIONS:
436 *
437 *NOTE:
438 *
439 * @param pMac Pointer to Global MAC structure
440 * @param pBssDescr Pointer to received Bss Descritipion
441 * @return true when BSS description is valid, false otherwise
442 */
443
444static tANI_U8
445limIsBssDescrValidInSmeReqMessage(tpAniSirGlobal pMac,
446 tpSirBssDescription pBssDescr)
447{
448 tANI_U8 valid = true;
449
450 if (limIsAddrBC(pBssDescr->bssId) ||
451 !pBssDescr->channelId)
452 {
453 valid = false;
454 goto end;
455 }
456
457end:
458 return valid;
459} /*** end limIsBssDescrValidInSmeReqMessage() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700460
461
462
463/**
464 * limIsSmeStartReqValid()
465 *
466 *FUNCTION:
467 * This function is called by limProcessSmeReqMessages() upon
468 * receiving SME_START_REQ message from application.
469 *
470 *LOGIC:
471 * Message validity checks are performed in this function
472 *
473 *ASSUMPTIONS:
474 *
475 *NOTE:
476 *
477 * @param pMsg - Pointer to received SME_START_BSS_REQ message
478 * @return true when received SME_START_REQ is formatted correctly
479 * false otherwise
480 */
481
482tANI_U8
483limIsSmeStartReqValid(tpAniSirGlobal pMac, tANI_U32 *pMsg)
484{
485 tANI_U8 valid = true;
486
487 if (((tpSirSmeStartReq) pMsg)->length != sizeof(tSirSmeStartReq))
488 {
489 /**
490 * Invalid length in START_REQ message
491 * Log error.
492 */
493 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 FL("Invalid length %d in eWNI_SME_START_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 ((tpSirSmeStartReq) pMsg)->length);
496
497 valid = false;
498 goto end;
499 }
500
501end:
502 return valid;
503} /*** end limIsSmeStartReqValid() ***/
504
505
506
507/**
508 * limIsSmeStartBssReqValid()
509 *
510 *FUNCTION:
511 * This function is called by limProcessSmeReqMessages() upon
512 * receiving SME_START_BSS_REQ message from application.
513 *
514 *LOGIC:
515 * Message validity checks are performed in this function
516 *
517 *ASSUMPTIONS:
518 *
519 *NOTE:
520 *
521 * @param pMac Pointer to Global MAC structure
522 * @param pStartBssReq Pointer to received SME_START_BSS_REQ message
523 * @return true when received SME_START_BSS_REQ is formatted correctly
524 * false otherwise
525 */
526
527tANI_U8
528limIsSmeStartBssReqValid(tpAniSirGlobal pMac,
529 tpSirSmeStartBssReq pStartBssReq)
530{
531 tANI_U8 i = 0;
532 tANI_U8 valid = true;
533
534 PELOG1(limLog(pMac, LOG1,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +0530535 FL("Parsed START_BSS_REQ fields are bssType=%s (%d), channelId=%d,"
536 " SSID len=%d, rsnIE len=%d, nwType=%d, rateset len=%d"),
537 lim_BssTypetoString(pStartBssReq->bssType),
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 pStartBssReq->bssType,
539 pStartBssReq->channelId,
540 pStartBssReq->ssId.length,
541 pStartBssReq->rsnIE.length,
542 pStartBssReq->nwType,
543 pStartBssReq->operationalRateSet.numRates);)
544
545 switch (pStartBssReq->bssType)
546 {
547 case eSIR_INFRASTRUCTURE_MODE:
Jeff Johnson62c27982013-02-27 17:53:55 -0800548 /**
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 * Should not have received start BSS req with bssType
550 * Infrastructure on STA.
551 * Log error.
552 */
Jeff Johnson62c27982013-02-27 17:53:55 -0800553 limLog(pMac, LOGE,
554 FL("Invalid bssType %d in eWNI_SME_START_BSS_REQ"),
555 pStartBssReq->bssType);
556 valid = false;
557 goto end;
558 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700559
560 case eSIR_IBSS_MODE:
561 break;
562
563 /* Added for BT AMP support */
564 case eSIR_BTAMP_STA_MODE:
565 break;
566
567 /* Added for BT AMP support */
568 case eSIR_BTAMP_AP_MODE:
569 break;
570
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 /* Added for SoftAP support */
572 case eSIR_INFRA_AP_MODE:
573 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700574
575 default:
576 /**
577 * Should not have received start BSS req with bssType
578 * other than Infrastructure/IBSS.
579 * Log error
580 */
581 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 FL("Invalid bssType %d in eWNI_SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 pStartBssReq->bssType);
584
585 valid = false;
586 goto end;
587 }
588
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 /* This below code is client specific code. TODO */
590 if (pStartBssReq->bssType == eSIR_IBSS_MODE)
591 {
592 if (!pStartBssReq->ssId.length ||
593 (pStartBssReq->ssId.length > SIR_MAC_MAX_SSID_LENGTH))
594 {
595 // Invalid length for SSID.
596 // Reject START_BSS_REQ
597 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700598 FL("Invalid SSID length in eWNI_SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700599
600 valid = false;
601 goto end;
602 }
603 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700604
Jeff Johnson295189b2012-06-20 16:38:30 -0700605
606 if (!limIsRSNieValidInSmeReqMessage(pMac, &pStartBssReq->rsnIE))
607 {
608 valid = false;
609 goto end;
610 }
611
612 if (pStartBssReq->nwType != eSIR_11A_NW_TYPE &&
613 pStartBssReq->nwType != eSIR_11B_NW_TYPE &&
614 pStartBssReq->nwType != eSIR_11G_NW_TYPE)
615 {
616 valid = false;
617 goto end;
618 }
619
620 if (pStartBssReq->nwType == eSIR_11A_NW_TYPE)
621 {
622 for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
623 if (!sirIsArate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
624 {
625 // Invalid Operational rates
626 // Reject START_BSS_REQ
627 limLog(pMac, LOGW,
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700628 FL("Invalid operational rates in eWNI_SME_START_BSS_REQ"));
Mohit Khanna23863762012-09-11 17:40:09 -0700629 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 pStartBssReq->operationalRateSet.rate,
631 pStartBssReq->operationalRateSet.numRates);
632
633 valid = false;
634 goto end;
635 }
636 }
637 // check if all the rates in the operatioal rate set are legal 11G rates
638 else if (pStartBssReq->nwType == eSIR_11G_NW_TYPE)
639 {
640 for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
641 if (!sirIsGrate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
642 {
643 // Invalid Operational rates
644 // Reject START_BSS_REQ
645 limLog(pMac, LOGW,
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700646 FL("Invalid operational rates in eWNI_SME_START_BSS_REQ"));
Mohit Khanna23863762012-09-11 17:40:09 -0700647 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 pStartBssReq->operationalRateSet.rate,
649 pStartBssReq->operationalRateSet.numRates);
650
651 valid = false;
652 goto end;
653 }
654 }
Jeff Johnson62c27982013-02-27 17:53:55 -0800655 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 {
657 for (i = 0; i < pStartBssReq->operationalRateSet.numRates; i++)
658 if (!sirIsBrate(pStartBssReq->operationalRateSet.rate[i] & 0x7F))
659 {
660 // Invalid Operational rates
661 // Reject START_BSS_REQ
662 limLog(pMac, LOGW,
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -0700663 FL("Invalid operational rates in eWNI_SME_START_BSS_REQ"));
Mohit Khanna23863762012-09-11 17:40:09 -0700664 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 pStartBssReq->operationalRateSet.rate,
666 pStartBssReq->operationalRateSet.numRates);
667
668 valid = false;
669 goto end;
670 }
671 }
672
673end:
674 return valid;
675} /*** end limIsSmeStartBssReqValid() ***/
676
677
678
679/**
680 * limIsSmeJoinReqValid()
681 *
682 *FUNCTION:
683 * This function is called by limProcessSmeReqMessages() upon
684 * receiving SME_JOIN_REQ message from application.
685 *
686 *LOGIC:
687 * Message validity checks are performed in this function
688 *
689 *ASSUMPTIONS:
690 *
691 *NOTE:
692 *
693 * @param pMac Pointer to Global MAC structure
694 * @param pJoinReq Pointer to received SME_JOIN_REQ message
695 * @return true when received SME_JOIN_REQ is formatted correctly
696 * false otherwise
697 */
698
699tANI_U8
700limIsSmeJoinReqValid(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq)
701{
702 tANI_U8 valid = true;
703
Jeff Johnson295189b2012-06-20 16:38:30 -0700704
Pragaspathi Thilagaraj03e2ab12018-06-22 12:19:48 +0530705 //If force_rsne_override is enabled that mean User has provided the
706 //test RSNIE which need to be send as it is in assoc req and thus RSNIE
707 //validity is not required.
708 if (!pJoinReq->force_rsne_override &&
709 !limIsRSNieValidInSmeReqMessage(pMac, &pJoinReq->rsnIE))
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 {
711 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700712 FL("received SME_JOIN_REQ with invalid RSNIE"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 valid = false;
714 goto end;
715 }
716
717 if (!limIsAddieValidInSmeReqMessage(pMac, &pJoinReq->addIEScan))
718 {
719 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 FL("received SME_JOIN_REQ with invalid additional IE for scan"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 valid = false;
722 goto end;
723 }
724
725 if (!limIsAddieValidInSmeReqMessage(pMac, &pJoinReq->addIEAssoc))
726 {
727 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 FL("received SME_JOIN_REQ with invalid additional IE for assoc"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 valid = false;
730 goto end;
731 }
732
733
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 if (!limIsBssDescrValidInSmeReqMessage(pMac,
735 &pJoinReq->bssDescription))
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 {
737 /// Received eWNI_SME_JOIN_REQ with invalid BSS Info
738 // Log the event
739 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 FL("received SME_JOIN_REQ with invalid bssInfo"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700741
742 valid = false;
743 goto end;
744 }
745
Jeff Johnsone7245742012-09-05 17:12:55 -0700746 /*
747 Reject Join Req if the Self Mac Address and
748 the Ap's Mac Address is same
749 */
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530750 if ( vos_mem_compare( (tANI_U8* ) pJoinReq->selfMacAddr,
Jeff Johnsone7245742012-09-05 17:12:55 -0700751 (tANI_U8 *) pJoinReq->bssDescription.bssId,
752 (tANI_U8) (sizeof(tSirMacAddr))))
753 {
754 // Log the event
755 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 FL("received SME_JOIN_REQ with Self Mac and BSSID Same"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700757
758 valid = false;
759 goto end;
760 }
761
Jeff Johnson295189b2012-06-20 16:38:30 -0700762end:
763 return valid;
764} /*** end limIsSmeJoinReqValid() ***/
765
766
767
768/**
769 * limIsSmeDisassocReqValid()
770 *
771 *FUNCTION:
772 * This function is called by limProcessSmeReqMessages() upon
773 * receiving SME_DISASSOC_REQ message from application.
774 *
775 *LOGIC:
776 * Message validity checks are performed in this function
777 *
778 *ASSUMPTIONS:
779 *
780 *NOTE:
781 *
782 * @param pMac Pointer to Global MAC structure
783 * @param pDisassocReq Pointer to received SME_DISASSOC_REQ message
784 * @return true When received SME_DISASSOC_REQ is formatted
785 * correctly
786 * false otherwise
787 */
788
789tANI_U8
790limIsSmeDisassocReqValid(tpAniSirGlobal pMac,
791 tpSirSmeDisassocReq pDisassocReq, tpPESession psessionEntry)
792{
793 if (limIsGroupAddr(pDisassocReq->peerMacAddr) &&
794 !limIsAddrBC(pDisassocReq->peerMacAddr))
795 return false;
796
Jeff Johnson295189b2012-06-20 16:38:30 -0700797
798 return true;
799} /*** end limIsSmeDisassocReqValid() ***/
800
801
802
803/**
804 * limIsSmeDisassocCnfValid()
805 *
806 *FUNCTION:
807 * This function is called by limProcessSmeReqMessages() upon
808 * receiving SME_DISASSOC_CNF message from application.
809 *
810 *LOGIC:
811 * Message validity checks are performed in this function
812 *
813 *ASSUMPTIONS:
814 *
815 *NOTE:
816 *
817 * @param pMac Pointer to Global MAC structure
818 * @param pDisassocCnf Pointer to received SME_DISASSOC_REQ message
819 * @return true When received SME_DISASSOC_CNF is formatted
820 * correctly
821 * false otherwise
822 */
823
824tANI_U8
825limIsSmeDisassocCnfValid(tpAniSirGlobal pMac,
826 tpSirSmeDisassocCnf pDisassocCnf, tpPESession psessionEntry)
827{
828 if (limIsGroupAddr(pDisassocCnf->peerMacAddr))
829 return false;
830
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 return true;
832} /*** end limIsSmeDisassocCnfValid() ***/
833
834
835
836/**
837 * limIsSmeDeauthReqValid()
838 *
839 *FUNCTION:
840 * This function is called by limProcessSmeReqMessages() upon
841 * receiving SME_DEAUTH_REQ message from application.
842 *
843 *LOGIC:
844 * Message validity checks are performed in this function
845 *
846 *ASSUMPTIONS:
847 *
848 *NOTE:
849 *
850 * @param pMac Pointer to Global MAC structure
851 * @param pDeauthReq Pointer to received SME_DEAUTH_REQ message
852 * @return true When received SME_DEAUTH_REQ is formatted correctly
853 * false otherwise
854 */
855
856tANI_U8
857limIsSmeDeauthReqValid(tpAniSirGlobal pMac, tpSirSmeDeauthReq pDeauthReq, tpPESession psessionEntry)
858{
859 if (limIsGroupAddr(pDeauthReq->peerMacAddr) &&
860 !limIsAddrBC(pDeauthReq->peerMacAddr))
861 return false;
862
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 return true;
864} /*** end limIsSmeDeauthReqValid() ***/
865
866
867
868/**
869 * limIsSmeScanReqValid()
870 *
871 *FUNCTION:
872 * This function is called by limProcessSmeReqMessages() upon
873 * receiving SME_SCAN_REQ message from application.
874 *
875 *LOGIC:
876 * Message validity checks are performed in this function
877 *
878 *ASSUMPTIONS:
879 *
880 *NOTE:
881 *
882 * @param pScanReq Pointer to received SME_SCAN_REQ message
883 * @return true when received SME_SCAN_REQ is formatted correctly
884 * false otherwise
885 */
886
887tANI_U8
888limIsSmeScanReqValid(tpAniSirGlobal pMac, tpSirSmeScanReq pScanReq)
889{
890 tANI_U8 valid = true;
891 tANI_U8 i = 0;
892
Abhishek Singhd9205942015-04-29 14:45:36 +0530893 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
894 {
895 valid = false;
896 limLog(pMac, LOGE, FL("Number of SSIDs > SIR_SCAN_MAX_NUM_SSID"));
897 goto end;
898 }
899
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 for (i = 0; i < pScanReq->numSsid; i++)
901 {
902 if (pScanReq->ssId[i].length > SIR_MAC_MAX_SSID_LENGTH)
903 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530904 limLog(pMac, LOGE,
905 FL("Requested SSID length > SIR_MAC_MAX_SSID_LENGTH"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 valid = false;
907 goto end;
908 }
909 }
Abhishek Singhd9205942015-04-29 14:45:36 +0530910 if ((pScanReq->bssType < 0) || (pScanReq->bssType > eSIR_AUTO_MODE))
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530911 {
912 limLog(pMac, LOGE, FL("Invalid BSS Type"));
913 valid = false;
914 }
915 if (limIsGroupAddr(pScanReq->bssId) && !limIsAddrBC(pScanReq->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 {
917 valid = false;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530918 limLog(pMac, LOGE, FL("BSSID is group addr and is not Broadcast Addr"));
919 }
920 if (!(pScanReq->scanType == eSIR_PASSIVE_SCAN || pScanReq->scanType == eSIR_ACTIVE_SCAN))
921 {
922 valid = false;
923 limLog(pMac, LOGE, FL("Invalid Scan Type"));
924 }
925 if (pScanReq->channelList.numChannels > SIR_MAX_NUM_CHANNELS)
926 {
927 valid = false;
928 limLog(pMac, LOGE, FL("Number of Channels > SIR_MAX_NUM_CHANNELS"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 }
930
931 /*
932 ** check min/max channelTime range
933 **/
934
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530935 if (valid)
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530937 if ((pScanReq->scanType == eSIR_ACTIVE_SCAN) &&
938 (pScanReq->maxChannelTime < pScanReq->minChannelTime))
939 {
940 limLog(pMac, LOGE, FL("Max Channel Time < Min Channel Time"));
941 valid = false;
942 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 }
944
945end:
946 return valid;
947} /*** end limIsSmeScanReqValid() ***/
948
949
950
951/**
952 * limIsSmeAuthReqValid()
953 *
954 *FUNCTION:
955 * This function is called by limProcessSmeReqMessages() upon
956 * receiving SME_AUTH_REQ message from application.
957 *
958 *LOGIC:
959 * Message validity checks are performed in this function
960 *
961 *ASSUMPTIONS:
962 *
963 *NOTE:
964 *
965 * @param pAuthReq Pointer to received SME_AUTH_REQ message
966 * @return true when received SME_AUTH_REQ is formatted correctly
967 * false otherwise
968 */
969
970tANI_U8
971limIsSmeAuthReqValid(tpSirSmeAuthReq pAuthReq)
972{
973 tANI_U8 valid = true;
974
975 if (limIsGroupAddr(pAuthReq->peerMacAddr) ||
976 (pAuthReq->authType > eSIR_AUTO_SWITCH) ||
977 !pAuthReq->channelNumber)
978 {
979 valid = false;
980 goto end;
981 }
982
983end:
984 return valid;
985} /*** end limIsSmeAuthReqValid() ***/
986
987
988
989/**
990 * limIsSmeSetContextReqValid()
991 *
992 *FUNCTION:
993 * This function is called by limProcessSmeReqMessages() upon
994 * receiving SME_SET_CONTEXT_REQ message from application.
995 *
996 *LOGIC:
997 * Message validity checks are performed in this function
998 *
999 *ASSUMPTIONS:
1000 *
1001 *NOTE:
1002 *
1003 * @param pMsg - Pointer to received SME_SET_CONTEXT_REQ message
1004 * @return true when received SME_SET_CONTEXT_REQ is formatted correctly
1005 * false otherwise
1006 */
1007
1008tANI_U8
1009limIsSmeSetContextReqValid(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq)
1010{
1011 tANI_U8 i = 0;
1012 tANI_U8 valid = true;
1013 tpSirKeys pKey = pSetContextReq->keyMaterial.key;
1014
1015 if ((pSetContextReq->keyMaterial.edType != eSIR_ED_WEP40) &&
1016 (pSetContextReq->keyMaterial.edType != eSIR_ED_WEP104) &&
1017 (pSetContextReq->keyMaterial.edType != eSIR_ED_NONE) &&
1018#ifdef FEATURE_WLAN_WAPI
1019 (pSetContextReq->keyMaterial.edType != eSIR_ED_WPI) &&
1020#endif
1021 !pSetContextReq->keyMaterial.numKeys)
1022 {
1023 /**
1024 * No keys present in case of TKIP or CCMP
1025 * Log error.
1026 */
1027 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001028 FL("No keys present in SME_SETCONTEXT_REQ for edType=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 pSetContextReq->keyMaterial.edType);
1030
1031 valid = false;
1032 goto end;
1033 }
1034
1035 if (pSetContextReq->keyMaterial.numKeys &&
1036 (pSetContextReq->keyMaterial.edType == eSIR_ED_NONE))
1037 {
1038 /**
1039 * Keys present in case of no ED policy
1040 * Log error.
1041 */
1042 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001043 FL("Keys present in SME_SETCONTEXT_REQ for edType=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 pSetContextReq->keyMaterial.edType);
1045
1046 valid = false;
1047 goto end;
1048 }
1049
1050 if (pSetContextReq->keyMaterial.edType >= eSIR_ED_NOT_IMPLEMENTED)
1051 {
1052 /**
1053 * Invalid edType in the message
1054 * Log error.
1055 */
1056 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001057 FL("Invalid edType=%d in SME_SETCONTEXT_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 pSetContextReq->keyMaterial.edType);
1059
1060 valid = false;
1061 goto end;
1062 }
1063 else if (pSetContextReq->keyMaterial.edType > eSIR_ED_NONE)
1064 {
1065 tANI_U32 poi;
1066
1067 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED,
1068 &poi) != eSIR_SUCCESS)
1069 {
1070 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001071 FL("Unable to retrieve POI from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 }
1073
1074 if (!poi)
1075 {
1076 /**
1077 * Privacy is not enabled
1078 * In order to allow mixed mode for Guest access
1079 * allow BSS creation/join with no Privacy capability
1080 * yet advertising WPA IE
1081 */
1082 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001083 FL("Privacy is not enabled, yet non-None EDtype=%d in SME_SETCONTEXT_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 pSetContextReq->keyMaterial.edType);)
1085 }
1086 }
1087
1088 for (i = 0; i < pSetContextReq->keyMaterial.numKeys; i++)
1089 {
1090 if (((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) &&
1091 (pKey->keyLength != 5)) ||
1092 ((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104) &&
1093 (pKey->keyLength != 13)) ||
1094 ((pSetContextReq->keyMaterial.edType == eSIR_ED_TKIP) &&
1095 (pKey->keyLength != 32)) ||
1096#ifdef FEATURE_WLAN_WAPI
1097 ((pSetContextReq->keyMaterial.edType == eSIR_ED_WPI) &&
1098 (pKey->keyLength != 32)) ||
1099#endif
1100 ((pSetContextReq->keyMaterial.edType == eSIR_ED_CCMP) &&
1101 (pKey->keyLength != 16)))
1102 {
1103 /**
1104 * Invalid key length for a given ED type
1105 * Log error.
1106 */
1107 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001108 FL("Invalid keyLength =%d for edType=%d in SME_SETCONTEXT_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 pKey->keyLength, pSetContextReq->keyMaterial.edType);
1110
1111 valid = false;
1112 goto end;
1113 }
1114 pKey++;
1115 }
1116
1117end:
1118 return valid;
1119} /*** end limIsSmeSetContextReqValid() ***/
1120
1121
1122
1123/**
1124 * limIsSmeStopBssReqValid()
1125 *
1126 *FUNCTION:
1127 * This function is called by limProcessSmeReqMessages() upon
1128 * receiving SME_STOP_BSS_REQ message from application.
1129 *
1130 *LOGIC:
1131 * Message validity checks are performed in this function
1132 *
1133 *ASSUMPTIONS:
1134 *
1135 *NOTE:
1136 *
1137 * @param pMsg - Pointer to received SME_STOP_BSS_REQ message
1138 * @return true when received SME_STOP_BSS_REQ is formatted correctly
1139 * false otherwise
1140 */
1141
1142tANI_U8
1143limIsSmeStopBssReqValid(tANI_U32 *pMsg)
1144{
1145 tANI_U8 valid = true;
1146
1147 return valid;
1148} /*** end limIsSmeStopBssReqValid() ***/
1149
1150
1151/**
1152 * limGetBssIdFromSmeJoinReqMsg()
1153 *
1154 *FUNCTION:
1155 * This function is called in various places to get BSSID
1156 * from BSS description/Neighbor BSS Info in the SME_JOIN_REQ/
1157 * SME_REASSOC_REQ message.
1158 *
1159 *PARAMS:
1160 *
1161 *LOGIC:
1162 *
1163 *ASSUMPTIONS:
1164 * NA
1165 *
1166 *NOTE:
1167 * NA
1168 *
1169 * @param pBuf - Pointer to received SME_JOIN/SME_REASSOC_REQ
1170 * message
1171 * @return pBssId - Pointer to BSSID
1172 */
1173
1174tANI_U8*
1175limGetBssIdFromSmeJoinReqMsg(tANI_U8 *pBuf)
1176{
1177 if (!pBuf)
1178 return NULL;
1179
1180 pBuf += sizeof(tANI_U32); // skip message header
1181
Jeff Johnson295189b2012-06-20 16:38:30 -07001182
1183 pBuf += limGetU16(pBuf) + sizeof(tANI_U16); // skip RSN IE
1184
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 pBuf += sizeof(tANI_U16); // skip length of BSS description
Jeff Johnson295189b2012-06-20 16:38:30 -07001186
1187 return (pBuf);
1188} /*** end limGetBssIdFromSmeJoinReqMsg() ***/
1189
1190