1 /* 2 * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef _ESP_WPA2_H 8 #define _ESP_WPA2_H 9 10 #pragma message("esp_wpa2.h is deprecated. Use esp_eap_client.h instead.") 11 12 #include "esp_eap_client.h" 13 14 /** 15 * @brief Enable wpa2 enterprise authentication. 16 * 17 * @deprecated This function is deprecated and will be removed in the future. 18 * Please use `esp_wifi_sta_enterprise_enable()` instead. 19 * 20 * @attention 1. wpa2 enterprise authentication can only be used when station mode is enabled. 21 * @attention 2. wpa2 enterprise authentication supports EAP-FAST, TLS, PEAP, TTLS(EAP, MSCHAPv2, MSCHAP, PAP, CHAP) methods. 22 * 23 * @return 24 * - ESP_OK: succeed. 25 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 26 */ 27 __attribute__((deprecated("Use 'esp_wifi_sta_enterprise_enable' instead"))) 28 esp_err_t esp_wifi_sta_wpa2_ent_enable(void); 29 30 /** 31 * @brief Disable wpa2 enterprise authentication. 32 * 33 * @deprecated This function is deprecated and will be removed in the future. 34 * Please use `esp_wifi_sta_enterprise_disable()` instead. 35 * 36 * @attention 1. wpa2 enterprise authentication can only be used when station mode is enabled. 37 * @attention 2. wpa2 enterprise authentication supports EAP-FAST, TLS, PEAP, TTLS(EAP, MSCHAPv2, MSCHAP, PAP, CHAP) methods. 38 * 39 * @return 40 * - ESP_OK: succeed. 41 */ 42 __attribute__((deprecated("Use 'esp_wifi_sta_enterprise_disable' instead"))) 43 esp_err_t esp_wifi_sta_wpa2_ent_disable(void); 44 45 /** 46 * @brief Set identity for PEAP/TTLS method. 47 * 48 * @deprecated This function is deprecated and will be removed in the future. 49 * Please use `esp_eap_client_set_identity` instead. 50 * 51 * @attention The API only passes the parameter identity to the global pointer variable in wpa2 enterprise module. 52 * 53 * @param identity: point to address where stores the identity; 54 * @param len: length of identity, limited to 1~127 55 * 56 * @return 57 * - ESP_OK: succeed 58 * - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128) 59 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 60 */ 61 __attribute__((deprecated("Use 'esp_eap_client_set_identity' instead"))) 62 esp_err_t esp_wifi_sta_wpa2_ent_set_identity(const unsigned char *identity, int len); 63 64 /** 65 * @brief Clear identity for PEAP/TTLS method. 66 * 67 * @deprecated This function is deprecated and will be removed in the future. 68 * Please use `esp_eap_client_clear_identity` instead. 69 * 70 */ 71 __attribute__((deprecated("Use 'esp_eap_client_clear_identity' instead"))) 72 void esp_wifi_sta_wpa2_ent_clear_identity(void); 73 74 /** 75 * @brief Set username for PEAP/TTLS method. 76 * 77 * @deprecated This function is deprecated and will be removed in the future. 78 * Please use `esp_eap_client_set_username` instead. 79 * 80 * @param username: point to address where stores the username; 81 * @param len: length of username, limited to 1~127 82 * 83 * @return 84 * - ESP_OK: succeed 85 * - ESP_ERR_INVALID_ARG: fail(len <= 0 or len >= 128) 86 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 87 */ 88 __attribute__((deprecated("Use 'esp_eap_client_set_username' instead"))) 89 esp_err_t esp_wifi_sta_wpa2_ent_set_username(const unsigned char *username, int len); 90 91 /** 92 * @brief Clear username for PEAP/TTLS method. 93 * @deprecated This function is deprecated and will be removed in the future. 94 * Please use `esp_eap_client_clear_username` instead. 95 * 96 */ 97 __attribute__((deprecated("Use 'esp_eap_client_clear_username' instead"))) 98 void esp_wifi_sta_wpa2_ent_clear_username(void); 99 100 /** 101 * @brief Set password for PEAP/TTLS method.. 102 * 103 * @deprecated This function is deprecated and will be removed in the future. 104 * Please use `esp_eap_client_set_password` instead. 105 * 106 * @param password: point to address where stores the password; 107 * @param len: length of password(len > 0) 108 * 109 * @return 110 * - ESP_OK: succeed 111 * - ESP_ERR_INVALID_ARG: fail(len <= 0) 112 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 113 */ 114 __attribute__((deprecated("Use 'esp_eap_client_set_password' instead"))) 115 esp_err_t esp_wifi_sta_wpa2_ent_set_password(const unsigned char *password, int len); 116 117 /** 118 * @brief Clear password for PEAP/TTLS method.. 119 * 120 * @deprecated This function is deprecated and will be removed in the future. 121 * Please use `esp_eap_client_clear_password` instead. 122 */ 123 __attribute__((deprecated("Use 'esp_eap_client_clear_password' instead"))) 124 void esp_wifi_sta_wpa2_ent_clear_password(void); 125 126 /** 127 * @brief Set new password for MSCHAPv2 method.. 128 * 129 * @deprecated This function is deprecated and will be removed in the future. 130 * Please use `esp_eap_client_set_new_password` instead. 131 * 132 * @attention 1. The new password is used to substitute the old password when eap-mschapv2 failure request message with error code ERROR_PASSWD_EXPIRED is received. 133 * 134 * @param new_password: point to address where stores the password; 135 * @param len: length of password 136 * 137 * @return 138 * - ESP_OK: succeed 139 * - ESP_ERR_INVALID_ARG: fail(len <= 0) 140 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 141 */ 142 __attribute__((deprecated("Use 'esp_eap_client_set_new_password' instead"))) 143 esp_err_t esp_wifi_sta_wpa2_ent_set_new_password(const unsigned char *new_password, int len); 144 145 /** 146 * @brief Clear new password for MSCHAPv2 method.. 147 * 148 * @deprecated This function is deprecated and will be removed in the future. 149 * Please use `esp_eap_client_clear_new_password` instead. 150 * 151 */ 152 __attribute__((deprecated("Use 'esp_eap_client_clear_new_password' instead"))) 153 void esp_wifi_sta_wpa2_ent_clear_new_password(void); 154 155 /** 156 * @brief Set CA certificate for PEAP/TTLS method. 157 * 158 * @deprecated This function is deprecated and will be removed in the future. 159 * Please use `esp_eap_client_set_ca_cert` instead. 160 * 161 * @attention 1. The API only passes the parameter ca_cert to the global pointer variable in wpa2 enterprise module. 162 * @attention 2. The ca_cert should be zero terminated. 163 * 164 * @param ca_cert: point to address where stores the CA certificate; 165 * @param ca_cert_len: length of ca_cert 166 * 167 * @return 168 * - ESP_OK: succeed 169 */ 170 __attribute__((deprecated("Use 'esp_eap_client_set_ca_cert' instead"))) 171 esp_err_t esp_wifi_sta_wpa2_ent_set_ca_cert(const unsigned char *ca_cert, int ca_cert_len); 172 173 /** 174 * @brief Clear CA certificate for PEAP/TTLS method. 175 * 176 * @deprecated This function is deprecated and will be removed in the future. 177 * Please use `esp_eap_client_clear_ca_cert` instead. 178 * 179 */ 180 __attribute__((deprecated("Use 'esp_eap_client_clear_ca_cert' instead"))) 181 void esp_wifi_sta_wpa2_ent_clear_ca_cert(void); 182 183 /** 184 * @brief Set client certificate and key. 185 * 186 * @deprecated This function is deprecated and will be removed in the future. 187 * Please use `esp_eap_client_set_certificate_and_key` instead. 188 * 189 * @attention 1. The API only passes the parameter client_cert, private_key and private_key_passwd to the global pointer variable in wpa2 enterprise module. 190 * @attention 2. The client_cert, private_key and private_key_passwd should be zero terminated. 191 * 192 * @param client_cert: point to address where stores the client certificate; 193 * @param client_cert_len: length of client certificate; 194 * @param private_key: point to address where stores the private key; 195 * @param private_key_len: length of private key, limited to 1~2048; 196 * @param private_key_password: point to address where stores the private key password; 197 * @param private_key_password_len: length of private key password; 198 * 199 * @return 200 * - ESP_OK: succeed 201 */ 202 __attribute__((deprecated("Use 'esp_eap_client_set_certificate_and_key' instead"))) 203 esp_err_t esp_wifi_sta_wpa2_ent_set_cert_key(const unsigned char *client_cert, int client_cert_len, 204 const unsigned char *private_key, int private_key_len, 205 const unsigned char *private_key_passwd, int private_key_passwd_len); 206 207 /** 208 * @brief Clear client certificate and key. 209 * 210 * @deprecated This function is deprecated and will be removed in the future. 211 * Please use `esp_eap_client_clear_certificate_and_key` instead. 212 * 213 */ 214 __attribute__((deprecated("Use 'esp_eap_client_clear_certificate_and_key' instead"))) 215 void esp_wifi_sta_wpa2_ent_clear_cert_key(void); 216 217 /** 218 * @brief Set wpa2 enterprise certs time check(disable or not). 219 * 220 * @deprecated This function is deprecated and will be removed in the future. 221 * Please use `esp_eap_client_set_disable_time_check` instead. 222 * 223 * @param true: disable wpa2 enterprise certs time check 224 * @param false: enable wpa2 enterprise certs time check 225 * 226 * @return 227 * - ESP_OK: succeed 228 */ 229 __attribute__((deprecated("Use 'esp_eap_client_set_disable_time_check' instead"))) 230 esp_err_t esp_wifi_sta_wpa2_ent_set_disable_time_check(bool disable); 231 232 /** 233 * @brief Get wpa2 enterprise certs time check(disable or not). 234 * 235 * @deprecated This function is deprecated and will be removed in the future. 236 * Please use `esp_eap_client_get_disable_time_check` instead. 237 * 238 * @param disable: store disable value 239 * 240 * @return 241 * - ESP_OK: succeed 242 */ 243 __attribute__((deprecated("Use 'esp_eap_client_get_disable_time_check' instead"))) 244 esp_err_t esp_wifi_sta_wpa2_ent_get_disable_time_check(bool *disable); 245 246 /** 247 * @brief Set wpa2 enterprise ttls phase2 method 248 * 249 * @deprecated This function is deprecated and will be removed in the future. 250 * Please use `esp_eap_client_set_ttls_phase2_method` instead. 251 * 252 * @param type: the type of phase 2 method to be used 253 * 254 * @return 255 * - ESP_OK: succeed 256 */ 257 __attribute__((deprecated("Use 'esp_eap_client_set_ttls_phase2_method' instead"))) 258 esp_err_t esp_wifi_sta_wpa2_ent_set_ttls_phase2_method(esp_eap_ttls_phase2_types type); 259 260 /** 261 * @brief enable/disable 192 bit suite b certification checks 262 * 263 * @deprecated This function is deprecated and will be removed in the future. 264 * Please use `esp_eap_client_set_suiteb_192bit_certification` instead. 265 * 266 * @param enable: bool to enable/disable it. 267 * 268 * @return 269 * - ESP_OK: succeed 270 */ 271 __attribute__((deprecated("Use 'esp_eap_client_set_suiteb_192bit_certification' instead"))) 272 esp_err_t esp_wifi_sta_wpa2_set_suiteb_192bit_certification(bool enable); 273 274 /** 275 * @brief Set client pac file 276 * 277 * @deprecated This function is deprecated and will be removed in the future. 278 * Please use `esp_eap_client_set_pac_file` instead. 279 * 280 * @attention 1. For files read from the file system, length has to be decremented by 1 byte. 281 * @attention 2. Disabling the ESP_WIFI_MBEDTLS_TLS_CLIENT config is required to use EAP-FAST. 282 * 283 * @param pac_file: pointer to the pac file 284 * pac_file_len: length of the pac file 285 * 286 * @return 287 * - ESP_OK: succeed 288 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 289 */ 290 __attribute__((deprecated("Use 'esp_eap_client_set_pac_file' instead"))) 291 esp_err_t esp_wifi_sta_wpa2_ent_set_pac_file(const unsigned char *pac_file, int pac_file_len); 292 293 /** 294 * @brief Set Phase 1 parameters for EAP-FAST 295 * 296 * @deprecated This function is deprecated and will be removed in the future. 297 * Please use `esp_eap_client_set_fast_params` instead. 298 * 299 * @attention 1. Disabling the ESP_WIFI_MBEDTLS_TLS_CLIENT config is required to use EAP-FAST. 300 * 301 * @param config: eap fast phase 1 configuration 302 * 303 * @return 304 * - ESP_OK: succeed 305 * - ESP_ERR_INVALID_ARG: fail(out of bound arguments) 306 * - ESP_ERR_NO_MEM: fail(internal memory malloc fail) 307 */ 308 __attribute__((deprecated("Use 'esp_eap_client_set_fast_params' instead"))) 309 esp_err_t esp_wifi_sta_wpa2_ent_set_fast_phase1_params(esp_eap_fast_config config); 310 311 /** 312 * @brief Use default CA cert bundle for server validation 313 * 314 * @deprecated This function is deprecated and will be removed in the future. 315 * Please use `esp_eap_client_use_default_cert_bundle` instead. 316 * 317 * @use_default_bundle : whether to use bundle or not 318 * 319 * @return 320 * - ESP_OK: succeed 321 * - ESP_FAIL: fail 322 */ 323 __attribute__((deprecated("Use 'esp_eap_client_use_default_cert_bundle' instead"))) 324 esp_err_t esp_wifi_sta_wpa2_use_default_cert_bundle(bool use_default_bundle); 325 326 #ifdef __cplusplus 327 } 328 #endif 329 #endif 330