Home | History | Annotate | Download | only in Connection_Managment
      1 /*
      2  * admCtrlWpa2.h
      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 admCtrlWpa2.h
     35  *  \brief Admission control header file for WPA2
     36  *
     37  *  \see admCtrl.c and admCtrlWpa2.c
     38  */
     39 
     40 /****************************************************************************
     41  *                                                                          *
     42  *   MODULE:  Admission Control                                             *
     43  *   PURPOSE: Admission Control Header file for WPA2                        *
     44  *                                                                          *
     45  ****************************************************************************/
     46 
     47 #ifndef _ADM_CTRL_WPA2_H_
     48 #define _ADM_CTRL_WPA2_H_
     49 
     50 
     51 /* Constants */
     52 
     53 /* Enumerations */
     54 
     55 /* Typedefs */
     56 
     57 /* WPA2 configuration parameters:                                       */
     58 /* defined here only for debugging purposes; should be moved from here  */
     59 
     60 #define WPA2_PRE_AUTHENTICATION_SUPPORT 1
     61 #define WPA2_PMKID_CACHE_SIZE           32
     62 #define WPA2_CANDIDATE_LIST_MAX_SIZE    16
     63 
     64 /* RSN admission control prototypes */
     65 
     66 
     67 /* Structures */
     68 
     69 
     70 
     71 #define MAX_WPA2_UNICAST_SUITES     (TWD_CIPHER_WEP104+1)
     72 #define MAX_WPA2_KEY_MNG_SUITES     (RSN_KEY_MNG_XCC+1)
     73 
     74 /* Cipher suites for group key sent in RSN IE are: WEP40, WEP104, TKIP, CCCMP */
     75 #define GRP_CIPHER_MAXNO_IN_RSNIE         4
     76 
     77 /* Cipher suites for unicast key sent in RSN IE are TKIP, CCMP, "use Group key"*/
     78 #define UNICAST_CIPHER_MAXNO_IN_RSNIE     3
     79 
     80 /* OUIs for cipher suites and appropriated values of cipherSuite_e (paramout.h file)
     81  *
     82  *   00-0F-AC-0   Use group cipher suite     RSN_CIPHER_NONE
     83  *   00-0F-AC-1   WEP-40                     RSN_CIPHER_WEP
     84  *   00-0F-AC-2   TKIP                       RSN_CIPHER_TKIP
     85  *   00-0F-AC-3   Reserved                   RSN_CIPHER_WRAP   not used for WPA2
     86  *   00-0F-AC-4   4                          RSN_CIPHER_CCMP
     87  *   00-0F-AC-5   WEP-104                    RSN_CIPHER_WEP104
     88  *   00-0F-AC 6   reserved 6 to 255          RSN_CIPHER_CKIP  - not used for WPA2
     89  *
     90  */
     91 
     92 /* Key management suites (Authentication and Key Management Protocol - AKMP)  */
     93 /* received in RSN IE                                                         */
     94 #define KEY_MGMT_SUITE_MAXNO_IN_RSN_IE  2
     95 
     96 /* OUIs for key management
     97 *
     98 *   00-0F-AC-00  Reserved
     99 *   00-0F-AC-01  802.1X
    100 *   00-0F-AC-02  PSK
    101 *   00-0F-AC-03   reserved from 3 to 255
    102 */
    103 
    104 /* WPA2 key management suites */
    105 #define WPA2_IE_KEY_MNG_NONE             0
    106 #define WPA2_IE_KEY_MNG_801_1X           1
    107 #define WPA2_IE_KEY_MNG_PSK_801_1X       2
    108 #define WPA2_IE_KEY_MNG_CCKM			 3
    109 #define WPA2_IE_KEY_MNG_NA               4
    110 
    111 
    112 #define WPA2_OUI_MAX_VERSION           0x1
    113 #define WPA2_OUI_DEF_TYPE              0x1
    114 #define WPA2_OUI_MAX_TYPE              0x2
    115 
    116 #define WPA2_PRE_AUTH_CAPABILITY_MASK               0x0001   /* bit 0 */
    117 #define WPA2_PRE_AUTH_CAPABILITY_SHIFT              0
    118 #define WPA2_GROUP_4_UNICAST_CAPABILITY_MASK        0x0002   /* bit 1 No Pairwise */
    119 #define WPA2_GROUP_4_UNICAST_CAPABILITY_SHIFT        1
    120 #define WPA2_PTK_REPLAY_COUNTERS_CAPABILITY_MASK    0x000c   /* bit 2 and 3 */
    121 #define WPA2_PTK_REPLAY_COUNTERS_CAPABILITY_SHIFT   2
    122 #define WPA2_GTK_REPLAY_COUNTERS_CAPABILITY_MASK    0x0030   /* bit 4 and 5 */
    123 #define WPA2_GTK_REPLAY_COUNTERS_CAPABILITY_SHIFT   4
    124                                                              /* bit 6 - 15 - reserved */
    125 #define WPA2_IE_MIN_LENGTH                  4
    126 #define WPA2_IE_GROUP_SUITE_LENGTH          8
    127 #define WPA2_IE_MIN_PAIRWISE_SUITE_LENGTH   14
    128 #define WPA2_IE_MIN_DEFAULT_LENGTH          24
    129 #define WPA2_IE_MIN_KEY_MNG_SUITE_LENGTH(pairwiseCnt) (10+4*pairwiseCnt)
    130 
    131 
    132 
    133 
    134 /* WPA2 IE (RSN IE) packet structure                                          */
    135 /* This structure is used for outgoing packets, i.e. for association request  */
    136 /* For incoming packets (Beacon and Probe response from an AP) stucture of    */
    137 /* dot11_RSN_t type is used as more common stucture                           */
    138 typedef struct
    139 {
    140 
    141     TI_UINT8               elementid;           /* WPA2 IE (RSN IE) id is 0x30 */
    142     TI_UINT8               length;
    143     TI_UINT16              version;
    144     TI_UINT8               groupSuite[4];       /* OUI for broadcast suite */
    145     TI_UINT16              pairwiseSuiteCnt;
    146     TI_UINT8               pairwiseSuite[4];    /* OUI for 1 unicast suite */
    147     TI_UINT16              authKeyMngSuiteCnt;
    148     TI_UINT8               authKeyMngSuite[4];  /* OUI for 1 key mgmt suite */
    149     TI_UINT16              capabilities;
    150     TI_UINT16              pmkIdCnt;            /* only one PMKID is supported per AP */
    151     TI_UINT8               pmkId[PMKID_VALUE_SIZE];
    152 } wpa2IePacket_t;
    153 
    154 
    155 /* WPA2 data parsed from RSN info element */
    156 typedef struct
    157 {
    158 
    159     ECipherSuite        broadcastSuite;
    160     TI_UINT16              unicastSuiteCnt;
    161     ECipherSuite        unicastSuite[MAX_WPA2_UNICAST_SUITES];
    162     TI_UINT16              KeyMngSuiteCnt;
    163     TI_UINT8               KeyMngSuite[MAX_WPA2_KEY_MNG_SUITES];
    164     TI_UINT8               preAuthentication;
    165     TI_UINT8               bcastForUnicatst;
    166     TI_UINT8               ptkReplayCounters;
    167     TI_UINT8               gtkReplayCounters;
    168     TI_UINT16              pmkIdCnt;
    169     TI_UINT8               pmkId[PMKID_VALUE_SIZE];
    170 } wpa2IeData_t;
    171 
    172 
    173 
    174 /* External data definitions */
    175 
    176 /* External functions definitions */
    177 
    178 /* Function prototypes */
    179 
    180 TI_STATUS admCtrlWpa2_config(admCtrl_t *pAdmCtrl);
    181 
    182 TI_STATUS admCtrlWpa2_getInfoElement(admCtrl_t *pAdmCtrl, TI_UINT8 *pIe, TI_UINT32 *pLength);
    183 
    184 TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 *pAssocIe, TI_UINT8 *pAssocIeLen);
    185 
    186 TI_STATUS admCtrlWpa2_evalSite(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteParams *pRsnSiteParams, TI_UINT32 *pEvaluation);
    187 
    188 void admCtrlWpa2_preAuthTimerExpire(TI_HANDLE hadmCtrl, TI_BOOL bTwdInitOccured);
    189 
    190 #endif /*  _ADM_CTRL_WPA_H_*/
    191