Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 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. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 44 | * This file limUtils.cc contains the utility functions |
| 45 | * LIM uses. |
| 46 | * Author: Chandra Modumudi |
| 47 | * Date: 02/13/02 |
| 48 | * History:- |
| 49 | * Date Modified by Modification Information |
| 50 | * -------------------------------------------------------------------- |
| 51 | */ |
| 52 | |
| 53 | #include "aniGlobal.h" |
| 54 | #include "wniApi.h" |
| 55 | |
| 56 | #include "sirCommon.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | #include "wniCfgSta.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | #include "cfgApi.h" |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | |
| 61 | #include "utilsApi.h" |
| 62 | #include "limUtils.h" |
| 63 | #include "limSecurityUtils.h" |
| 64 | #include "limSession.h" |
| 65 | |
| 66 | |
| 67 | #define LIM_SEED_LENGTH 16 |
| 68 | |
| 69 | /** |
| 70 | * limIsAuthAlgoSupported() |
| 71 | * |
| 72 | *FUNCTION: |
| 73 | * This function is called in various places within LIM code |
| 74 | * to determine whether passed authentication algorithm is enabled |
| 75 | * or not |
| 76 | * |
| 77 | *LOGIC: |
| 78 | * |
| 79 | *ASSUMPTIONS: |
| 80 | * NA |
| 81 | * |
| 82 | *NOTE: |
| 83 | * NA |
| 84 | * |
| 85 | * @param authType Indicates MAC based authentication type |
| 86 | * (eSIR_OPEN_SYSTEM or eSIR_SHARED_KEY) |
| 87 | * If Shared Key authentication to be used, |
| 88 | * 'Privacy Option Implemented' flag is also |
| 89 | * checked. |
| 90 | * |
| 91 | * @return true if passed authType is enabled else false |
| 92 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | tANI_U8 |
| 94 | limIsAuthAlgoSupported(tpAniSirGlobal pMac, tAniAuthType authType, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 95 | { |
| 96 | tANI_U32 algoEnable, privacyOptImp; |
| 97 | |
| 98 | if (authType == eSIR_OPEN_SYSTEM) |
| 99 | { |
| 100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 102 | { |
| 103 | if((psessionEntry->authType == eSIR_OPEN_SYSTEM) || (psessionEntry->authType == eSIR_AUTO_SWITCH)) |
| 104 | return true; |
| 105 | else |
| 106 | return false; |
| 107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | |
| 109 | if (wlan_cfgGetInt(pMac, WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE, |
| 110 | &algoEnable) != eSIR_SUCCESS) |
| 111 | { |
| 112 | /** |
| 113 | * Could not get AuthAlgo1 Enable value |
| 114 | * from CFG. Log error. |
| 115 | */ |
| 116 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 117 | FL("could not retrieve AuthAlgo1 Enable value")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | |
| 119 | return false; |
| 120 | } |
| 121 | else |
| 122 | return ( (algoEnable > 0 ? true : false) ); |
| 123 | } |
| 124 | else |
| 125 | { |
| 126 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 127 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 128 | { |
| 129 | if((psessionEntry->authType == eSIR_SHARED_KEY) || (psessionEntry->authType == eSIR_AUTO_SWITCH)) |
| 130 | algoEnable = true; |
| 131 | else |
| 132 | algoEnable = false; |
| 133 | |
| 134 | } |
| 135 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | |
| 137 | if (wlan_cfgGetInt(pMac, WNI_CFG_SHARED_KEY_AUTH_ENABLE, |
| 138 | &algoEnable) != eSIR_SUCCESS) |
| 139 | { |
| 140 | /** |
| 141 | * Could not get AuthAlgo2 Enable value |
| 142 | * from CFG. Log error. |
| 143 | */ |
| 144 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 145 | FL("could not retrieve AuthAlgo2 Enable value")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 146 | |
| 147 | return false; |
| 148 | } |
| 149 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 150 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 151 | { |
| 152 | privacyOptImp = psessionEntry->privacy; |
| 153 | } |
| 154 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 155 | |
| 156 | if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, |
| 157 | &privacyOptImp) != eSIR_SUCCESS) |
| 158 | { |
| 159 | /** |
| 160 | * Could not get PrivacyOptionImplemented value |
| 161 | * from CFG. Log error. |
| 162 | */ |
| 163 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 164 | FL("could not retrieve PrivacyOptImplemented value")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | |
| 166 | return false; |
| 167 | } |
| 168 | return (algoEnable && privacyOptImp); |
| 169 | } |
| 170 | } /****** end limIsAuthAlgoSupported() ******/ |
| 171 | |
| 172 | |
| 173 | |
| 174 | /** |
| 175 | * limInitPreAuthList |
| 176 | * |
| 177 | *FUNCTION: |
| 178 | * This function is called while starting a BSS at AP |
| 179 | * to initialize MAC authenticated STA list. This may also be called |
| 180 | * while joining/starting an IBSS if MAC authentication is allowed |
| 181 | * in IBSS mode. |
| 182 | * |
| 183 | *LOGIC: |
| 184 | * |
| 185 | *ASSUMPTIONS: |
| 186 | * |
| 187 | *NOTE: |
| 188 | * |
| 189 | * @param pMac - Pointer to Global MAC structure |
| 190 | * @return None |
| 191 | */ |
| 192 | |
| 193 | void |
| 194 | limInitPreAuthList(tpAniSirGlobal pMac) |
| 195 | { |
| 196 | pMac->lim.pLimPreAuthList = NULL; |
| 197 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | } /*** end limInitPreAuthList() ***/ |
| 199 | |
| 200 | |
| 201 | |
| 202 | /** |
| 203 | * limDeletePreAuthList |
| 204 | * |
| 205 | *FUNCTION: |
| 206 | * This function is called cleanup Pre-auth list either on |
| 207 | * AP or on STA when moving from one persona to other. |
| 208 | * |
| 209 | *LOGIC: |
| 210 | * |
| 211 | *ASSUMPTIONS: |
| 212 | * |
| 213 | *NOTE: |
| 214 | * |
| 215 | * @param pMac - Pointer to Global MAC structure |
| 216 | * @return None |
| 217 | */ |
| 218 | |
| 219 | void |
| 220 | limDeletePreAuthList(tpAniSirGlobal pMac) |
| 221 | { |
| 222 | struct tLimPreAuthNode *pCurrNode, *pTempNode; |
| 223 | |
| 224 | pCurrNode = pTempNode = pMac->lim.pLimPreAuthList; |
| 225 | while (pCurrNode != NULL) |
| 226 | { |
| 227 | pTempNode = pCurrNode->next; |
| 228 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 229 | PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthList "));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | limReleasePreAuthNode(pMac, pCurrNode); |
| 231 | |
| 232 | pCurrNode = pTempNode; |
| 233 | } |
| 234 | pMac->lim.pLimPreAuthList = NULL; |
| 235 | } /*** end limDeletePreAuthList() ***/ |
| 236 | |
| 237 | |
| 238 | |
| 239 | /** |
| 240 | * limSearchPreAuthList |
| 241 | * |
| 242 | *FUNCTION: |
| 243 | * This function is called when Authentication frame is received |
| 244 | * by AP (or at a STA in IBSS supporting MAC based authentication) |
| 245 | * to search if a STA is in the middle of MAC Authentication |
| 246 | * transaction sequence. |
| 247 | * |
| 248 | *LOGIC: |
| 249 | * |
| 250 | *ASSUMPTIONS: |
| 251 | * |
| 252 | *NOTE: |
| 253 | * |
| 254 | * @param macAddr - MAC address of the STA that sent |
| 255 | * Authentication frame. |
| 256 | * |
| 257 | * @return Pointer to pre-auth node if found, else NULL |
| 258 | */ |
| 259 | |
| 260 | struct tLimPreAuthNode * |
| 261 | limSearchPreAuthList(tpAniSirGlobal pMac, tSirMacAddr macAddr) |
| 262 | { |
| 263 | struct tLimPreAuthNode *pTempNode = pMac->lim.pLimPreAuthList; |
| 264 | |
| 265 | while (pTempNode != NULL) |
| 266 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 267 | if (vos_mem_compare( (tANI_U8 *) macAddr, |
| 268 | (tANI_U8 *) &pTempNode->peerMacAddr, |
| 269 | sizeof(tSirMacAddr)) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | break; |
| 271 | |
| 272 | pTempNode = pTempNode->next; |
| 273 | } |
| 274 | |
| 275 | return pTempNode; |
| 276 | } /*** end limSearchPreAuthList() ***/ |
| 277 | |
| 278 | |
| 279 | |
| 280 | /** |
| 281 | * limAddPreAuthNode |
| 282 | * |
| 283 | *FUNCTION: |
| 284 | * This function is called at AP while sending Authentication |
| 285 | * frame2. |
| 286 | * This may also be called on a STA in IBSS if MAC authentication is |
| 287 | * allowed in IBSS mode. |
| 288 | * |
| 289 | *LOGIC: |
| 290 | * Node is always added to the front of the list |
| 291 | * |
| 292 | *ASSUMPTIONS: |
| 293 | * |
| 294 | *NOTE: |
| 295 | * |
| 296 | * @param pMac - Pointer to Global MAC structure |
| 297 | * @param pAuthNode - Pointer to pre-auth node to be added to the list. |
| 298 | * |
| 299 | * @return None |
| 300 | */ |
| 301 | |
| 302 | void |
| 303 | limAddPreAuthNode(tpAniSirGlobal pMac, struct tLimPreAuthNode *pAuthNode) |
| 304 | { |
| 305 | pMac->lim.gLimNumPreAuthContexts++; |
| 306 | |
| 307 | pAuthNode->next = pMac->lim.pLimPreAuthList; |
| 308 | |
| 309 | pMac->lim.pLimPreAuthList = pAuthNode; |
| 310 | } /*** end limAddPreAuthNode() ***/ |
| 311 | |
| 312 | |
| 313 | /** |
| 314 | * limReleasePreAuthNode |
| 315 | * |
| 316 | *FUNCTION: |
| 317 | * This function is called to realease the accquired |
| 318 | * pre auth node from list. |
| 319 | * |
| 320 | *LOGIC: |
| 321 | * |
| 322 | *ASSUMPTIONS: |
| 323 | * |
| 324 | *NOTE: |
| 325 | * |
| 326 | * @param pMac - Pointer to Global MAC structure |
| 327 | * @param pAuthNode - Pointer to Pre Auth node to be released |
| 328 | * @return None |
| 329 | */ |
| 330 | |
| 331 | void |
| 332 | limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode) |
| 333 | { |
| 334 | pAuthNode->fFree = 1; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 335 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 336 | tx_timer_deactivate(&pAuthNode->timer); |
| 337 | pMac->lim.gLimNumPreAuthContexts--; |
| 338 | } /*** end limReleasePreAuthNode() ***/ |
| 339 | |
| 340 | |
| 341 | /** |
| 342 | * limDeletePreAuthNode |
| 343 | * |
| 344 | *FUNCTION: |
| 345 | * This function is called at AP when a pre-authenticated STA is |
| 346 | * Associated/Reassociated or when AuthFrame4 is received after |
| 347 | * Auth Response timeout. |
| 348 | * This may also be called on a STA in IBSS if MAC authentication and |
| 349 | * Association/Reassociation is allowed in IBSS mode. |
| 350 | * |
| 351 | *LOGIC: |
| 352 | * |
| 353 | *ASSUMPTIONS: |
| 354 | * |
| 355 | *NOTE: |
| 356 | * |
| 357 | * @param pMac - Pointer to Global MAC structure |
| 358 | * @param peerMacAddr - MAC address of the STA that need to be deleted |
| 359 | * from pre-auth node list. |
| 360 | * |
| 361 | * @return None |
| 362 | */ |
| 363 | |
| 364 | void |
| 365 | limDeletePreAuthNode(tpAniSirGlobal pMac, tSirMacAddr macAddr) |
| 366 | { |
| 367 | struct tLimPreAuthNode *pPrevNode, *pTempNode; |
| 368 | |
| 369 | pTempNode = pPrevNode = pMac->lim.pLimPreAuthList; |
| 370 | |
| 371 | if (pTempNode == NULL) |
| 372 | return; |
| 373 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 374 | if (vos_mem_compare( (tANI_U8 *) macAddr, |
| 375 | (tANI_U8 *) &pTempNode->peerMacAddr, |
| 376 | sizeof(tSirMacAddr)) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 377 | { |
| 378 | // First node to be deleted |
| 379 | |
| 380 | pMac->lim.pLimPreAuthList = pTempNode->next; |
| 381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 382 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 383 | PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthNode : first node to delete"));) |
| 384 | PELOG1(limLog(pMac, LOG1, FL("Release data entry: %x id %d peer "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | pTempNode, pTempNode->authNodeIdx); |
| 386 | limPrintMacAddr(pMac, macAddr, LOG1);) |
| 387 | limReleasePreAuthNode(pMac, pTempNode); |
| 388 | |
| 389 | return; |
| 390 | } |
| 391 | |
| 392 | pTempNode = pTempNode->next; |
| 393 | |
| 394 | while (pTempNode != NULL) |
| 395 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 396 | if (vos_mem_compare( (tANI_U8 *) macAddr, |
| 397 | (tANI_U8 *) &pTempNode->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 398 | sizeof(tSirMacAddr)) ) |
| 399 | { |
| 400 | // Found node to be deleted |
| 401 | |
| 402 | pPrevNode->next = pTempNode->next; |
| 403 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 404 | PELOG1(limLog(pMac, LOG1, FL("=====> limDeletePreAuthNode : subsequent node to delete")); |
| 405 | limLog(pMac, LOG1, FL("Release data entry: %x id %d peer "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | pTempNode, pTempNode->authNodeIdx); |
| 407 | limPrintMacAddr(pMac, macAddr, LOG1);) |
| 408 | limReleasePreAuthNode(pMac, pTempNode); |
| 409 | |
| 410 | return; |
| 411 | } |
| 412 | |
| 413 | pPrevNode = pTempNode; |
| 414 | pTempNode = pTempNode->next; |
| 415 | } |
| 416 | |
| 417 | // Should not be here |
| 418 | // Log error |
| 419 | limLog(pMac, LOGP, FL("peer not found in pre-auth list, addr= ")); |
| 420 | limPrintMacAddr(pMac, macAddr, LOGP); |
| 421 | |
| 422 | } /*** end limDeletePreAuthNode() ***/ |
| 423 | |
| 424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 425 | |
| 426 | |
| 427 | |
| 428 | /** |
| 429 | * limRestoreFromPreAuthState |
| 430 | * |
| 431 | *FUNCTION: |
| 432 | * This function is called on STA whenever an Authentication |
| 433 | * sequence is complete and state prior to auth need to be |
| 434 | * restored. |
| 435 | * |
| 436 | *LOGIC: |
| 437 | * MLM_AUTH_CNF is prepared and sent to SME state machine. |
| 438 | * In case of restoring from pre-auth: |
| 439 | * - Channel Id is programmed at LO/RF synthesizer |
| 440 | * - BSSID is programmed at RHP |
| 441 | * |
| 442 | *ASSUMPTIONS: |
| 443 | * |
| 444 | *NOTE: |
| 445 | * |
| 446 | * @param pMac - Pointer to Global MAC structure |
| 447 | * @param resultCode - result of authentication attempt |
| 448 | * @return None |
| 449 | */ |
| 450 | |
| 451 | void |
| 452 | limRestoreFromAuthState(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode,tpPESession sessionEntry) |
| 453 | { |
| 454 | tSirMacAddr currentBssId; |
| 455 | tLimMlmAuthCnf mlmAuthCnf; |
| 456 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 457 | vos_mem_copy( (tANI_U8 *) &mlmAuthCnf.peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 458 | (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 459 | sizeof(tSirMacAddr)); |
| 460 | mlmAuthCnf.authType = pMac->lim.gpLimMlmAuthReq->authType; |
| 461 | mlmAuthCnf.resultCode = resultCode; |
| 462 | mlmAuthCnf.protStatusCode = protStatusCode; |
| 463 | |
| 464 | /* Update PE session ID*/ |
| 465 | mlmAuthCnf.sessionId = sessionEntry->peSessionId; |
| 466 | |
| 467 | /// Free up buffer allocated |
| 468 | /// for pMac->lim.gLimMlmAuthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 469 | vos_mem_free(pMac->lim.gpLimMlmAuthReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 470 | pMac->lim.gpLimMlmAuthReq = NULL; |
| 471 | |
| 472 | sessionEntry->limMlmState = sessionEntry->limPrevMlmState; |
| 473 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 474 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 475 | |
| 476 | |
| 477 | // 'Change' timer for future activations |
| 478 | limDeactivateAndChangeTimer(pMac, eLIM_AUTH_FAIL_TIMER); |
| 479 | |
| 480 | #if 0 |
| 481 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != eSIR_SUCCESS) |
| 482 | { |
| 483 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 484 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 485 | } |
| 486 | #endif //TO SUPPORT BT-AMP |
| 487 | sirCopyMacAddr(currentBssId,sessionEntry->bssId); |
| 488 | |
| 489 | if (sessionEntry->limSmeState == eLIM_SME_WT_PRE_AUTH_STATE) |
| 490 | { |
| 491 | pMac->lim.gLimPreAuthChannelNumber = 0; |
| 492 | } |
| 493 | |
| 494 | limPostSmeMessage(pMac, |
| 495 | LIM_MLM_AUTH_CNF, |
| 496 | (tANI_U32 *) &mlmAuthCnf); |
| 497 | } /*** end limRestoreFromAuthState() ***/ |
| 498 | |
| 499 | |
| 500 | |
| 501 | /** |
| 502 | * limLookUpKeyMappings() |
| 503 | * |
| 504 | *FUNCTION: |
| 505 | * This function is called in limProcessAuthFrame() function |
| 506 | * to determine if there exists a Key Mapping key for a given |
| 507 | * MAC address. |
| 508 | * |
| 509 | *LOGIC: |
| 510 | * |
| 511 | *ASSUMPTIONS: |
| 512 | * NA |
| 513 | * |
| 514 | *NOTE: |
| 515 | * NA |
| 516 | * |
| 517 | * @param macAddr MAC address of the peer STA for which existence |
| 518 | * of Key Mapping key is to be determined |
| 519 | * |
| 520 | * @return pKeyMapEntry - Pointer to the keyMapEntry returned by CFG |
| 521 | */ |
| 522 | |
| 523 | tCfgWepKeyEntry * |
| 524 | limLookUpKeyMappings(tSirMacAddr macAddr) |
| 525 | { |
| 526 | return NULL; |
| 527 | } /****** end limLookUpKeyMappings() ******/ |
| 528 | |
| 529 | |
| 530 | |
| 531 | /** |
| 532 | * limEncryptAuthFrame() |
| 533 | * |
| 534 | *FUNCTION: |
| 535 | * This function is called in limProcessAuthFrame() function |
| 536 | * to encrypt Authentication frame3 body. |
| 537 | * |
| 538 | *LOGIC: |
| 539 | * |
| 540 | *ASSUMPTIONS: |
| 541 | * NA |
| 542 | * |
| 543 | *NOTE: |
| 544 | * NA |
| 545 | * |
| 546 | * @param pMac Pointer to Global MAC structure |
| 547 | * @param keyId key id to used |
| 548 | * @param pKey Pointer to the key to be used for encryption |
| 549 | * @param pPlainText Pointer to the body to be encrypted |
| 550 | * @param pEncrBody Pointer to the encrypted auth frame body |
| 551 | * @param keyLength 8 (WEP40) or 16 (WEP104) |
| 552 | * @return None |
| 553 | */ |
| 554 | |
| 555 | void |
| 556 | limEncryptAuthFrame(tpAniSirGlobal pMac, tANI_U8 keyId, tANI_U8 *pKey, tANI_U8 *pPlainText, |
| 557 | tANI_U8 *pEncrBody, tANI_U32 keyLength) |
| 558 | { |
| 559 | tANI_U8 seed[LIM_SEED_LENGTH], icv[SIR_MAC_WEP_ICV_LENGTH]; |
| 560 | |
| 561 | keyLength += 3; |
| 562 | |
| 563 | // Bytes 0-2 of seed is IV |
| 564 | // Read TSF timestamp into seed to get random IV - 1st 3 bytes |
| 565 | halGetTxTSFtimer(pMac, (tSirMacTimeStamp *) &seed); |
| 566 | |
| 567 | // Bytes 3-7 of seed is key |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 568 | vos_mem_copy((tANI_U8 *) &seed[3], pKey, keyLength - 3); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | |
| 570 | // Compute CRC-32 and place them in last 4 bytes of plain text |
| 571 | limComputeCrc32(icv, pPlainText, sizeof(tSirMacAuthFrameBody)); |
| 572 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 573 | vos_mem_copy( pPlainText + sizeof(tSirMacAuthFrameBody), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | icv, SIR_MAC_WEP_ICV_LENGTH); |
| 575 | |
| 576 | // Run RC4 on plain text with the seed |
| 577 | limRC4(pEncrBody + SIR_MAC_WEP_IV_LENGTH, |
| 578 | (tANI_U8 *) pPlainText, seed, keyLength, |
| 579 | LIM_ENCR_AUTH_BODY_LEN - SIR_MAC_WEP_IV_LENGTH); |
| 580 | |
| 581 | // Prepare IV |
| 582 | pEncrBody[0] = seed[0]; |
| 583 | pEncrBody[1] = seed[1]; |
| 584 | pEncrBody[2] = seed[2]; |
| 585 | pEncrBody[3] = keyId << 6; |
| 586 | } /****** end limEncryptAuthFrame() ******/ |
| 587 | |
| 588 | |
| 589 | |
| 590 | /** |
| 591 | * limComputeCrc32() |
| 592 | * |
| 593 | *FUNCTION: |
| 594 | * This function is called to compute CRC-32 on a given source. |
| 595 | * Used while encrypting/decrypting Authentication frame 3. |
| 596 | * |
| 597 | *LOGIC: |
| 598 | * |
| 599 | *ASSUMPTIONS: |
| 600 | * NA |
| 601 | * |
| 602 | *NOTE: |
| 603 | * NA |
| 604 | * |
| 605 | * @param pDest Destination location for computed CRC |
| 606 | * @param pSrc Source location to be CRC computed |
| 607 | * @param len Length over which CRC to be computed |
| 608 | * @return None |
| 609 | */ |
| 610 | |
| 611 | void |
| 612 | limComputeCrc32(tANI_U8 *pDest, tANI_U8 * pSrc, tANI_U8 len) |
| 613 | { |
| 614 | tANI_U32 crc; |
| 615 | int i; |
| 616 | |
| 617 | crc = 0; |
| 618 | crc = ~crc; |
| 619 | |
| 620 | while(len-- > 0) |
| 621 | crc = limCrcUpdate(crc, *pSrc++); |
| 622 | |
| 623 | crc = ~crc; |
| 624 | |
| 625 | for (i=0; i < SIR_MAC_WEP_IV_LENGTH; i++) |
| 626 | { |
| 627 | pDest[i] = (tANI_U8)crc; |
| 628 | crc >>= 8; |
| 629 | } |
| 630 | } /****** end limComputeCrc32() ******/ |
| 631 | |
| 632 | |
| 633 | |
| 634 | /** |
| 635 | * limRC4() |
| 636 | * |
| 637 | *FUNCTION: |
| 638 | * This function is called to run RC4 algorithm. Called while |
| 639 | * encrypting/decrypting Authentication frame 3. |
| 640 | * |
| 641 | *LOGIC: |
| 642 | * |
| 643 | *ASSUMPTIONS: |
| 644 | * NA |
| 645 | * |
| 646 | *NOTE: |
| 647 | * NA |
| 648 | * |
| 649 | * @param pDest Destination location for encrypted text |
| 650 | * @param pSrc Source location to be encrypted |
| 651 | * @param seed Contains seed (IV + key) for PRNG |
| 652 | * @param keyLength 8 (WEP40) or 16 (WEP104) |
| 653 | * @param frameLen Length of the frame |
| 654 | * |
| 655 | * @return None |
| 656 | */ |
| 657 | |
| 658 | void |
| 659 | limRC4(tANI_U8 *pDest, tANI_U8 *pSrc, tANI_U8 *seed, tANI_U32 keyLength, tANI_U16 frameLen) |
| 660 | { |
| 661 | typedef struct |
| 662 | { |
| 663 | tANI_U8 i, j; |
| 664 | tANI_U8 sbox[256]; |
| 665 | } tRC4Context; |
| 666 | |
| 667 | tRC4Context ctx; |
| 668 | |
| 669 | { |
| 670 | tANI_U16 i, j, k; |
| 671 | |
| 672 | // |
| 673 | // Initialize sbox using seed |
| 674 | // |
| 675 | |
| 676 | ctx.i = ctx.j = 0; |
| 677 | for (i=0; i<256; i++) |
| 678 | ctx.sbox[i] = (tANI_U8)i; |
| 679 | |
| 680 | j = 0; |
| 681 | k = 0; |
| 682 | for (i=0; i<256; i++) |
| 683 | { |
| 684 | tANI_U8 temp; |
Kiran Kumar Lokere | a4db3dc | 2013-03-25 18:05:24 -0700 | [diff] [blame] | 685 | if ( k < LIM_SEED_LENGTH ) |
| 686 | j = (tANI_U8)(j + ctx.sbox[i] + seed[k]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | temp = ctx.sbox[i]; |
| 688 | ctx.sbox[i] = ctx.sbox[j]; |
| 689 | ctx.sbox[j] = temp; |
| 690 | |
| 691 | if (++k >= keyLength) |
| 692 | k = 0; |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | { |
| 697 | tANI_U8 i = ctx.i; |
| 698 | tANI_U8 j = ctx.j; |
| 699 | tANI_U8 len = (tANI_U8) frameLen; |
| 700 | |
| 701 | while (len-- > 0) |
| 702 | { |
| 703 | tANI_U8 temp1, temp2; |
| 704 | |
| 705 | i = (tANI_U8)(i+1); |
| 706 | temp1 = ctx.sbox[i]; |
| 707 | j = (tANI_U8)(j + temp1); |
| 708 | |
| 709 | ctx.sbox[i] = temp2 = ctx.sbox[j]; |
| 710 | ctx.sbox[j] = temp1; |
| 711 | |
| 712 | temp1 = (tANI_U8)(temp1 + temp2); |
| 713 | temp1 = ctx.sbox[temp1]; |
| 714 | temp2 = (tANI_U8)(pSrc ? *pSrc++ : 0); |
| 715 | |
| 716 | *pDest++ = (tANI_U8)(temp1 ^ temp2); |
| 717 | } |
| 718 | |
| 719 | ctx.i = i; |
| 720 | ctx.j = j; |
| 721 | } |
| 722 | } /****** end limRC4() ******/ |
| 723 | |
| 724 | |
| 725 | |
| 726 | /** |
| 727 | * limDecryptAuthFrame() |
| 728 | * |
| 729 | *FUNCTION: |
| 730 | * This function is called in limProcessAuthFrame() function |
| 731 | * to decrypt received Authentication frame3 body. |
| 732 | * |
| 733 | *LOGIC: |
| 734 | * |
| 735 | *ASSUMPTIONS: |
| 736 | * NA |
| 737 | * |
| 738 | *NOTE: |
| 739 | * NA |
| 740 | * |
| 741 | * @param pMac Pointer to Global MAC structure |
| 742 | * @param pKey Pointer to the key to be used for decryption |
| 743 | * @param pEncrBody Pointer to the body to be decrypted |
| 744 | * @param pPlainBody Pointer to the decrypted body |
| 745 | * @param keyLength 8 (WEP40) or 16 (WEP104) |
| 746 | * |
| 747 | * @return Decrypt result - eSIR_SUCCESS for success and |
| 748 | * LIM_DECRYPT_ICV_FAIL for ICV mismatch. |
| 749 | * If decryption is a success, pBody will |
| 750 | * have decrypted auth frame body. |
| 751 | */ |
| 752 | |
| 753 | tANI_U8 |
| 754 | limDecryptAuthFrame(tpAniSirGlobal pMac, tANI_U8 *pKey, tANI_U8 *pEncrBody, |
| 755 | tANI_U8 *pPlainBody, tANI_U32 keyLength, tANI_U16 frameLen) |
| 756 | { |
| 757 | tANI_U8 seed[LIM_SEED_LENGTH], icv[SIR_MAC_WEP_ICV_LENGTH]; |
| 758 | int i; |
| 759 | keyLength += 3; |
| 760 | |
| 761 | |
| 762 | // Bytes 0-2 of seed is received IV |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 763 | vos_mem_copy((tANI_U8 *) seed, pEncrBody, SIR_MAC_WEP_IV_LENGTH - 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | |
| 765 | // Bytes 3-7 of seed is key |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 766 | vos_mem_copy((tANI_U8 *) &seed[3], pKey, keyLength - 3); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 767 | |
| 768 | // Run RC4 on encrypted text with the seed |
| 769 | limRC4(pPlainBody, |
| 770 | pEncrBody + SIR_MAC_WEP_IV_LENGTH, |
| 771 | seed, |
| 772 | keyLength, |
| 773 | frameLen); |
| 774 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 775 | PELOG4(limLog(pMac, LOG4, FL("plainbody is ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pPlainBody, frameLen);) |
| 777 | |
| 778 | // Compute CRC-32 and place them in last 4 bytes of encrypted body |
| 779 | limComputeCrc32(icv, |
| 780 | (tANI_U8 *) pPlainBody, |
| 781 | (tANI_U8) (frameLen - SIR_MAC_WEP_ICV_LENGTH)); |
| 782 | |
| 783 | // Compare RX_ICV with computed ICV |
| 784 | for (i = 0; i < SIR_MAC_WEP_ICV_LENGTH; i++) |
| 785 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 786 | PELOG4(limLog(pMac, LOG4, FL(" computed ICV%d[%x], rxed ICV%d[%x]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 787 | i, icv[i], i, pPlainBody[frameLen - SIR_MAC_WEP_ICV_LENGTH + i]);) |
| 788 | if (icv[i] != pPlainBody[frameLen - SIR_MAC_WEP_ICV_LENGTH + i]) |
| 789 | return LIM_DECRYPT_ICV_FAIL; |
| 790 | } |
| 791 | |
| 792 | return eSIR_SUCCESS; |
| 793 | } /****** end limDecryptAuthFrame() ******/ |
| 794 | |
| 795 | /** |
| 796 | * limPostSmeSetKeysCnf |
| 797 | * |
| 798 | * A utility API to send MLM_SETKEYS_CNF to SME |
| 799 | */ |
| 800 | void limPostSmeSetKeysCnf( tpAniSirGlobal pMac, |
| 801 | tLimMlmSetKeysReq *pMlmSetKeysReq, |
| 802 | tLimMlmSetKeysCnf *mlmSetKeysCnf) |
| 803 | { |
| 804 | // Prepare and Send LIM_MLM_SETKEYS_CNF |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 805 | vos_mem_copy( (tANI_U8 *) &mlmSetKeysCnf->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 806 | (tANI_U8 *) pMlmSetKeysReq->peerMacAddr, |
| 807 | sizeof(tSirMacAddr)); |
| 808 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 809 | vos_mem_copy( (tANI_U8 *) &mlmSetKeysCnf->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 810 | (tANI_U8 *) pMlmSetKeysReq->peerMacAddr, |
| 811 | sizeof(tSirMacAddr)); |
| 812 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | |
| 814 | /// Free up buffer allocated for mlmSetKeysReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 815 | vos_mem_free( pMlmSetKeysReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 816 | pMac->lim.gpLimMlmSetKeysReq = NULL; |
| 817 | |
| 818 | limPostSmeMessage( pMac, |
| 819 | LIM_MLM_SETKEYS_CNF, |
| 820 | (tANI_U32 *) mlmSetKeysCnf ); |
| 821 | } |
| 822 | |
| 823 | /** |
| 824 | * limPostSmeRemoveKeysCnf |
| 825 | * |
| 826 | * A utility API to send MLM_REMOVEKEY_CNF to SME |
| 827 | */ |
| 828 | void limPostSmeRemoveKeyCnf( tpAniSirGlobal pMac, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 829 | tpPESession psessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 830 | tLimMlmRemoveKeyReq *pMlmRemoveKeyReq, |
| 831 | tLimMlmRemoveKeyCnf *mlmRemoveKeyCnf) |
| 832 | { |
| 833 | // Prepare and Send LIM_MLM_REMOVEKEYS_CNF |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 834 | vos_mem_copy( (tANI_U8 *) &mlmRemoveKeyCnf->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 835 | (tANI_U8 *) pMlmRemoveKeyReq->peerMacAddr, |
| 836 | sizeof(tSirMacAddr)); |
| 837 | |
| 838 | /// Free up buffer allocated for mlmRemoveKeysReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 839 | vos_mem_free( pMlmRemoveKeyReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | pMac->lim.gpLimMlmRemoveKeyReq = NULL; |
| 841 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 842 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; //Restore the state. |
| 843 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | |
| 845 | limPostSmeMessage( pMac, |
| 846 | LIM_MLM_REMOVEKEY_CNF, |
| 847 | (tANI_U32 *) mlmRemoveKeyCnf ); |
| 848 | } |
| 849 | |
| 850 | /** |
| 851 | * limSendSetBssKeyReq() |
| 852 | * |
| 853 | *FUNCTION: |
| 854 | * This function is called from limProcessMlmSetKeysReq(), |
| 855 | * when PE is trying to setup the Group Keys related |
| 856 | * to a specified encryption type |
| 857 | * |
| 858 | *LOGIC: |
| 859 | * |
| 860 | *ASSUMPTIONS: |
| 861 | * NA |
| 862 | * |
| 863 | *NOTE: |
| 864 | * NA |
| 865 | * |
| 866 | * @param pMac Pointer to Global MAC structure |
| 867 | * @param pMlmSetKeysReq Pointer to MLM_SETKEYS_REQ buffer |
| 868 | * @return none |
| 869 | */ |
| 870 | void limSendSetBssKeyReq( tpAniSirGlobal pMac, |
| 871 | tLimMlmSetKeysReq *pMlmSetKeysReq, |
| 872 | tpPESession psessionEntry) |
| 873 | { |
| 874 | tSirMsgQ msgQ; |
| 875 | tpSetBssKeyParams pSetBssKeyParams = NULL; |
| 876 | tLimMlmSetKeysCnf mlmSetKeysCnf; |
| 877 | tSirRetStatus retCode; |
| 878 | tANI_U32 val = 0; |
| 879 | |
| 880 | if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) |
| 881 | { |
| 882 | limLog( pMac, LOG1, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 883 | FL( "numKeys = %d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS" ), pMlmSetKeysReq->numKeys); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 884 | |
| 885 | // Respond to SME with error code |
| 886 | mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 887 | goto end; |
| 888 | } |
| 889 | |
| 890 | // Package WDA_SET_BSSKEY_REQ message parameters |
| 891 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 892 | pSetBssKeyParams = vos_mem_malloc(sizeof( tSetBssKeyParams )); |
| 893 | if ( NULL == pSetBssKeyParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | { |
| 895 | limLog( pMac, LOGE, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 896 | FL( "Unable to allocate memory during SET_BSSKEY" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | |
| 898 | // Respond to SME with error code |
| 899 | mlmSetKeysCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 900 | goto end; |
| 901 | } |
| 902 | else |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 903 | vos_mem_set( (void *) pSetBssKeyParams, |
| 904 | sizeof( tSetBssKeyParams ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 905 | |
| 906 | // Update the WDA_SET_BSSKEY_REQ parameters |
| 907 | pSetBssKeyParams->bssIdx = psessionEntry->bssIdx; |
| 908 | pSetBssKeyParams->encType = pMlmSetKeysReq->edType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 909 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | |
| 911 | if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val)) |
| 912 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 913 | limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | } |
| 915 | |
| 916 | pSetBssKeyParams->singleTidRc = (tANI_U8)val; |
| 917 | |
| 918 | /* Update PE session Id*/ |
| 919 | pSetBssKeyParams->sessionId = psessionEntry ->peSessionId; |
| 920 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 921 | if(pMlmSetKeysReq->key[0].keyId && |
| 922 | ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) || |
| 923 | (pMlmSetKeysReq->edType == eSIR_ED_WEP104)) |
| 924 | ) |
| 925 | { |
| 926 | /* IF the key id is non-zero and encryption type is WEP, Send all the 4 |
| 927 | * keys to HAL with filling the key at right index in pSetBssKeyParams->key. */ |
| 928 | pSetBssKeyParams->numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 929 | vos_mem_copy( (tANI_U8 *) &pSetBssKeyParams->key[pMlmSetKeysReq->key[0].keyId], |
| 930 | (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof(pMlmSetKeysReq->key[0])); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 931 | |
| 932 | } |
| 933 | else |
| 934 | { |
| 935 | pSetBssKeyParams->numKeys = pMlmSetKeysReq->numKeys; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 936 | vos_mem_copy( (tANI_U8 *) &pSetBssKeyParams->key, |
| 937 | (tANI_U8 *) &pMlmSetKeysReq->key, |
| 938 | sizeof( tSirKeys ) * pMlmSetKeysReq->numKeys ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | |
| 941 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 942 | msgQ.type = WDA_SET_BSSKEY_REQ; |
| 943 | // |
| 944 | // FIXME_GEN4 |
| 945 | // A global counter (dialog token) is required to keep track of |
| 946 | // all PE <-> HAL communication(s) |
| 947 | // |
| 948 | msgQ.reserved = 0; |
| 949 | msgQ.bodyptr = pSetBssKeyParams; |
| 950 | msgQ.bodyval = 0; |
| 951 | |
| 952 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 953 | FL( "Sending WDA_SET_BSSKEY_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 954 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 956 | { |
| 957 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 958 | FL("Posting SET_BSSKEY to HAL failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | retCode ); |
| 960 | |
| 961 | // Respond to SME with LIM_MLM_SETKEYS_CNF |
| 962 | mlmSetKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 963 | } |
| 964 | else |
| 965 | return; // Continue after WDA_SET_BSSKEY_RSP... |
| 966 | |
| 967 | end: |
| 968 | limPostSmeSetKeysCnf( pMac, |
| 969 | pMlmSetKeysReq, |
| 970 | &mlmSetKeysCnf ); |
| 971 | |
| 972 | } |
| 973 | |
| 974 | /** |
| 975 | * @function : limSendSetStaKeyReq() |
| 976 | * |
| 977 | * @brief : This function is called from limProcessMlmSetKeysReq(), |
| 978 | * when PE is trying to setup the Unicast Keys related |
| 979 | * to a specified STA with specified encryption type |
| 980 | * |
| 981 | *LOGIC: |
| 982 | * |
| 983 | *ASSUMPTIONS: |
| 984 | * NA |
| 985 | * |
| 986 | *NOTE: |
| 987 | * NA |
| 988 | * |
| 989 | * @param pMac Pointer to Global MAC structure |
| 990 | * @param pMlmSetKeysReq Pointer to MLM_SETKEYS_REQ buffer |
| 991 | * @param staIdx STA index for which the keys are being set |
| 992 | * @param defWEPIdx The default WEP key index [0..3] |
| 993 | * @return none |
| 994 | */ |
| 995 | void limSendSetStaKeyReq( tpAniSirGlobal pMac, |
| 996 | tLimMlmSetKeysReq *pMlmSetKeysReq, |
| 997 | tANI_U16 staIdx, |
| 998 | tANI_U8 defWEPIdx, |
| 999 | tpPESession sessionEntry) |
| 1000 | { |
| 1001 | tSirMsgQ msgQ; |
| 1002 | tpSetStaKeyParams pSetStaKeyParams = NULL; |
| 1003 | tLimMlmSetKeysCnf mlmSetKeysCnf; |
| 1004 | tSirRetStatus retCode; |
| 1005 | tANI_U32 val = 0; |
| 1006 | |
| 1007 | // Package WDA_SET_STAKEY_REQ message parameters |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1008 | pSetStaKeyParams = vos_mem_malloc(sizeof( tSetStaKeyParams )); |
| 1009 | if ( NULL == pSetStaKeyParams ) |
| 1010 | { |
| 1011 | limLog( pMac, LOGP, FL( "Unable to allocate memory during SET_BSSKEY" )); |
| 1012 | return; |
| 1013 | } |
| 1014 | else |
| 1015 | vos_mem_set( (void *) pSetStaKeyParams, sizeof( tSetStaKeyParams ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1016 | |
| 1017 | // Update the WDA_SET_STAKEY_REQ parameters |
| 1018 | pSetStaKeyParams->staIdx = staIdx; |
| 1019 | pSetStaKeyParams->encType = pMlmSetKeysReq->edType; |
| 1020 | |
| 1021 | |
| 1022 | if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val)) |
| 1023 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1024 | limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | } |
| 1026 | |
| 1027 | pSetStaKeyParams->singleTidRc = (tANI_U8)val; |
| 1028 | |
| 1029 | /* Update PE session ID*/ |
| 1030 | pSetStaKeyParams->sessionId = sessionEntry->peSessionId; |
| 1031 | |
| 1032 | /** |
| 1033 | * For WEP - defWEPIdx indicates the default WEP |
| 1034 | * Key to be used for TX |
| 1035 | * For all others, there's just one key that can |
| 1036 | * be used and hence it is assumed that |
| 1037 | * defWEPIdx = 0 (from the caller) |
| 1038 | */ |
| 1039 | |
| 1040 | pSetStaKeyParams->defWEPIdx = defWEPIdx; |
| 1041 | |
| 1042 | /** Store the Previous MlmState*/ |
| 1043 | sessionEntry->limPrevMlmState = sessionEntry->limMlmState; |
| 1044 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 1045 | |
| 1046 | if(sessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE && !pMlmSetKeysReq->key[0].unicast) { |
| 1047 | sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE; |
| 1048 | msgQ.type = WDA_SET_STA_BCASTKEY_REQ; |
| 1049 | }else { |
| 1050 | sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE; |
| 1051 | msgQ.type = WDA_SET_STAKEY_REQ; |
| 1052 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1053 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1054 | |
| 1055 | /** |
| 1056 | * In the Case of WEP_DYNAMIC, ED_TKIP and ED_CCMP |
| 1057 | * the Key[0] contains the KEY, so just copy that alone, |
| 1058 | * for the case of WEP_STATIC the hal gets the key from cfg |
| 1059 | */ |
| 1060 | switch( pMlmSetKeysReq->edType ) { |
| 1061 | case eSIR_ED_WEP40: |
| 1062 | case eSIR_ED_WEP104: |
| 1063 | // FIXME! Is this OK? |
| 1064 | if( 0 == pMlmSetKeysReq->numKeys ) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | tANI_U32 i; |
| 1066 | |
| 1067 | for(i=0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS ;i++) |
| 1068 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1069 | vos_mem_copy( (tANI_U8 *) &pSetStaKeyParams->key[i], |
| 1070 | (tANI_U8 *) &pMlmSetKeysReq->key[i], sizeof( tSirKeys )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1072 | pSetStaKeyParams->wepType = eSIR_WEP_STATIC; |
| 1073 | sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1074 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1075 | }else { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1076 | /*This case the keys are coming from upper layer so need to fill the |
| 1077 | * key at the default wep key index and send to the HAL */ |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1078 | vos_mem_copy((tANI_U8 *) &pSetStaKeyParams->key[defWEPIdx], |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1079 | (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( pMlmSetKeysReq->key[0] )); |
| 1080 | pMlmSetKeysReq->numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | } |
| 1082 | break; |
| 1083 | case eSIR_ED_TKIP: |
| 1084 | case eSIR_ED_CCMP: |
| 1085 | #ifdef FEATURE_WLAN_WAPI |
| 1086 | case eSIR_ED_WPI: |
| 1087 | #endif |
| 1088 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1089 | vos_mem_copy( (tANI_U8 *) &pSetStaKeyParams->key, |
| 1090 | (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( tSirKeys )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1091 | } |
| 1092 | break; |
| 1093 | default: |
| 1094 | break; |
| 1095 | } |
| 1096 | |
| 1097 | |
| 1098 | // |
| 1099 | // FIXME_GEN4 |
| 1100 | // A global counter (dialog token) is required to keep track of |
| 1101 | // all PE <-> HAL communication(s) |
| 1102 | // |
| 1103 | msgQ.reserved = 0; |
| 1104 | msgQ.bodyptr = pSetStaKeyParams; |
| 1105 | msgQ.bodyval = 0; |
| 1106 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1107 | limLog( pMac, LOG1, FL( "Sending WDA_SET_STAKEY_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1108 | MTRACE(macTraceMsgTx(pMac, sessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1109 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1110 | limLog( pMac, LOGE, FL("Posting SET_STAKEY to HAL failed, reason=%X"), retCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1111 | // Respond to SME with LIM_MLM_SETKEYS_CNF |
| 1112 | mlmSetKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 1113 | }else |
| 1114 | return; // Continue after WDA_SET_STAKEY_RSP... |
| 1115 | |
| 1116 | limPostSmeSetKeysCnf( pMac, pMlmSetKeysReq, &mlmSetKeysCnf ); |
| 1117 | } |
| 1118 | |
| 1119 | /** |
| 1120 | * limSendRemoveBssKeyReq() |
| 1121 | * |
| 1122 | *FUNCTION: |
| 1123 | * This function is called from limProcessMlmRemoveReq(), |
| 1124 | * when PE is trying to Remove a Group Key related |
| 1125 | * to a specified encryption type |
| 1126 | * |
| 1127 | *LOGIC: |
| 1128 | * |
| 1129 | *ASSUMPTIONS: |
| 1130 | * NA |
| 1131 | * |
| 1132 | *NOTE: |
| 1133 | * NA |
| 1134 | * |
| 1135 | * @param pMac Pointer to Global MAC structure |
| 1136 | * @param pMlmRemoveKeyReq Pointer to MLM_REMOVEKEY_REQ buffer |
| 1137 | * @return none |
| 1138 | */ |
| 1139 | void limSendRemoveBssKeyReq( tpAniSirGlobal pMac, |
| 1140 | tLimMlmRemoveKeyReq *pMlmRemoveKeyReq, |
| 1141 | tpPESession psessionEntry) |
| 1142 | { |
| 1143 | tSirMsgQ msgQ; |
| 1144 | tpRemoveBssKeyParams pRemoveBssKeyParams = NULL; |
| 1145 | tLimMlmRemoveKeyCnf mlmRemoveKeysCnf; |
| 1146 | tSirRetStatus retCode; |
| 1147 | |
| 1148 | // Package WDA_REMOVE_BSSKEY_REQ message parameters |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1149 | pRemoveBssKeyParams = vos_mem_malloc(sizeof( tRemoveBssKeyParams )); |
| 1150 | if ( NULL == pRemoveBssKeyParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1151 | { |
| 1152 | limLog( pMac, LOGE, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1153 | FL( "Unable to allocate memory during REMOVE_BSSKEY" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1154 | |
| 1155 | // Respond to SME with error code |
| 1156 | mlmRemoveKeysCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1157 | goto end; |
| 1158 | } |
| 1159 | else |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1160 | vos_mem_set( (void *) pRemoveBssKeyParams, |
| 1161 | sizeof( tRemoveBssKeyParams ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1162 | |
| 1163 | // Update the WDA_REMOVE_BSSKEY_REQ parameters |
| 1164 | pRemoveBssKeyParams->bssIdx = psessionEntry->bssIdx; |
| 1165 | pRemoveBssKeyParams->encType = pMlmRemoveKeyReq->edType; |
| 1166 | pRemoveBssKeyParams->keyId = pMlmRemoveKeyReq->keyId; |
| 1167 | pRemoveBssKeyParams->wepType = pMlmRemoveKeyReq->wepType; |
| 1168 | |
| 1169 | /* Update PE session Id*/ |
| 1170 | |
| 1171 | pRemoveBssKeyParams->sessionId = psessionEntry->peSessionId; |
| 1172 | |
| 1173 | msgQ.type = WDA_REMOVE_BSSKEY_REQ; |
| 1174 | // |
| 1175 | // FIXME_GEN4 |
| 1176 | // A global counter (dialog token) is required to keep track of |
| 1177 | // all PE <-> HAL communication(s) |
| 1178 | // |
| 1179 | msgQ.reserved = 0; |
| 1180 | msgQ.bodyptr = pRemoveBssKeyParams; |
| 1181 | msgQ.bodyval = 0; |
| 1182 | |
| 1183 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1184 | FL( "Sending WDA_REMOVE_BSSKEY_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1185 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1186 | |
| 1187 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 1188 | { |
| 1189 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1190 | FL("Posting REMOVE_BSSKEY to HAL failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1191 | retCode ); |
| 1192 | |
| 1193 | // Respond to SME with LIM_MLM_REMOVEKEYS_CNF |
| 1194 | mlmRemoveKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 1195 | } |
| 1196 | else |
| 1197 | return; |
| 1198 | |
| 1199 | end: |
| 1200 | limPostSmeRemoveKeyCnf( pMac, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1201 | psessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1202 | pMlmRemoveKeyReq, |
| 1203 | &mlmRemoveKeysCnf ); |
| 1204 | |
| 1205 | } |
| 1206 | |
| 1207 | /** |
| 1208 | * limSendRemoveStaKeyReq() |
| 1209 | * |
| 1210 | *FUNCTION: |
| 1211 | * This function is called from limProcessMlmRemoveKeysReq(), |
| 1212 | * when PE is trying to setup the Unicast Keys related |
| 1213 | * to a specified STA with specified encryption type |
| 1214 | * |
| 1215 | *LOGIC: |
| 1216 | * |
| 1217 | *ASSUMPTIONS: |
| 1218 | * NA |
| 1219 | * |
| 1220 | *NOTE: |
| 1221 | * NA |
| 1222 | * |
| 1223 | * @param pMac Pointer to Global MAC structure |
| 1224 | * @param pMlmRemoveKeysReq Pointer to MLM_REMOVEKEYS_REQ buffer |
| 1225 | * @param staIdx STA index for which the keys are being set |
| 1226 | * @return none |
| 1227 | */ |
| 1228 | void limSendRemoveStaKeyReq( tpAniSirGlobal pMac, |
| 1229 | tLimMlmRemoveKeyReq *pMlmRemoveKeyReq, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1230 | tANI_U16 staIdx, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1231 | tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1232 | { |
| 1233 | tSirMsgQ msgQ; |
| 1234 | tpRemoveStaKeyParams pRemoveStaKeyParams = NULL; |
| 1235 | tLimMlmRemoveKeyCnf mlmRemoveKeyCnf; |
| 1236 | tSirRetStatus retCode; |
| 1237 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1238 | pRemoveStaKeyParams = vos_mem_malloc(sizeof( tRemoveStaKeyParams )); |
| 1239 | if ( NULL == pRemoveStaKeyParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | { |
| 1241 | limLog( pMac, LOGE, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1242 | FL( "Unable to allocate memory during REMOVE_STAKEY" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1243 | |
| 1244 | // Respond to SME with error code |
| 1245 | mlmRemoveKeyCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1246 | goto end; |
| 1247 | } |
| 1248 | else |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1249 | vos_mem_set( (void *) pRemoveStaKeyParams, |
| 1250 | sizeof( tRemoveStaKeyParams ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1251 | |
| 1252 | if( (pMlmRemoveKeyReq->edType == eSIR_ED_WEP104 || pMlmRemoveKeyReq->edType == eSIR_ED_WEP40) && |
| 1253 | pMlmRemoveKeyReq->wepType == eSIR_WEP_STATIC ) |
| 1254 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1255 | PELOGE(limLog(pMac, LOGE, FL("Request to remove static WEP keys through station interface\n Should use BSS interface"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1256 | mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1257 | goto end; |
| 1258 | } |
Jeff Johnson | 2e77e8c | 2013-04-03 15:10:02 -0700 | [diff] [blame] | 1259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1260 | // Update the WDA_REMOVEKEY_REQ parameters |
| 1261 | pRemoveStaKeyParams->staIdx = staIdx; |
| 1262 | pRemoveStaKeyParams->encType = pMlmRemoveKeyReq->edType; |
| 1263 | pRemoveStaKeyParams->keyId = pMlmRemoveKeyReq->keyId; |
| 1264 | pRemoveStaKeyParams->unicast = pMlmRemoveKeyReq->unicast; |
| 1265 | |
| 1266 | /* Update PE session ID*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1267 | pRemoveStaKeyParams->sessionId = psessionEntry->peSessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | |
| 1269 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | 2e77e8c | 2013-04-03 15:10:02 -0700 | [diff] [blame] | 1270 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1271 | msgQ.type = WDA_REMOVE_STAKEY_REQ; |
| 1272 | // |
| 1273 | // FIXME_GEN4 |
| 1274 | // A global counter (dialog token) is required to keep track of |
| 1275 | // all PE <-> HAL communication(s) |
| 1276 | // |
| 1277 | msgQ.reserved = 0; |
| 1278 | msgQ.bodyptr = pRemoveStaKeyParams; |
| 1279 | msgQ.bodyval = 0; |
| 1280 | |
| 1281 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1282 | FL( "Sending WDA_REMOVE_STAKEY_REQ..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1283 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 2e77e8c | 2013-04-03 15:10:02 -0700 | [diff] [blame] | 1284 | retCode = wdaPostCtrlMsg( pMac, &msgQ ); |
| 1285 | if (eSIR_SUCCESS != retCode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1286 | { |
| 1287 | limLog( pMac, LOGE, |
Jeff Johnson | 2e77e8c | 2013-04-03 15:10:02 -0700 | [diff] [blame] | 1288 | FL("Posting REMOVE_STAKEY to HAL failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1289 | retCode ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1290 | vos_mem_free(pRemoveStaKeyParams); |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1291 | pRemoveStaKeyParams = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1292 | |
| 1293 | // Respond to SME with LIM_MLM_REMOVEKEY_CNF |
| 1294 | mlmRemoveKeyCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 1295 | } |
| 1296 | else |
Jeff Johnson | 2e77e8c | 2013-04-03 15:10:02 -0700 | [diff] [blame] | 1297 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1298 | |
| 1299 | end: |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1300 | if (pRemoveStaKeyParams) |
| 1301 | { |
Kiet Lam | 842c3e1 | 2013-11-16 22:40:57 +0530 | [diff] [blame^] | 1302 | vos_mem_free(pRemoveStaKeyParams); |
Kiran Kumar Lokere | fdf4241 | 2013-07-17 17:40:58 -0700 | [diff] [blame] | 1303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1304 | limPostSmeRemoveKeyCnf( pMac, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1305 | psessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1306 | pMlmRemoveKeyReq, |
| 1307 | &mlmRemoveKeyCnf ); |
| 1308 | |
| 1309 | } |
| 1310 | |
| 1311 | |