/* This function is used to initialize shared TLS functionality for EAP-TLS, EAP-PEAP, EAP-TTLS, and EAP-FAST.  */
int eap_peer_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data, struct eap_peer_config *config, u8 eap_type)
/* This function is used to initialize shared TLS functionality for EAP-TLS, EAP-PEAP, EAP-TTLS, and EAP-FAST.  */
int eap_peer_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data, struct eap_peer_config *config, u8 eap_type)
{
	struct tls_connection_params params;
	if (config == NULL)
		return -1;
	data->eap = sm;
	data->eap_type = eap_type;
	data->ssl_ctx = sm->ssl_ctx;
	if (eap_tls_params_from_conf(sm, data, &params, config) < 0)
		return -1;
	if (eap_tls_init_connection(sm, data, config, &params) < 0)
		return -1;
	data->tls_out_limit = config->fragment_size;
	if (config->phase1 &&
	    os_strstr(config->phase1, "include_tls_length=1")) {
		wpa_printf(MSG_INFO, "TLS: Include TLS Message Length in "
			   "unfragmented packets");
		data->include_tls_length = 1;
	}
	return 0;
}