1/* 2 * admCtrl.c 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34/** \file admCtrl.c 35 * \brief Admission control API implimentation 36 * 37 * \see admCtrl.h 38 */ 39 40/**************************************************************************** 41 * * 42 * MODULE: Admission Control * 43 * PURPOSE: Admission Control Module API * 44 * * 45 ****************************************************************************/ 46 47#define __FILE_ID__ FILE_ID_16 48#include "osApi.h" 49#include "paramOut.h" 50#include "timer.h" 51#include "fsm.h" 52#include "report.h" 53#include "mlmeApi.h" 54#include "DataCtrl_Api.h" 55#include "TI_IPC_Api.h" 56#include "rsn.h" 57#include "admCtrl.h" 58#include "admCtrlWpa.h" 59#include "admCtrlWpa2.h" 60#include "admCtrlNone.h" 61#include "admCtrlWep.h" 62#include "EvHandler.h" 63 64/* Constants */ 65 66/* Enumerations */ 67 68/* Typedefs */ 69 70/* Structures */ 71 72/* External data definitions */ 73 74/* Local functions definitions */ 75 76/* Global variables */ 77 78/* Function prototypes */ 79 80TI_STATUS admCtrl_setAuthSuite(admCtrl_t *pAdmCtrl, EAuthSuite authSuite); 81 82TI_STATUS admCtrl_getAuthSuite(admCtrl_t *pAdmCtrl, EAuthSuite *pSuite); 83 84TI_STATUS admCtrl_setNetworkMode(admCtrl_t *pAdmCtrl, ERsnNetworkMode mode); 85 86TI_STATUS admCtrl_setExtAuthMode(admCtrl_t *pAdmCtrl, EExternalAuthMode extAuthMode); 87 88TI_STATUS admCtrl_getExtAuthMode(admCtrl_t *pAdmCtrl, EExternalAuthMode *pExtAuthMode); 89 90TI_STATUS admCtrl_setUcastSuite(admCtrl_t *pAdmCtrl, ECipherSuite suite); 91 92TI_STATUS admCtrl_setBcastSuite(admCtrl_t *pAdmCtrl, ECipherSuite suite); 93 94TI_STATUS admCtrl_getCipherSuite(admCtrl_t *pAdmCtrl, ECipherSuite *pSuite); 95 96TI_STATUS admCtrl_setKeyMngSuite(admCtrl_t *pAdmCtrl, ERsnKeyMngSuite suite); 97 98TI_STATUS admCtrl_getMixedMode(admCtrl_t *pAdmCtrl, TI_BOOL *pMixedMode); 99 100TI_STATUS admCtrl_setMixedMode(admCtrl_t *pAdmCtrl, TI_BOOL mixedMode); 101 102TI_STATUS admCtrl_getAuthEncrCapability(admCtrl_t *pAdmCtrl, 103 rsnAuthEncrCapability_t *authEncrCapability); 104 105TI_STATUS admCtrl_getPromoteFlags(admCtrl_t *pAdmCtrl, TI_UINT32 *WPAPromoteFlags); 106 107TI_STATUS admCtrl_setPromoteFlags(admCtrl_t *pAdmCtrl, TI_UINT32 WPAPromoteFlags); 108 109TI_STATUS admCtrl_getWPAMixedModeSupport(admCtrl_t *pAdmCtrl, TI_UINT32 *support); 110 111TI_STATUS admCtrl_checkSetSuite(admCtrl_t *pAdmCtrl, ECipherSuite suite, TI_BOOL Broadcast); 112 113#ifdef XCC_MODULE_INCLUDED 114TI_STATUS admCtrl_setNetworkEap(admCtrl_t *pAdmCtrl, OS_XCC_NETWORK_EAP networkEap); 115 116TI_STATUS admCtrl_getNetworkEap(admCtrl_t *pAdmCtrl, OS_XCC_NETWORK_EAP *networkEap); 117#endif 118 119/** 120* 121* admCtrl_create 122* 123* \b Description: 124* 125* Create the admission control context. 126* 127* \b ARGS: 128* 129* I - role - admission cotrol role (AP or Station) \n 130* I - authSuite - authentication suite to work with \n 131* 132* \b RETURNS: 133* 134* TI_OK on success, TI_NOK on failure. 135* 136* \sa 137*/ 138admCtrl_t* admCtrl_create(TI_HANDLE hOs) 139{ 140 admCtrl_t *pHandle; 141 142 /* allocate rsniation context memory */ 143 pHandle = (admCtrl_t*)os_memoryAlloc(hOs, sizeof(admCtrl_t)); 144 if (pHandle == NULL) 145 { 146 return NULL; 147 } 148 149 os_memoryZero(hOs, pHandle, sizeof(admCtrl_t)); 150 151 pHandle->hOs = hOs; 152 153 return pHandle; 154} 155 156/** 157* 158* admCtrl_unload 159* 160* \b Description: 161* 162* Unload admission control module from memory 163* 164* \b ARGS: 165* 166* I - hAdmCtrl - Admossion control context \n 167* 168* \b RETURNS: 169* 170* TI_OK if successful, TI_NOK otherwise. 171* 172* \sa admCtrl_create 173*/ 174TI_STATUS admCtrl_unload (admCtrl_t *pAdmCtrl) 175{ 176 if (pAdmCtrl == NULL) 177 { 178 return TI_NOK; 179 } 180 181 /* Destroy the wpa2 pre-authentication timer and free the module's memory */ 182 if (pAdmCtrl->hPreAuthTimerWpa2) 183 { 184 tmr_DestroyTimer (pAdmCtrl->hPreAuthTimerWpa2); 185 } 186 os_memoryFree (pAdmCtrl->hOs, pAdmCtrl, sizeof(admCtrl_t)); 187 188 return TI_OK; 189} 190 191/** 192* 193* admCtrl_config 194* 195* \b Description: 196* 197* Configure the admission control module. 198* 199* \b ARGS: 200* 201* I - role - admission cotrol role (AP or Station) \n 202* I - authSuite - authentication suite to work with \n 203* 204* \b RETURNS: 205* 206* TI_OK on success, TI_NOK on failure. 207* 208* \sa 209*/ 210TI_STATUS admCtrl_config (TI_HANDLE hAdmCtrl, 211 TI_HANDLE hMlme, 212 TI_HANDLE hRx, 213 TI_HANDLE hReport, 214 TI_HANDLE hOs, 215 struct _rsn_t *pRsn, 216 TI_HANDLE hXCCMngr, 217 TI_HANDLE hPowerMgr, 218 TI_HANDLE hEvHandler, 219 TI_HANDLE hTimer, 220 TI_HANDLE hCurrBss, 221 TRsnInitParams *pInitParam) 222{ 223 admCtrl_t *pAdmCtrl; 224 TI_STATUS status; 225 226 if (hAdmCtrl == NULL) 227 { 228 return TI_NOK; 229 } 230 231 pAdmCtrl = (admCtrl_t*)hAdmCtrl; 232 233 pAdmCtrl->pRsn = pRsn; 234 pAdmCtrl->hMlme = hMlme; 235 pAdmCtrl->hRx = hRx; 236 pAdmCtrl->hReport = hReport; 237 pAdmCtrl->hOs = hOs; 238 pAdmCtrl->hXCCMngr = hXCCMngr; 239 pAdmCtrl->hPowerMgr = hPowerMgr; 240 pAdmCtrl->hEvHandler = hEvHandler; 241 pAdmCtrl->hTimer = hTimer; 242 pAdmCtrl->hCurrBss = hCurrBss; 243 244 /* Initialize admission control parameters */ 245 pAdmCtrl->role = RSN_PAE_SUPP; 246 pAdmCtrl->networkMode = RSN_INFRASTRUCTURE; 247 pAdmCtrl->authSuite = pInitParam->authSuite; 248 pAdmCtrl->externalAuthMode = pInitParam->externalAuthMode; 249 pAdmCtrl->mixedMode = pInitParam->mixedMode; 250 251 if (pInitParam->privacyOn) 252 { 253 pAdmCtrl->broadcastSuite = TWD_CIPHER_WEP; 254 pAdmCtrl->unicastSuite = TWD_CIPHER_WEP; 255 } else { 256 pAdmCtrl->broadcastSuite = TWD_CIPHER_NONE; 257 pAdmCtrl->unicastSuite = TWD_CIPHER_NONE; 258 } 259 260 pAdmCtrl->preAuthSupport = pInitParam->preAuthSupport; 261 pAdmCtrl->preAuthTimeout = pInitParam->preAuthTimeout; 262 pAdmCtrl->WPAMixedModeEnable = pInitParam->WPAMixedModeEnable; 263 /*pAdmCtrl->PMKIDCandListDelay = pInitParam->PMKIDCandListDelay;*/ 264 pAdmCtrl->MaxNumOfPMKIDs = PMKID_MAX_NUMBER; 265 266 /* Initialize admission control member functions */ 267 pAdmCtrl->setAuthSuite = admCtrl_setAuthSuite; 268 pAdmCtrl->setNetworkMode = admCtrl_setNetworkMode; 269 pAdmCtrl->getAuthSuite = admCtrl_getAuthSuite; 270 pAdmCtrl->setExtAuthMode = admCtrl_setExtAuthMode; 271 pAdmCtrl->getExtAuthMode = admCtrl_getExtAuthMode; 272 pAdmCtrl->setUcastSuite = admCtrl_setUcastSuite; 273 pAdmCtrl->setBcastSuite = admCtrl_setBcastSuite; 274 pAdmCtrl->getCipherSuite = admCtrl_getCipherSuite; 275 pAdmCtrl->setKeyMngSuite = admCtrl_setKeyMngSuite; 276 pAdmCtrl->getMixedMode = admCtrl_getMixedMode; 277 pAdmCtrl->setMixedMode = admCtrl_setMixedMode; 278 pAdmCtrl->getAuthEncrCap = admCtrl_getAuthEncrCapability; 279 pAdmCtrl->getPmkidList = admCtrl_nullGetPMKIDlist; 280 pAdmCtrl->setPmkidList = admCtrl_nullSetPMKIDlist; 281 pAdmCtrl->resetPmkidList = admCtrl_resetPMKIDlist; 282 pAdmCtrl->getPromoteFlags = admCtrl_getPromoteFlags; 283 pAdmCtrl->setPromoteFlags = admCtrl_setPromoteFlags; 284 pAdmCtrl->getWPAMixedModeSupport = admCtrl_getWPAMixedModeSupport; 285#ifdef XCC_MODULE_INCLUDED 286 pAdmCtrl->setNetworkEap = admCtrl_setNetworkEap; 287 pAdmCtrl->getNetworkEap = admCtrl_getNetworkEap; 288 pAdmCtrl->networkEapMode = OS_XCC_NETWORK_EAP_OFF; 289#endif 290 291 pAdmCtrl->getPreAuthStatus = admCtrl_nullGetPreAuthStatus; 292 pAdmCtrl->startPreAuth = admCtrl_nullStartPreAuth; 293 pAdmCtrl->get802_1x_AkmExists = admCtrl_nullGet802_1x_AkmExists; 294 /* Zero number of sent wpa2 preauthentication candidates */ 295 pAdmCtrl->numberOfPreAuthCandidates = 0; 296 297 /* Create hPreAuthTimerWpa2 timer */ 298 pAdmCtrl->hPreAuthTimerWpa2 = tmr_CreateTimer (pAdmCtrl->hTimer); 299 if (pAdmCtrl->hPreAuthTimerWpa2 == NULL) 300 { 301 TRACE0(pAdmCtrl->hReport, REPORT_SEVERITY_ERROR , "admCtrl_config(): Failed to create hPreAuthTimerWpa2!\n"); 302 } 303 304 status = admCtrl_subConfig(pAdmCtrl); 305 306 return status; 307} 308 309/** 310* 311* admCtrl_subConfig 312* 313* \b Description: 314* 315* Configure the admission control module according to the Privacy Mode. 316* 317* \b ARGS: 318* 319* I - pAdmCtrl - pointer to admission cotrol context \n 320* 321* \b RETURNS: 322* 323* TI_OK on success, TI_NOK on failure. 324* 325* \sa 326*/ 327TI_STATUS admCtrl_subConfig(TI_HANDLE hAdmCtrl) 328 329{ 330 admCtrl_t* pAdmCtrl = (admCtrl_t*)hAdmCtrl; 331 TI_STATUS status; 332 333 switch(pAdmCtrl->externalAuthMode) 334 { 335 case RSN_EXT_AUTH_MODE_WPA: 336 case RSN_EXT_AUTH_MODE_WPAPSK: 337 case RSN_EXT_AUTH_MODE_WPANONE: 338 status = admCtrlWpa_config(pAdmCtrl); 339 break; 340 341 case RSN_EXT_AUTH_MODE_WPA2: 342 case RSN_EXT_AUTH_MODE_WPA2PSK: 343 status = admCtrlWpa2_config(pAdmCtrl); 344 break; 345 346 default: 347 if(pAdmCtrl->unicastSuite==TWD_CIPHER_NONE) 348 { 349 status = admCtrlNone_config(pAdmCtrl); 350 } 351 else 352 { 353 status = admCtrlWep_config(pAdmCtrl); 354 } 355 break; 356 357 } 358 359 return status; 360 361} 362 363/** 364* 365* admCtrl_setNetworkMode - Change current network mode. 366* 367* \b Description: 368* 369* Change current network mode. 370* 371* \b ARGS: 372* 373* I - pAdmCtrl - context \n 374* I - mode - network association mode (Infustrucure/IBSS) \n 375* 376* \b RETURNS: 377* 378* TI_OK on success, TI_NOK on failure. 379* 380* \sa 381*/ 382TI_STATUS admCtrl_setNetworkMode(admCtrl_t *pAdmCtrl, ERsnNetworkMode mode) 383{ 384 pAdmCtrl->networkMode = mode; 385 386 return TI_OK; 387} 388 389/** 390* 391* admCtrl_setAuthSuite - Change current authentication suite. 392* 393* \b Description: 394* 395* Change current authentication suite. 396* 397* \b ARGS: 398* 399* I - pAdmCtrl - context \n 400* I - authSuite - authentication suite to work with \n 401* 402* \b RETURNS: 403* 404* TI_OK on success, TI_NOK on failure. 405* 406* \sa 407*/ 408TI_STATUS admCtrl_setAuthSuite(admCtrl_t *pAdmCtrl, EAuthSuite authSuite) 409{ 410 TI_STATUS status = TI_NOK; 411 412 if (pAdmCtrl == NULL) 413 { 414 return TI_NOK; 415 } 416 417 if (pAdmCtrl->authSuite == authSuite) 418 { 419 return TI_OK; 420 } 421 422 if (pAdmCtrl->authSuite > RSN_AUTH_AUTO_SWITCH) 423 { 424 return TI_NOK; 425 } 426 pAdmCtrl->externalAuthMode = (EExternalAuthMode)authSuite; 427 pAdmCtrl->authSuite = authSuite; 428 status = admCtrl_subConfig(pAdmCtrl); 429 return status; 430} 431 432 433/** 434* 435* admCtrl_getAuthSuite - Get current authentication suite. 436* 437* \b Description: 438* 439* Get current authentication suite. 440* 441* \b ARGS: 442* 443* I - pAdmCtrl - context \n 444* O - suite - key management suite to work with \n 445* 446* \b RETURNS: 447* 448* TI_OK on success, TI_NOK on failure. 449* 450* \sa 451*/ 452TI_STATUS admCtrl_getAuthSuite(admCtrl_t *pAdmCtrl, EAuthSuite *pSuite) 453{ 454 if (pAdmCtrl == NULL) 455 { 456 return TI_NOK; 457 } 458 459 *pSuite = pAdmCtrl->authSuite; 460 461 return TI_OK; 462} 463 464/** 465* 466* admCtrl_setExtAuthMode - Set current External authentication Mode Status. 467* 468* \b Description: 469* 470* Set current External authentication Mode Status. 471* 472* \b ARGS: 473* 474* I - pAdmCtrl - context \n 475* I - extAuthMode - External authentication Mode \n 476* 477* \b RETURNS: 478* 479* TI_OK on success, TI_NOK on failure. 480* 481* \sa 482*/ 483TI_STATUS admCtrl_setExtAuthMode(admCtrl_t *pAdmCtrl, EExternalAuthMode extAuthMode) 484{ 485 486 if (extAuthMode >= RSN_EXT_AUTH_MODEMAX) 487 { 488 return TI_NOK; 489 } 490 491 492 if (pAdmCtrl->externalAuthMode == extAuthMode) 493 { 494 return TI_OK; 495 } 496 pAdmCtrl->externalAuthMode = extAuthMode; 497 if (extAuthMode <= RSN_EXT_AUTH_MODE_AUTO_SWITCH) 498 { 499 pAdmCtrl->authSuite = (EAuthSuite)extAuthMode; 500 } 501 else 502 { 503 pAdmCtrl->authSuite = RSN_AUTH_OPEN; 504 } 505 506 return (admCtrl_subConfig(pAdmCtrl)); 507} 508 509/** 510* 511* admCtrl_getExtAuthMode - Get current External authentication Mode Status. 512* 513* \b Description: 514* 515* Get current External Mode Status. 516* 517* \b ARGS: 518* 519* I - pAdmCtrl - context \n 520* I - pExtAuthMode - XCC External Mode Status \n 521* 522* \b RETURNS: 523* 524* TI_OK on success, TI_NOK on failure. 525* 526* \sa 527*/ 528TI_STATUS admCtrl_getExtAuthMode(admCtrl_t *pAdmCtrl, EExternalAuthMode *pExtAuthMode) 529{ 530 *pExtAuthMode = pAdmCtrl->externalAuthMode; 531 532 return TI_OK; 533} 534 535 536/** 537* 538* admCtrl_checkSetSuite - 539* 540* \b Description: 541* 542* Check the validity/support of the cipher suite according to 543* the admission control parameters 544* 545* \b ARGS: 546* 547* I - pAdmCtrl - context \n 548* I - suite - cipher suite to check \n 549* 550* \b RETURNS: 551* 552* TI_OK on success, TI_NOK on failure. 553* 554* \sa 555*/ 556TI_STATUS admCtrl_checkSetSuite(admCtrl_t *pAdmCtrl, ECipherSuite suite, TI_BOOL Broadcast) 557{ 558 if (pAdmCtrl->externalAuthMode<=RSN_EXT_AUTH_MODE_AUTO_SWITCH) 559 { 560 if ((suite==TWD_CIPHER_NONE) || (suite==TWD_CIPHER_WEP) || (suite==TWD_CIPHER_WEP104)) 561 { 562 return TI_OK; 563 } 564#ifdef GEM_SUPPORTED 565 else if (suite==TWD_CIPHER_GEM) 566 { 567 return TI_OK; 568 } 569#endif 570 } 571 else 572 { 573 if ((suite==TWD_CIPHER_TKIP) || (suite==TWD_CIPHER_WEP) || 574 (suite==TWD_CIPHER_WEP104) || (suite==TWD_CIPHER_AES_CCMP)) 575 { 576 return TI_OK; 577 } 578#ifdef GEM_SUPPORTED 579 else if (suite==TWD_CIPHER_GEM) 580 { 581 return TI_OK; 582 } 583#endif 584 else if (!Broadcast && (suite==TWD_CIPHER_NONE)) 585 { 586 return TI_OK; 587 } 588 } 589 return TI_NOK; 590} 591 592/** 593* 594* admCtrl_setUcastSuite - Set current unicast cipher suite support. 595* 596* \b Description: 597* 598* Set current unicast cipher suite support. 599* 600* \b ARGS: 601* 602* I - pAdmCtrl - context \n 603* I - suite - cipher suite to work with \n 604* 605* \b RETURNS: 606* 607* TI_OK on success, TI_NOK on failure. 608* 609* \sa 610*/ 611TI_STATUS admCtrl_setUcastSuite(admCtrl_t *pAdmCtrl, ECipherSuite suite) 612{ 613 TI_STATUS status; 614 615 if (suite == pAdmCtrl->unicastSuite) 616 { 617 return TI_OK; 618 } 619 status = admCtrl_checkSetSuite(pAdmCtrl, suite, TI_FALSE); 620 if (status == TI_OK) 621 { 622 pAdmCtrl->unicastSuite = suite; 623 status = admCtrl_subConfig(pAdmCtrl); 624 } 625 626 return status; 627} 628 629/** 630* 631* admCtrl_setBcastSuite - Set current broadcast cipher suite support. 632* 633* \b Description: 634* 635* Set current broadcast cipher suite support. 636* 637* \b ARGS: 638* 639* I - pAdmCtrl - context \n 640* I - suite - cipher suite to work with \n 641* 642* \b RETURNS: 643* 644* TI_OK on success, TI_NOK on failure. 645* 646* \sa 647*/ 648TI_STATUS admCtrl_setBcastSuite(admCtrl_t *pAdmCtrl, ECipherSuite suite) 649{ 650 TI_STATUS status; 651 652 if (suite == pAdmCtrl->broadcastSuite) 653 { 654 return TI_OK; 655 } 656 657 status = admCtrl_checkSetSuite(pAdmCtrl, suite, TI_TRUE); 658 if (status == TI_OK) 659 { 660 pAdmCtrl->broadcastSuite = suite; 661 status = admCtrl_subConfig(pAdmCtrl); 662 } 663 return status; 664 665} 666 667/** 668* 669* admCtrl_getCipherSuite - Set current broadcast cipher suite support. 670* 671* \b Description: 672* 673* Set current broadcast cipher suite support. 674* 675* \b ARGS: 676* 677* I - pAdmCtrl - context \n 678* O - suite - cipher suite to work with \n 679* 680* \b RETURNS: 681* 682* TI_OK on success, TI_NOK on failure. 683* 684* \sa 685*/ 686TI_STATUS admCtrl_getCipherSuite(admCtrl_t *pAdmCtrl, ECipherSuite *pSuite) 687{ 688 if (pAdmCtrl == NULL) 689 { 690 return TI_NOK; 691 } 692 693 *pSuite = (pAdmCtrl->broadcastSuite > pAdmCtrl->unicastSuite) ? pAdmCtrl->broadcastSuite :pAdmCtrl->unicastSuite; 694 695 return TI_OK; 696} 697 698/** 699* 700* admCtrl_setKeyMngSuite - Set current key management suite support. 701* 702* \b Description: 703* 704* Set current key management suite support. 705* 706* \b ARGS: 707* 708* I - pAdmCtrl - context \n 709* I - suite - key management suite to work with \n 710* 711* \b RETURNS: 712* 713* TI_OK on success, TI_NOK on failure. 714* 715* \sa 716*/ 717TI_STATUS admCtrl_setKeyMngSuite(admCtrl_t *pAdmCtrl, ERsnKeyMngSuite suite) 718{ 719 pAdmCtrl->keyMngSuite = suite; 720 721 return TI_OK; 722} 723 724 725/** 726* 727* admCtrl_parseIe - Parse a required information element. 728* 729* \b Description: 730* 731* Parse an Aironet information element. 732* Builds a structure of all the capabilities described in the Aironet IE. 733* We look at Flags field only to determine KP and MIC bits value 734* 735* \b ARGS: 736* 737* I - pAdmCtrl - pointer to admCtrl context 738* I - pAironetIe - pointer to Aironet IE buffer \n 739* O - pAironetData - capabilities structure 740* 741* 742* \b RETURNS: 743* 744* TI_OK on success, TI_NOK on failure. 745* 746* \sa 747*/ 748TI_STATUS admCtrl_parseIe(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 **pIe, TI_UINT8 IeId) 749{ 750 751 dot11_eleHdr_t *eleHdr; 752 TI_INT16 length; 753 TI_UINT8 *pCurIe; 754 755 756 *pIe = NULL; 757 758 if ((pRsnData == NULL) || (pRsnData->ieLen==0)) 759 { 760 return TI_OK; 761 } 762 763 pCurIe = pRsnData->pIe; 764 765 length = pRsnData->ieLen; 766 while (length>0) 767 { 768 eleHdr = (dot11_eleHdr_t*)pCurIe; 769 770 if (length<((*eleHdr)[1] + 2)) 771 { 772 TRACE2(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "admCtrl_parseIe ERROR: pRsnData->ieLen=%d, length=%d\n\n", pRsnData->ieLen,length); 773 return TI_OK; 774 } 775 776 if ((*eleHdr)[0] == IeId) 777 { 778 *pIe = (TI_UINT8*)eleHdr; 779 break; 780 } 781 length -= (*eleHdr)[1] + 2; 782 pCurIe += (*eleHdr)[1] + 2; 783 } 784 return TI_OK; 785} 786 787/** 788* 789* admCtrl_setMixedMode - Set current mixed Mode Status. 790* 791* \b Description: 792* 793* Set current mixed Mode Status. 794* 795* \b ARGS: 796* 797* I - pAdmCtrl - context \n 798* I - authMode - mixed Mode \n 799* 800* \b RETURNS: 801* 802* TI_OK on success, TI_NOK on failure. 803* 804* \sa 805*/ 806TI_STATUS admCtrl_setMixedMode(admCtrl_t *pAdmCtrl, TI_BOOL mixedMode) 807{ 808 809 if (pAdmCtrl->mixedMode == mixedMode) 810 { 811 return TI_OK; 812 } 813 pAdmCtrl->mixedMode = mixedMode; 814 815 return TI_OK; 816} 817 818/** 819* 820* admCtrl_getMixedMode - Get current mixed Mode Status. 821* 822* \b Description: 823* 824* Get current mixed Mode Status. 825* 826* \b ARGS: 827* 828* I - pAdmCtrl - context \n 829* I - pAuthMode - mixed Mode Status \n 830* 831* \b RETURNS: 832* 833* TI_OK on success, TI_NOK on failure. 834* 835* \sa 836*/ 837TI_STATUS admCtrl_getMixedMode(admCtrl_t *pAdmCtrl, TI_BOOL *pMixedMode) 838{ 839 *pMixedMode = pAdmCtrl->mixedMode; 840 841 return TI_OK; 842} 843 844 845 846/* This table presents supported pairs of auth.mode/cipher type */ 847static authEncrPairList_t supportedAuthEncrPairs[MAX_AUTH_ENCR_PAIR] = 848{ 849 {RSN_EXT_AUTH_MODE_OPEN, TWD_CIPHER_NONE}, 850 {RSN_EXT_AUTH_MODE_OPEN, TWD_CIPHER_WEP}, 851 {RSN_EXT_AUTH_MODE_SHARED_KEY, TWD_CIPHER_NONE}, 852 {RSN_EXT_AUTH_MODE_SHARED_KEY, TWD_CIPHER_WEP}, 853 {RSN_EXT_AUTH_MODE_WPA, TWD_CIPHER_TKIP}, 854 {RSN_EXT_AUTH_MODE_WPA, TWD_CIPHER_AES_CCMP}, 855 {RSN_EXT_AUTH_MODE_WPAPSK, TWD_CIPHER_TKIP}, 856 {RSN_EXT_AUTH_MODE_WPAPSK, TWD_CIPHER_AES_CCMP}, 857 {RSN_EXT_AUTH_MODE_WPANONE, TWD_CIPHER_NONE}, /* No encryption in IBSS mode */ 858 {RSN_EXT_AUTH_MODE_WPA2, TWD_CIPHER_TKIP}, 859 {RSN_EXT_AUTH_MODE_WPA2, TWD_CIPHER_AES_CCMP}, 860 {RSN_EXT_AUTH_MODE_WPA2PSK, TWD_CIPHER_TKIP}, 861 {RSN_EXT_AUTH_MODE_WPA2PSK, TWD_CIPHER_AES_CCMP} 862}; 863 864/** 865* 866* admCtrl_getAuthEncrCapability - Get all supported pais of 867* authenticationmode/cipher suite 868* 869* \b Description: 870* 871* Returns all supported pais of authenticationmode/cipher suite 872* 873* \b ARGS: 874* 875* I - pAdmCtrl - context \n 876* I - authEncrCapability - ptr to list of auth.mode/cipher pairs \n 877* 878* \b RETURNS: 879* 880* TI_OK on success, TI_NOK on failure. 881* 882* \sa 883*/ 884 885TI_STATUS admCtrl_getAuthEncrCapability(admCtrl_t *pAdmCtrl, 886 rsnAuthEncrCapability_t *authEncrCapability) 887{ 888 int i = 0; 889 890 if(!authEncrCapability) 891 return TI_NOK; 892 893 /* The current driver code version uses the above hardcoded list */ 894 /* of auth/encr pairs */ 895 896 authEncrCapability->NoOfAuthEncrPairSupported = MAX_AUTH_ENCR_PAIR; 897 authEncrCapability->NoOfPMKIDs = PMKID_MAX_NUMBER; 898 899 TRACE2(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "admCtrl get AuthEncr capability: No. of auth/encr pairs = %d, No of PMKIDs = %d \n", authEncrCapability->NoOfAuthEncrPairSupported, authEncrCapability->NoOfPMKIDs); 900 901 /* Copy the hardcoded table of the auth.mode/cipher type */ 902 for (i = 0; i < MAX_AUTH_ENCR_PAIR; i++) 903 { 904 authEncrCapability->authEncrPairs[i].authenticationMode = 905 supportedAuthEncrPairs[i].authenticationMode; 906 authEncrCapability->authEncrPairs[i].cipherSuite = 907 supportedAuthEncrPairs[i].cipherSuite; 908 909 TRACE3(pAdmCtrl->hReport, REPORT_SEVERITY_INFORMATION, "admCtrl get AuthEncr pair list: i = %d, auth mode = %d , cipher suite = %d \n", i, authEncrCapability->authEncrPairs[i].authenticationMode, authEncrCapability->authEncrPairs[i].cipherSuite); 910 } 911 912 return TI_OK; 913} 914 915 916TI_STATUS admCtrl_nullSetPMKIDlist(admCtrl_t *pAdmCtrl, OS_802_11_PMKID *pmkIdList) 917{ 918 919 return CONFIGURATION_NOT_VALID; 920} 921 922TI_STATUS admCtrl_nullGetPMKIDlist(admCtrl_t *pAdmCtrl, OS_802_11_PMKID *pmkIdList) 923{ 924 925 return CONFIGURATION_NOT_VALID; 926} 927 928 929TI_STATUS admCtrl_resetPMKIDlist(admCtrl_t *pAdmCtrl) 930{ 931 932 os_memoryZero(pAdmCtrl->hOs, (void*)&pAdmCtrl->pmkid_cache, sizeof(pmkid_cache_t)); 933 return TI_OK; 934} 935 936TI_STATUS admCtrl_getWPAMixedModeSupport(admCtrl_t *pAdmCtrl, TI_UINT32 *support) 937{ 938 939 if(pAdmCtrl->WPAMixedModeEnable) 940 *support = ADMCTRL_WPA_OPTION_MAXVALUE; 941 else 942 *support = 0; 943 944 return TI_OK; 945} 946 947TI_STATUS admCtrl_getPromoteFlags(admCtrl_t *pAdmCtrl, TI_UINT32 *WPAPromoteFlags) 948{ 949 *WPAPromoteFlags = pAdmCtrl->WPAPromoteFlags; 950 return TI_OK; 951} 952 953TI_STATUS admCtrl_setPromoteFlags(admCtrl_t *pAdmCtrl, TI_UINT32 WPAPromoteFlags) 954{ 955 if(WPAPromoteFlags > ADMCTRL_WPA_OPTION_MAXVALUE) 956 return TI_NOK; 957 958 if(!pAdmCtrl->WPAMixedModeEnable) 959 return TI_NOK; 960 961 pAdmCtrl->WPAPromoteFlags = WPAPromoteFlags; 962 return TI_OK; 963} 964 965TI_BOOL admCtrl_nullGetPreAuthStatus(admCtrl_t *pAdmCtrl, TMacAddr *givenAP, TI_UINT8 *cacheIndex) 966{ 967 return TI_FALSE; 968} 969 970 971TI_STATUS admCtrl_nullStartPreAuth(admCtrl_t *pAdmCtrl, TBssidList4PreAuth *pBssidList) 972{ 973 return TI_OK; 974} 975 976TI_STATUS admCtrl_nullGet802_1x_AkmExists (admCtrl_t *pAdmCtrl, TI_BOOL *wpa_802_1x_AkmExists) 977{ 978 *wpa_802_1x_AkmExists = TI_FALSE; 979 return TI_OK; 980} 981 982/*----------------------------------------------------------------------------- 983Routine Name: admCtrl_notifyPreAuthStatus 984Routine Description: This routine is used to notify higher level application of the pre-authentication status 985Arguments: newStatus - pre authentication status 986Return Value: 987-----------------------------------------------------------------------------*/ 988void admCtrl_notifyPreAuthStatus (admCtrl_t *pAdmCtrl, preAuthStatusEvent_e newStatus) 989{ 990 TI_UINT32 memBuff; 991 992 memBuff = (TI_UINT32) newStatus; 993 994 EvHandlerSendEvent(pAdmCtrl->hEvHandler, IPC_EVENT_WPA2_PREAUTHENTICATION, 995 (TI_UINT8*)&memBuff, sizeof(TI_UINT32)); 996 997} 998 999#ifdef XCC_MODULE_INCLUDED 1000 1001/** 1002* 1003* admCtrl_setNetworkEap - Set current Network EAP Mode Status. 1004* 1005* \b Description: 1006* 1007* Set current Network EAP Mode Status.. 1008* 1009* \b ARGS: 1010* 1011* I - pAdmCtrl - context \n 1012* I - networkEap - Network EAP Mode \n 1013* 1014* \b RETURNS: 1015* 1016* TI_OK on success, TI_NOK on failure. 1017* 1018* \sa 1019*/ 1020TI_STATUS admCtrl_setNetworkEap(admCtrl_t *pAdmCtrl, OS_XCC_NETWORK_EAP networkEap) 1021{ 1022 if (pAdmCtrl==NULL) 1023 return TI_NOK; 1024 1025 if (pAdmCtrl->networkEapMode == networkEap) 1026 { 1027 return TI_OK; 1028 } 1029 pAdmCtrl->networkEapMode = networkEap; 1030 1031 return TI_OK; 1032} 1033 1034/** 1035* 1036* admCtrl_getNetworkEap - Get current Network EAP Mode Status. 1037* 1038* \b Description: 1039* 1040* Get current Network EAP Mode Status. 1041* 1042* \b ARGS: 1043* 1044* I - pAdmCtrl - context \n 1045* I - networkEap - Network EAP Mode \n 1046* 1047* \b RETURNS: 1048* 1049* TI_OK on success, TI_NOK on failure. 1050* 1051* \sa 1052*/ 1053TI_STATUS admCtrl_getNetworkEap(admCtrl_t *pAdmCtrl, OS_XCC_NETWORK_EAP *networkEap) 1054{ 1055 1056 if (pAdmCtrl==NULL) 1057 { 1058 return TI_NOK; 1059 } 1060 1061 switch (pAdmCtrl->networkEapMode) 1062 { 1063 case OS_XCC_NETWORK_EAP_OFF: 1064 *networkEap = OS_XCC_NETWORK_EAP_OFF; 1065 break; 1066 case OS_XCC_NETWORK_EAP_ON: 1067 case OS_XCC_NETWORK_EAP_ALLOWED: 1068 case OS_XCC_NETWORK_EAP_PREFERRED: 1069 *networkEap = OS_XCC_NETWORK_EAP_ON; 1070 break; 1071 default: 1072 return TI_NOK; 1073/* break; - unreachable */ 1074 } 1075 1076 return TI_OK; 1077} 1078#endif /* XCC_MODULE_INCLUDED*/ 1079 1080