authsrv.c revision c5ec7f57ead87efa365800228aa0b09a12d9e6c4
17839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger/*
27839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger * Authentication server setup
37839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
47839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger *
57839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger * This software may be distributed under the terms of the BSD license.
67839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger * See README for more details.
77839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger */
87839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger#include "utils/includes.h"
107839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
117839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "utils/common.h"
127839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "crypto/tls.h"
137839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "eap_server/eap.h"
147839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "eap_server/eap_sim_db.h"
15910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger#include "eapol_auth/eapol_auth_sm.h"
167839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "radius/radius_server.h"
177839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "hostapd.h"
187839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "ap_config.h"
197839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "sta_info.h"
207839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#include "authsrv.h"
217839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
227839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
237839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#if defined(EAP_SERVER_SIM) || defined(EAP_SERVER_AKA)
247839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#define EAP_SIM_DB
257839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* EAP_SERVER_SIM || EAP_SERVER_AKA */
267839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
277839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
287839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef EAP_SIM_DB
297839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenbergerstatic int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
307839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger				 struct sta_info *sta, void *ctx)
317839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger{
327839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (eapol_auth_eap_pending_cb(sta->eapol_sm, ctx) == 0)
337839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		return 1;
347839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	return 0;
357839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger}
367839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
377839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
387839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenbergerstatic void hostapd_sim_db_cb(void *ctx, void *session_ctx)
397839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger{
407839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	struct hostapd_data *hapd = ctx;
417839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (ap_for_each_sta(hapd, hostapd_sim_db_cb_sta, session_ctx) == 0) {
427839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef RADIUS_SERVER
437839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		radius_server_eap_pending_cb(hapd->radius_srv, session_ctx);
447839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* RADIUS_SERVER */
457839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
467839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger}
477839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* EAP_SIM_DB */
487839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
497839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
507839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef RADIUS_SERVER
517839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
527839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenbergerstatic int hostapd_radius_get_eap_user(void *ctx, const u8 *identity,
537839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger				       size_t identity_len, int phase2,
547839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger				       struct eap_user *user)
557839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger{
567839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	const struct hostapd_eap_user *eap_user;
577839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	int i;
587839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
59910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger	eap_user = hostapd_get_eap_user(ctx, identity, identity_len, phase2);
607839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (eap_user == NULL)
617839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		return -1;
627839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
637839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (user == NULL)
647839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		return 0;
657839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
667839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	os_memset(user, 0, sizeof(*user));
677839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	for (i = 0; i < EAP_MAX_METHODS; i++) {
687839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		user->methods[i].vendor = eap_user->methods[i].vendor;
697839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		user->methods[i].method = eap_user->methods[i].method;
707839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
717839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
727839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (eap_user->password) {
737839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		user->password = os_malloc(eap_user->password_len);
747839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		if (user->password == NULL)
757839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			return -1;
767839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		os_memcpy(user->password, eap_user->password,
777839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			  eap_user->password_len);
787839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		user->password_len = eap_user->password_len;
797839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		user->password_hash = eap_user->password_hash;
807839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
817839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	user->force_version = eap_user->force_version;
827839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	user->ttls_auth = eap_user->ttls_auth;
837839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
847839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	return 0;
857839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger}
867839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
877839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
887839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenbergerstatic int hostapd_setup_radius_srv(struct hostapd_data *hapd)
897839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger{
907839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	struct radius_server_conf srv;
917839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	struct hostapd_bss_config *conf = hapd->conf;
927839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	os_memset(&srv, 0, sizeof(srv));
937839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.client_file = conf->radius_server_clients;
947839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.auth_port = conf->radius_server_auth_port;
957839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.conf_ctx = conf;
967839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.eap_sim_db_priv = hapd->eap_sim_db_priv;
977839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.ssl_ctx = hapd->ssl_ctx;
987839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.msg_ctx = hapd->msg_ctx;
997839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.pac_opaque_encr_key = conf->pac_opaque_encr_key;
1007839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.eap_fast_a_id = conf->eap_fast_a_id;
1017839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.eap_fast_a_id_len = conf->eap_fast_a_id_len;
1027839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.eap_fast_a_id_info = conf->eap_fast_a_id_info;
103910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger	srv.eap_fast_prov = conf->eap_fast_prov;
1047839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.pac_key_lifetime = conf->pac_key_lifetime;
1057839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.pac_key_refresh_time = conf->pac_key_refresh_time;
106910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger	srv.eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind;
1077839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.tnc = conf->tnc;
1087839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.wps = hapd->wps;
10958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger	srv.ipv6 = conf->radius_server_ipv6;
110910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger	srv.get_eap_user = hostapd_radius_get_eap_user;
1117839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.eap_req_id_text = conf->eap_req_id_text;
1127839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.eap_req_id_text_len = conf->eap_req_id_text_len;
1137839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.pwd_group = conf->pwd_group;
1147839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef CONFIG_RADIUS_TEST
1157839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	srv.dump_msk_file = conf->dump_msk_file;
1167839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* CONFIG_RADIUS_TEST */
1177839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
11858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger	hapd->radius_srv = radius_server_init(&srv);
119910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger	if (hapd->radius_srv == NULL) {
1207839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		wpa_printf(MSG_ERROR, "RADIUS server initialization failed.");
1217839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		return -1;
122910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger	}
1237839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1247839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	return 0;
1257839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger}
1267839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1277839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* RADIUS_SERVER */
12858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger
129910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger
1307839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenbergerint authsrv_init(struct hostapd_data *hapd)
1317839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger{
1327839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef EAP_TLS_FUNCS
1337839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (hapd->conf->eap_server &&
1347839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	    (hapd->conf->ca_cert || hapd->conf->server_cert ||
1357839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	     hapd->conf->dh_file)) {
1367839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		struct tls_connection_params params;
13758190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger
138910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger		hapd->ssl_ctx = tls_init(NULL);
1397839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		if (hapd->ssl_ctx == NULL) {
1407839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			wpa_printf(MSG_ERROR, "Failed to initialize TLS");
1417839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			authsrv_deinit(hapd);
1427839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			return -1;
1437839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		}
1447839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1457839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		os_memset(&params, 0, sizeof(params));
14658190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger		params.ca_cert = hapd->conf->ca_cert;
147910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger		params.client_cert = hapd->conf->server_cert;
1487839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		params.private_key = hapd->conf->private_key;
1497839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		params.private_key_passwd = hapd->conf->private_key_passwd;
1507839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		params.dh_file = hapd->conf->dh_file;
1517839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1527839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		if (tls_global_set_params(hapd->ssl_ctx, &params)) {
1537839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			wpa_printf(MSG_ERROR, "Failed to set TLS parameters");
1547839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			authsrv_deinit(hapd);
15558190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger			return -1;
156910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger		}
1577839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1587839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		if (tls_global_set_verify(hapd->ssl_ctx,
159910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger					  hapd->conf->check_crl)) {
1607839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			wpa_printf(MSG_ERROR, "Failed to enable check_crl");
1617839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			authsrv_deinit(hapd);
1627839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			return -1;
1637839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		}
1647839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
16558190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger#endif /* EAP_TLS_FUNCS */
166910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger
1677839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef EAP_SIM_DB
1687839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (hapd->conf->eap_sim_db) {
1697839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		hapd->eap_sim_db_priv =
1707839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			eap_sim_db_init(hapd->conf->eap_sim_db,
1717839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger					hostapd_sim_db_cb, hapd);
1727839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		if (hapd->eap_sim_db_priv == NULL) {
1737839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			wpa_printf(MSG_ERROR, "Failed to initialize EAP-SIM "
17458190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger				   "database interface");
1757839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger			authsrv_deinit(hapd);
176910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger			return -1;
1777839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		}
1787839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
1797839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* EAP_SIM_DB */
1807839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1817839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef RADIUS_SERVER
1827839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (hapd->conf->radius_server_clients &&
1837839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	    hostapd_setup_radius_srv(hapd))
18458190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger		return -1;
1857839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* RADIUS_SERVER */
186910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger
1877839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	return 0;
1887839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger}
1897839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1907839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1917839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenbergervoid authsrv_deinit(struct hostapd_data *hapd)
1927839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger{
1937839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef RADIUS_SERVER
19458190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger	radius_server_deinit(hapd->radius_srv);
1957839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	hapd->radius_srv = NULL;
196910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger#endif /* RADIUS_SERVER */
1977839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger
1987839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef EAP_TLS_FUNCS
1997839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (hapd->ssl_ctx) {
2007839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		tls_deinit(hapd->ssl_ctx);
2017839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		hapd->ssl_ctx = NULL;
2027839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
203910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger#endif /* EAP_TLS_FUNCS */
204910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger
2057839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#ifdef EAP_SIM_DB
2067839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	if (hapd->eap_sim_db_priv) {
20758190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger		eap_sim_db_deinit(hapd->eap_sim_db_priv);
2087839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger		hapd->eap_sim_db_priv = NULL;
2097839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger	}
2107839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger#endif /* EAP_SIM_DB */
2117839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger}
2127839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger