Lines Matching refs:hapd

30 static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,  in hostapd_sim_db_cb_sta()  argument
41 struct hostapd_data *hapd = ctx; in hostapd_sim_db_cb() local
42 if (ap_for_each_sta(hapd, hostapd_sim_db_cb_sta, session_ctx) == 0) { in hostapd_sim_db_cb()
44 radius_server_eap_pending_cb(hapd->radius_srv, session_ctx); in hostapd_sim_db_cb()
105 static int hostapd_setup_radius_srv(struct hostapd_data *hapd) in hostapd_setup_radius_srv() argument
108 struct hostapd_bss_config *conf = hapd->conf; in hostapd_setup_radius_srv()
111 if (!hostapd_mld_is_first_bss(hapd)) { in hostapd_setup_radius_srv()
117 first = hostapd_mld_get_first_bss(hapd); in hostapd_setup_radius_srv()
120 hapd->radius_srv = first->radius_srv; in hostapd_setup_radius_srv()
129 srv.conf_ctx = hapd; in hostapd_setup_radius_srv()
145 srv.eap_cfg = hapd->eap_cfg; in hostapd_setup_radius_srv()
147 hapd->radius_srv = radius_server_init(&srv); in hostapd_setup_radius_srv()
148 if (hapd->radius_srv == NULL) { in hostapd_setup_radius_srv()
196 static struct eap_config * authsrv_eap_config(struct hostapd_data *hapd) in authsrv_eap_config() argument
204 cfg->eap_server = hapd->conf->eap_server; in authsrv_eap_config()
205 cfg->ssl_ctx = hapd->ssl_ctx; in authsrv_eap_config()
206 cfg->msg_ctx = hapd->msg_ctx; in authsrv_eap_config()
207 cfg->eap_sim_db_priv = hapd->eap_sim_db_priv; in authsrv_eap_config()
208 cfg->tls_session_lifetime = hapd->conf->tls_session_lifetime; in authsrv_eap_config()
209 cfg->tls_flags = hapd->conf->tls_flags; in authsrv_eap_config()
210 cfg->max_auth_rounds = hapd->conf->max_auth_rounds; in authsrv_eap_config()
211 cfg->max_auth_rounds_short = hapd->conf->max_auth_rounds_short; in authsrv_eap_config()
212 if (hapd->conf->pac_opaque_encr_key) in authsrv_eap_config()
214 os_memdup(hapd->conf->pac_opaque_encr_key, 16); in authsrv_eap_config()
215 if (hapd->conf->eap_fast_a_id) { in authsrv_eap_config()
216 cfg->eap_fast_a_id = os_memdup(hapd->conf->eap_fast_a_id, in authsrv_eap_config()
217 hapd->conf->eap_fast_a_id_len); in authsrv_eap_config()
218 cfg->eap_fast_a_id_len = hapd->conf->eap_fast_a_id_len; in authsrv_eap_config()
220 if (hapd->conf->eap_fast_a_id_info) in authsrv_eap_config()
222 os_strdup(hapd->conf->eap_fast_a_id_info); in authsrv_eap_config()
223 cfg->eap_fast_prov = hapd->conf->eap_fast_prov; in authsrv_eap_config()
224 cfg->pac_key_lifetime = hapd->conf->pac_key_lifetime; in authsrv_eap_config()
225 cfg->pac_key_refresh_time = hapd->conf->pac_key_refresh_time; in authsrv_eap_config()
226 cfg->eap_teap_auth = hapd->conf->eap_teap_auth; in authsrv_eap_config()
227 cfg->eap_teap_pac_no_inner = hapd->conf->eap_teap_pac_no_inner; in authsrv_eap_config()
228 cfg->eap_teap_separate_result = hapd->conf->eap_teap_separate_result; in authsrv_eap_config()
229 cfg->eap_teap_id = hapd->conf->eap_teap_id; in authsrv_eap_config()
230 cfg->eap_teap_method_sequence = hapd->conf->eap_teap_method_sequence; in authsrv_eap_config()
231 cfg->eap_sim_aka_result_ind = hapd->conf->eap_sim_aka_result_ind; in authsrv_eap_config()
232 cfg->eap_sim_id = hapd->conf->eap_sim_id; in authsrv_eap_config()
233 cfg->imsi_privacy_key = hapd->imsi_privacy_key; in authsrv_eap_config()
235 hapd->conf->eap_sim_aka_fast_reauth_limit; in authsrv_eap_config()
236 cfg->tnc = hapd->conf->tnc; in authsrv_eap_config()
237 cfg->wps = hapd->wps; in authsrv_eap_config()
238 cfg->fragment_size = hapd->conf->fragment_size; in authsrv_eap_config()
239 cfg->pwd_group = hapd->conf->pwd_group; in authsrv_eap_config()
240 cfg->pbc_in_m1 = hapd->conf->pbc_in_m1; in authsrv_eap_config()
241 if (hapd->conf->server_id) { in authsrv_eap_config()
242 cfg->server_id = (u8 *) os_strdup(hapd->conf->server_id); in authsrv_eap_config()
243 cfg->server_id_len = os_strlen(hapd->conf->server_id); in authsrv_eap_config()
248 cfg->erp = hapd->conf->eap_server_erp; in authsrv_eap_config()
250 cfg->skip_prot_success = hapd->conf->eap_skip_prot_success; in authsrv_eap_config()
257 int authsrv_init(struct hostapd_data *hapd) in authsrv_init() argument
260 if (!hostapd_mld_is_first_bss(hapd)) { in authsrv_init()
263 first = hostapd_mld_get_first_bss(hapd); in authsrv_init()
278 hapd->ssl_ctx = first->ssl_ctx; in authsrv_init()
280 hapd->eap_cfg = first->eap_cfg; in authsrv_init()
282 hapd->eap_sim_db_priv = first->eap_sim_db_priv; in authsrv_init()
289 if (hapd->conf->eap_server && in authsrv_init()
290 …(hapd->conf->ca_cert || hapd->conf->ca_cert_blob || hapd->conf->server_cert || hapd->conf->server_… in authsrv_init()
291 hapd->conf->private_key || hapd->conf->private_key_blob || hapd->conf->dh_file || in authsrv_init()
292 hapd->conf->server_cert2 || hapd->conf->private_key2)) { in authsrv_init()
297 conf.tls_session_lifetime = hapd->conf->tls_session_lifetime; in authsrv_init()
298 if (hapd->conf->crl_reload_interval > 0 && in authsrv_init()
299 hapd->conf->check_crl <= 0) { in authsrv_init()
302 } else if (hapd->conf->crl_reload_interval > 0) { in authsrv_init()
304 hapd->conf->crl_reload_interval; in authsrv_init()
308 conf.tls_flags = hapd->conf->tls_flags; in authsrv_init()
310 conf.cb_ctx = hapd; in authsrv_init()
311 hapd->ssl_ctx = tls_init(&conf); in authsrv_init()
312 if (hapd->ssl_ctx == NULL) { in authsrv_init()
314 authsrv_deinit(hapd); in authsrv_init()
319 params.ca_cert = hapd->conf->ca_cert; in authsrv_init()
320 params.ca_cert_blob = hapd->conf->ca_cert_blob; in authsrv_init()
321 params.ca_cert_blob_len = hapd->conf->ca_cert_blob_len; in authsrv_init()
322 params.client_cert = hapd->conf->server_cert; in authsrv_init()
323 params.client_cert_blob = hapd->conf->server_cert_blob; in authsrv_init()
324 params.client_cert_blob_len = hapd->conf->server_cert_blob_len; in authsrv_init()
325 params.client_cert2 = hapd->conf->server_cert2; in authsrv_init()
326 params.private_key = hapd->conf->private_key; in authsrv_init()
327 params.private_key_blob = hapd->conf->private_key_blob; in authsrv_init()
328 params.private_key_blob_len = hapd->conf->private_key_blob_len; in authsrv_init()
329 params.private_key2 = hapd->conf->private_key2; in authsrv_init()
330 params.private_key_passwd = hapd->conf->private_key_passwd; in authsrv_init()
331 params.private_key_passwd2 = hapd->conf->private_key_passwd2; in authsrv_init()
332 params.dh_file = hapd->conf->dh_file; in authsrv_init()
333 params.dh_blob = hapd->conf->dh_blob; in authsrv_init()
334 params.dh_blob_len = hapd->conf->dh_blob_len; in authsrv_init()
335 params.openssl_ciphers = hapd->conf->openssl_ciphers; in authsrv_init()
336 params.openssl_ecdh_curves = hapd->conf->openssl_ecdh_curves; in authsrv_init()
338 hapd->conf->ocsp_stapling_response; in authsrv_init()
340 hapd->conf->ocsp_stapling_response_multi; in authsrv_init()
341 params.check_cert_subject = hapd->conf->check_cert_subject; in authsrv_init()
343 if (tls_global_set_params(hapd->ssl_ctx, &params)) { in authsrv_init()
345 authsrv_deinit(hapd); in authsrv_init()
349 if (tls_global_set_verify(hapd->ssl_ctx, in authsrv_init()
350 hapd->conf->check_crl, in authsrv_init()
351 hapd->conf->check_crl_strict)) { in authsrv_init()
353 authsrv_deinit(hapd); in authsrv_init()
360 crypto_rsa_key_free(hapd->imsi_privacy_key); in authsrv_init()
361 hapd->imsi_privacy_key = NULL; in authsrv_init()
362 if (hapd->conf->imsi_privacy_key) { in authsrv_init()
363 hapd->imsi_privacy_key = crypto_rsa_key_read( in authsrv_init()
364 hapd->conf->imsi_privacy_key, true); in authsrv_init()
365 if (!hapd->imsi_privacy_key) { in authsrv_init()
368 hapd->conf->imsi_privacy_key); in authsrv_init()
369 authsrv_deinit(hapd); in authsrv_init()
376 if (hapd->conf->eap_sim_db) { in authsrv_init()
377 hapd->eap_sim_db_priv = in authsrv_init()
378 eap_sim_db_init(hapd->conf->eap_sim_db, in authsrv_init()
379 hapd->conf->eap_sim_db_timeout, in authsrv_init()
380 hostapd_sim_db_cb, hapd); in authsrv_init()
381 if (hapd->eap_sim_db_priv == NULL) { in authsrv_init()
384 authsrv_deinit(hapd); in authsrv_init()
390 hapd->eap_cfg = authsrv_eap_config(hapd); in authsrv_init()
391 if (!hapd->eap_cfg) { in authsrv_init()
394 authsrv_deinit(hapd); in authsrv_init()
399 if (hapd->conf->radius_server_clients && in authsrv_init()
400 hostapd_setup_radius_srv(hapd)) in authsrv_init()
408 void authsrv_deinit(struct hostapd_data *hapd) in authsrv_deinit() argument
411 if (!hostapd_mld_is_first_bss(hapd)) { in authsrv_deinit()
415 hapd->radius_srv = NULL; in authsrv_deinit()
416 hapd->eap_cfg = NULL; in authsrv_deinit()
418 hapd->eap_sim_db_priv = NULL; in authsrv_deinit()
421 hapd->ssl_ctx = NULL; in authsrv_deinit()
428 radius_server_deinit(hapd->radius_srv); in authsrv_deinit()
429 hapd->radius_srv = NULL; in authsrv_deinit()
433 crypto_rsa_key_free(hapd->imsi_privacy_key); in authsrv_deinit()
434 hapd->imsi_privacy_key = NULL; in authsrv_deinit()
438 if (hapd->ssl_ctx) { in authsrv_deinit()
439 tls_deinit(hapd->ssl_ctx); in authsrv_deinit()
440 hapd->ssl_ctx = NULL; in authsrv_deinit()
445 if (hapd->eap_sim_db_priv) { in authsrv_deinit()
446 eap_sim_db_deinit(hapd->eap_sim_db_priv); in authsrv_deinit()
447 hapd->eap_sim_db_priv = NULL; in authsrv_deinit()
451 eap_server_config_free(hapd->eap_cfg); in authsrv_deinit()
452 hapd->eap_cfg = NULL; in authsrv_deinit()