1 /******************************************************************************* 2 **+--------------------------------------------------------------------------+** 3 **| |** 4 **| Copyright 1998-2008 Texas Instruments, Inc. - http://www.ti.com/ |** 5 **| |** 6 **| Licensed under the Apache License, Version 2.0 (the "License"); |** 7 **| you may not use this file except in compliance with the License. |** 8 **| You may obtain a copy of the License at |** 9 **| |** 10 **| http://www.apache.org/licenses/LICENSE-2.0 |** 11 **| |** 12 **| Unless required by applicable law or agreed to in writing, software |** 13 **| distributed under the License is distributed on an "AS IS" BASIS, |** 14 **| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |** 15 **| See the License for the specific language governing permissions and |** 16 **| limitations under the License. |** 17 **| |** 18 **+--------------------------------------------------------------------------+** 19 *******************************************************************************/ 20 21 /*--------------------------------------------------------------------------*/ 22 /* Module: TI_AdapterSEC.h*/ 23 /**/ 24 /* Purpose: */ 25 /**/ 26 /*--------------------------------------------------------------------------*/ 27 28 #ifndef TI_ADAPTER_SEC_H 29 #define TI_ADAPTER_SEC_H 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /****************************************************************************** 36 37 Name: TI_SetAuthenticationMode 38 Desc: This function sets the system's authentication mode. 39 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 40 uAuthMode - one of: os802_11AuthModeOpen, 41 os802_11AuthModeShared, 42 os802_11AuthModeAutoSwitch, 43 os802_11AuthModeWPA, 44 os802_11AuthModeWPAPSK, 45 os802_11AuthModeWPANone, 46 os802_11AuthModeWPA2, 47 os802_11AuthModeWPA2PSK, 48 Return: TI_RESULT_OK on success. Any other value indicates an error. 49 50 ******************************************************************************/ 51 tiINT32 TI_SetAuthenticationMode (TI_HANDLE hAdapter, 52 OS_802_11_AUTHENTICATION_MODE uAuthMode); 53 54 /****************************************************************************** 55 56 Name: TI_GetAuthenticationMode 57 Desc: This function retrieves the 802.11 authentication mode. 58 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 59 puAuthMode - one of: os802_11AuthModeOpen, 60 os802_11AuthModeShared, 61 os802_11AuthModeAutoSwitch, 62 os802_11AuthModeWPA, 63 os802_11AuthModeWPAPSK, 64 os802_11AuthModeWPANone, 65 os802_11AuthModeWPA2, 66 os802_11AuthModeWPA2PSK, 67 Return: TI_RESULT_OK on success. Any other value indicates an error. 68 69 ******************************************************************************/ 70 tiINT32 TI_GetAuthenticationMode (TI_HANDLE hAdapter, 71 OS_802_11_AUTHENTICATION_MODE* puAutMode); 72 73 74 /****************************************************************************** 75 76 Name: TI_SetCertificateParameters 77 Desc: This function is used for WPA or EXC Certificate configuration. 78 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 79 pData - 80 bValidateServerCert - 81 Return: TI_RESULT_OK on success. Any other value indicates an error. 82 83 ******************************************************************************/ 84 tiINT32 TI_SetCertificateParameters (TI_HANDLE hAdapter, 85 tiVOID* pData, 86 tiBOOL bValidateServerCert ); 87 88 /****************************************************************************** 89 90 Name: TI_SetEAPType 91 Desc: This function sets the current EAP type in the Supplicant. 92 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 93 uEAPType - Contains value of current EAP type from enumeration 94 OS_802_11_EAP_TYPES: 95 OS_EAP_TYPE_NONE = -1, 96 OS_EAP_TYPE_MD5_CHALLENGE = 4, 97 OS_EAP_TYPE_GENERIC_TOKEN_CARD = 6, 98 OS_EAP_TYPE_TLS = 13, 99 OS_EAP_TYPE_LEAP = 17, 100 OS_EAP_TYPE_TTLS = 21, 101 OS_EAP_TYPE_PEAP = 25, 102 OS_EAP_TYPE_MS_CHAP_V2 = 26, 103 OS_EAP_TYPE_FAST = 43 104 Return: TI_RESULT_OK on success. Any other value indicates an error. 105 Note: Under Linux (ASD device): MD5_CHALLENGE, GENERIC_TOKEN_CARD, TTLS, 106 PEAP and MS_CHAP_V2 are not supported. 107 108 ******************************************************************************/ 109 tiINT32 TI_SetEAPType (TI_HANDLE hAdapter, 110 OS_802_11_EAP_TYPES uEAPType ); 111 112 /****************************************************************************** 113 114 Name: TI_GetEAPType 115 Desc: This function retrieves the current EAP type. 116 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 117 puEAPType - Pointer to a OS_802_11_EAP_TYPES value that contains 118 current EAP type 119 Return: TI_RESULT_OK on success. Any other value indicates an error. 120 121 ******************************************************************************/ 122 tiINT32 TI_GetEAPType (TI_HANDLE hAdapter, 123 OS_802_11_EAP_TYPES* puEAPType); 124 125 /****************************************************************************** 126 127 Name: TI_SetEAPTypeDriver 128 Desc: This function sets the current EAP type in the driver. 129 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 130 uEAPType - Contains value of current EAP type from enumeration 131 OS_802_11_EAP_TYPES. 132 Return: TI_RESULT_OK on success. Any other value indicates an error. 133 Note: Under Linux (ASD device): MD5_CHALLENGE, GENERIC_TOKEN_CARD, TTLS, 134 PEAP and MS_CHAP_V2 are not supported. 135 136 ******************************************************************************/ 137 tiINT32 TI_SetEAPTypeDriver (TI_HANDLE hAdapter, 138 OS_802_11_EAP_TYPES uEAPType ); 139 140 141 /****************************************************************************** 142 143 Name: TI_SetEncryptionType 144 Desc: This function sets the Encryption type. This function sets both 145 the driver and the supplicant via an IOCTL. 146 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 147 uEncryptType - Contains value of current encrypt type from enumeration 148 OS_802_11_ENCRYPTION_TYPES: 149 OS_ENCRYPTION_TYPE_NONE = 0, 150 OS_ENCRYPTION_TYPE_WEP, 151 OS_ENCRYPTION_TYPE_TKIP, 152 OS_ENCRYPTION_TYPE_AES, 153 Return: TI_RESULT_OK on success. Any other value indicates an error. 154 155 ******************************************************************************/ 156 tiINT32 TI_SetEncryptionType (TI_HANDLE hAdapter, 157 OS_802_11_ENCRYPTION_TYPES uEncryptType ); 158 159 /****************************************************************************** 160 161 Name: TI_GetEncryptionType 162 Desc: This function retrieves the current encryption type. 163 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 164 puEncryptType - Pointer to a OS_802_11_EAP_TYPES value that contains 165 current encrypt type 166 Return: TI_RESULT_OK on success. Any other value indicates an error. 167 168 ******************************************************************************/ 169 tiINT32 TI_GetEncryptionType (TI_HANDLE hAdapter, 170 OS_802_11_ENCRYPTION_TYPES* puEncryptType); 171 172 /****************************************************************************** 173 174 Name: TI_SetCredentials 175 Desc: This function sets the User Name and Password in the supplicant. 176 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 177 pszUserName - Pointer to a null-terminated string that contains the 178 user name. 179 pszPassword - Pointer to a null-terminated string that contains the 180 password. 181 Return: TI_RESULT_OK on success. Any other value indicates an error. 182 183 ******************************************************************************/ 184 tiINT32 TI_SetCredentials (TI_HANDLE hAdapter, 185 tiCHAR* pszUserName, 186 tiCHAR* pszPassword ); 187 188 /****************************************************************************** 189 190 Name: TI_SetPSK 191 Desc: This function sets the PSK Password Phrase for WPA type encryption 192 in the supplicant. 193 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 194 pszPSK - Pointer to a null-terminated string that contains the PSK 195 password phrase 196 Return: TI_RESULT_OK on success. Any other value indicates an error. 197 198 ******************************************************************************/ 199 tiINT32 TI_SetPSK (TI_HANDLE hAdapter, 200 tiCHAR* pszPSK ); 201 202 /****************************************************************************** 203 204 Name: TI_SetKeyType 205 Desc: This function sets the encryption key type, OS_KEY_TYPE_STATIC uses 206 the regular 802.11 WEP, and OS_KEY_TYPE_DYNAMIC uses 802.1x (WPA) 207 encryption. 208 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 209 uKeyType - Define the security key type: 210 OS_KEY_TYPE_STATIC = 0, 211 OS_KEY_TYPE_DYNAMIC 212 Return: TI_RESULT_OK on success. Any other value indicates an error. 213 214 ******************************************************************************/ 215 tiINT32 TI_SetKeyType (TI_HANDLE hAdapter, 216 OS_802_11_KEY_TYPES uKeyType ); 217 218 219 /****************************************************************************** 220 221 Name: TI_AddWEPKey 222 Desc: This function enables you to add a new static WEP key and to 223 indicate whether the key is the default key. The function should 224 be used only in static key mode. 225 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 226 pWEP - A pointer to an OS_802_11_WEP structure: 227 Length - specifies the length of the OS_802_11_WEP 228 structure in bytes. 229 KeyIndex - specifies which key to add. KeyIndex can be 230 0 to 3. When the most significant bit is set 231 to 1, the key is set as the default key. 232 KeyLength - specifies the length of the KeyMaterial 233 character array in bytes. 234 KeyMaterial - specifies an array that identifies the WEP key. 235 The length of this array is variable. 236 Return: TI_RESULT_OK on success. Any other value indicates an error. 237 238 ******************************************************************************/ 239 tiINT32 TI_AddWEPKey (TI_HANDLE hAdapter, 240 OS_802_11_WEP* pWEP ); 241 242 /****************************************************************************** 243 244 Name: TI_RemoveWEPKey 245 Desc: This function removes a static WEP key. 246 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 247 uKeyIndex - Contains the index of the key to remove. 248 Return: TI_RESULT_OK on success. Any other value indicates an error. 249 250 ******************************************************************************/ 251 tiINT32 TI_RemoveWEPKey (TI_HANDLE hAdapter, 252 tiUINT32 uKeyIndex ); 253 /****************************************************************************** 254 255 Name: TI_GetDefaultWepKey 256 Desc: This function returns the default WEP key as it was previously set by TI_AddWEPKey function. 257 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 258 puKeyIndex - Pointer to the index of the default WEP key. 259 Return: TI_RESULT_OK on success. Any other value indicates an error. 260 261 ******************************************************************************/ 262 tiINT32 TI_GetDefaultWepKey (TI_HANDLE hAdapter, 263 tiUINT32* puKeyIndex ); 264 265 /****************************************************************************** 266 267 Name: TI_SetMixedMode 268 Desc: This function enables the station to connect to an AP with or without 269 WEP. When disabled, only the configured security mode is possible. 270 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 271 bStatus - FALSE for disable, TRUE for enable. 272 Return: TI_RESULT_OK on success. Any other value indicates an error. 273 274 ******************************************************************************/ 275 tiINT32 TI_SetMixedMode (TI_HANDLE hAdapter, 276 tiBOOL bStatus); 277 278 /****************************************************************************** 279 280 Name: TI_GetMixedMode 281 Desc: This function checks if the station can connect to an AP with or 282 without WEP. 283 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 284 pbStatus - FALSE indicates Mixed mode is disbaled, TRUE for enable. 285 Return: TI_RESULT_OK on success. Any other value indicates an error. 286 287 ******************************************************************************/ 288 tiINT32 TI_GetMixedMode (TI_HANDLE hAdapter, 289 tiBOOL* pbStatus); 290 291 /****************************************************************************** 292 293 Name: TI_SetWpaOptions 294 Desc: This function sets WPA promotion options. The STA supports promotion 295 of WPA2 authentication and AES encryption. Promotion means that if 296 the STA is configured to WPA , the STA connects to either WPA or 297 WPA2 according to the APs max support. This function sets both the 298 Driver and the Supplicant via an IOCTL. 299 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 300 fWPAOptions - The required WPA options. 301 Return: TI_RESULT_OK on success. Any other value indicates an error. 302 Notes: Supports only the ENABLE_ALL option. 303 304 ******************************************************************************/ 305 tiINT32 TI_SetWpaOptions (TI_HANDLE hAdapter, 306 tiUINT32 fWPAOptions ); 307 308 /****************************************************************************** 309 310 Name: TI_GetWpaOptions 311 Desc: This function retrieves the WPA promotion options. 312 Params: hAdapter - The Adapter handle returned by TI_AdapterInit(). 313 fWPAOptions - Current WPA options 314 Return: TI_RESULT_OK on success. Any other value indicates an error. 315 316 ******************************************************************************/ 317 tiINT32 TI_GetWpaOptions (TI_HANDLE hAdapter, 318 tiUINT32 *fWPAOptions ); 319 #ifdef __cplusplus 320 } 321 #endif 322 323 324 #endif /* TI_ADAPTER_SEC_H*/ 325