1 /** \file admCtrlWpa2.h 2 * \brief Admission control header file for WPA2 3 * 4 * \see admCtrl.c and admCtrlWpa2.c 5 */ 6 /**************************************************************************** 7 **+-----------------------------------------------------------------------+** 8 **| |** 9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |** 10 **| All rights reserved. |** 11 **| |** 12 **| Redistribution and use in source and binary forms, with or without |** 13 **| modification, are permitted provided that the following conditions |** 14 **| are met: |** 15 **| |** 16 **| * Redistributions of source code must retain the above copyright |** 17 **| notice, this list of conditions and the following disclaimer. |** 18 **| * Redistributions in binary form must reproduce the above copyright |** 19 **| notice, this list of conditions and the following disclaimer in |** 20 **| the documentation and/or other materials provided with the |** 21 **| distribution. |** 22 **| * Neither the name Texas Instruments nor the names of its |** 23 **| contributors may be used to endorse or promote products derived |** 24 **| from this software without specific prior written permission. |** 25 **| |** 26 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |** 27 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |** 28 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |** 29 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |** 30 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |** 31 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |** 32 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |** 33 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |** 34 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |** 35 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |** 36 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |** 37 **| |** 38 **+-----------------------------------------------------------------------+** 39 ****************************************************************************/ 40 41 /**************************************************************************** 42 * * 43 * MODULE: Admission Control * 44 * PURPOSE: Admission Control Header file for WPA2 * 45 * * 46 ****************************************************************************/ 47 48 #ifndef _ADM_CTRL_WPA2_H_ 49 #define _ADM_CTRL_WPA2_H_ 50 51 52 /* Constants */ 53 54 /* Enumerations */ 55 56 /* Typedefs */ 57 58 /* WPA2 configuration parameters: */ 59 /* defined here only for debugging purposes; should be moved from here */ 60 61 #define WPA2_PRE_AUTHENTICATION_SUPPORT 1 62 #define WPA2_PMKID_CACHE_SIZE 32 63 #define WPA2_CANDIDATE_LIST_MAX_SIZE 16 64 65 /* RSN admission control prototypes */ 66 67 68 /* Structures */ 69 70 71 72 #define MAX_WPA2_UNICAST_SUITES (RSN_CIPHER_WEP104+1) 73 #define MAX_WPA2_KEY_MNG_SUITES (RSN_KEY_MNG_EXC+1) 74 75 /* Cipher suites for group key sent in RSN IE are: WEP40, WEP104, TKIP, CCCMP */ 76 #define GRP_CIPHER_MAXNO_IN_RSNIE 4 77 78 /* Cipher suites for unicast key sent in RSN IE are TKIP, CCMP, "use Group key"*/ 79 #define UNICAST_CIPHER_MAXNO_IN_RSNIE 3 80 81 /* OUIs for cipher suites and appropriated values of cipherSuite_e (paramout.h file) 82 * 83 * 00-0F-AC-0 Use group cipher suite RSN_CIPHER_NONE 84 * 00-0F-AC-1 WEP-40 RSN_CIPHER_WEP 85 * 00-0F-AC-2 TKIP RSN_CIPHER_TKIP 86 * 00-0F-AC-3 Reserved RSN_CIPHER_WRAP not used for WPA2 87 * 00-0F-AC-4 4 RSN_CIPHER_CCMP 88 * 00-0F-AC-5 WEP-104 RSN_CIPHER_WEP104 89 * 00-0F-AC 6 reserved 6 to 255 RSN_CIPHER_CKIP - not used for WPA2 90 * 91 */ 92 93 /* Key management suites (Authentication and Key Management Protocol - AKMP) */ 94 /* received in RSN IE */ 95 #define KEY_MGMT_SUITE_MAXNO_IN_RSN_IE 2 96 97 /* OUIs for key management 98 * 99 * 00-0F-AC-00 Reserved 100 * 00-0F-AC-01 802.1X 101 * 00-0F-AC-02 PSK 102 * 00-0F-AC-03 reserved from 3 to 255 103 */ 104 105 /* WPA2 key management suites */ 106 #define WPA2_IE_KEY_MNG_NONE 0 107 #define WPA2_IE_KEY_MNG_801_1X 1 108 #define WPA2_IE_KEY_MNG_PSK_801_1X 2 109 #define WPA2_IE_KEY_MNG_CCKM 3 110 #define WPA2_IE_KEY_MNG_NA 4 111 112 113 #define WPA2_OUI_MAX_VERSION 0x1 114 #define WPA2_OUI_DEF_TYPE 0x1 115 #define WPA2_OUI_MAX_TYPE 0x2 116 117 #define WPA2_PRE_AUTH_CAPABILITY_MASK 0x0001 /* bit 0 */ 118 #define WPA2_PRE_AUTH_CAPABILITY_SHIFT 0 119 #define WPA2_GROUP_4_UNICAST_CAPABILITY_MASK 0x0002 /* bit 1 No Pairwise */ 120 #define WPA2_GROUP_4_UNICAST_CAPABILITY_SHIFT 1 121 #define WPA2_PTK_REPLAY_COUNTERS_CAPABILITY_MASK 0x000c /* bit 2 and 3 */ 122 #define WPA2_PTK_REPLAY_COUNTERS_CAPABILITY_SHIFT 2 123 #define WPA2_GTK_REPLAY_COUNTERS_CAPABILITY_MASK 0x0030 /* bit 4 and 5 */ 124 #define WPA2_GTK_REPLAY_COUNTERS_CAPABILITY_SHIFT 4 125 /* bit 6 - 15 - reserved */ 126 #define WPA2_IE_MIN_LENGTH 4 127 #define WPA2_IE_GROUP_SUITE_LENGTH 8 128 #define WPA2_IE_MIN_PAIRWISE_SUITE_LENGTH 14 129 #define WPA2_IE_MIN_DEFAULT_LENGTH 24 130 #define WPA2_IE_MIN_KEY_MNG_SUITE_LENGTH(pairwiseCnt) (10+4*pairwiseCnt) 131 132 133 134 135 /* WPA2 IE (RSN IE) packet structure */ 136 /* This structure is used for outgoing packets, i.e. for association request */ 137 /* For incoming packets (Beacon and Probe response from an AP) stucture of */ 138 /* dot11_RSN_t type is used as more common stucture */ 139 PACKED_STRUCT( wpa2IePacket_t, 140 141 UINT8 elementid; /* WPA2 IE (RSN IE) id is 0x30 */ 142 UINT8 length; 143 UINT16 version; 144 UINT8 groupSuite[4]; /* OUI for broadcast suite */ 145 UINT16 pairwiseSuiteCnt; 146 UINT8 pairwiseSuite[4]; /* OUI for 1 unicast suite */ 147 UINT16 authKeyMngSuiteCnt; 148 UINT8 authKeyMngSuite[4]; /* OUI for 1 key mgmt suite */ 149 UINT16 capabilities; 150 UINT16 pmkIdCnt; /* only one PMKID is supported per AP */ 151 UINT8 pmkId[PMKID_VALUE_SIZE]; 152 ); 153 154 155 /* WPA2 data parsed from RSN info element */ 156 typedef struct 157 { 158 159 cipherSuite_e broadcastSuite; 160 UINT16 unicastSuiteCnt; 161 cipherSuite_e unicastSuite[MAX_WPA2_UNICAST_SUITES]; 162 UINT16 KeyMngSuiteCnt; 163 UINT8 KeyMngSuite[MAX_WPA2_KEY_MNG_SUITES]; 164 UINT8 preAuthentication; 165 UINT8 bcastForUnicatst; 166 UINT8 ptkReplayCounters; 167 UINT8 gtkReplayCounters; 168 UINT16 pmkIdCnt; 169 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, UINT8 *pIe, UINT8 *pLength); 183 184 TI_STATUS admCtrlWpa2_setSite(admCtrl_t *pAdmCtrl, rsnData_t *pRsnData, UINT8 *pAssocIe, UINT8 *pAssocIeLen); 185 186 TI_STATUS admCtrlWpa2_evalSite(admCtrl_t *pAdmCtrl, rsnData_t *pRsnData, bssType_e bssType, UINT32 *pEvaluation); 187 188 void admCtrlWpa2_preAuthTimerExpire(TI_HANDLE hadmCtrl); 189 190 #endif /* _ADM_CTRL_WPA_H_*/ 191