static void * eap_tls_init(struct eap_sm *sm) { struct eap_tls_data *data; struct wpa_ssid *config = eap_get_config(sm); if (config == NULL || ((sm->init_phase2 ? config->private_key2 : config->private_key) == NULL && config->engine == 0)) { wpa_printf(MSG_INFO, "EAP-TLS: Private key not configured"); return NULL; } data = wpa_zalloc(sizeof(*data)); if (data == NULL) return NULL; if (eap_tls_ssl_init(sm, &data->ssl, config)) { wpa_printf(MSG_INFO, "EAP-TLS: Failed to initialize SSL."); eap_tls_deinit(sm, data); if (config->engine) { wpa_printf(MSG_DEBUG, "EAP-TLS: Requesting Smartcard " "PIN"); eap_sm_request_pin(sm); sm->ignore = TRUE; } else if (config->private_key && !config->private_key_passwd) { wpa_printf(MSG_DEBUG, "EAP-TLS: Requesting private " "key passphrase"); eap_sm_request_passphrase(sm); sm->ignore = TRUE; } return NULL; } return data; }
static void * eap_unauth_tls_init(struct eap_sm *sm) { struct eap_tls_data *data; struct eap_peer_config *config = eap_get_config(sm); data = os_zalloc(sizeof(*data)); if (data == NULL) return NULL; data->ssl_ctx = sm->init_phase2 && sm->ssl_ctx2 ? sm->ssl_ctx2 : sm->ssl_ctx; if (eap_peer_tls_ssl_init(sm, &data->ssl, config, EAP_UNAUTH_TLS_TYPE)) { wpa_printf(MSG_INFO, "EAP-TLS: Failed to initialize SSL."); eap_tls_deinit(sm, data); return NULL; } data->eap_type = EAP_UNAUTH_TLS_TYPE; return data; }