Lines Matching refs:hapd

24 static void hostapd_dpp_auth_success(struct hostapd_data *hapd, int initiator);
26 static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd);
37 int hostapd_dpp_qr_code(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_qr_code() argument
40 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_qr_code()
42 bi = dpp_add_qr_code(hapd->iface->interfaces->dpp, cmd); in hostapd_dpp_qr_code()
50 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_qr_code()
54 hostapd_drv_send_action(hapd, auth->curr_freq, 0, in hostapd_dpp_qr_code()
56 wpabuf_head(hapd->dpp_auth->resp_msg), in hostapd_dpp_qr_code()
57 wpabuf_len(hapd->dpp_auth->resp_msg)); in hostapd_dpp_qr_code()
67 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_auth_resp_retry_timeout() local
68 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_resp_retry_timeout()
75 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_auth_resp_retry_timeout()
79 hostapd_drv_send_action(hapd, auth->curr_freq, 500, auth->peer_mac_addr, in hostapd_dpp_auth_resp_retry_timeout()
85 static void hostapd_dpp_auth_resp_retry(struct hostapd_data *hapd) in hostapd_dpp_auth_resp_retry() argument
87 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_resp_retry()
93 if (hapd->dpp_resp_max_tries) in hostapd_dpp_auth_resp_retry()
94 max_tries = hapd->dpp_resp_max_tries; in hostapd_dpp_auth_resp_retry()
101 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_resp_retry()
102 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_resp_retry()
103 hapd->dpp_auth = NULL; in hostapd_dpp_auth_resp_retry()
107 if (hapd->dpp_resp_retry_time) in hostapd_dpp_auth_resp_retry()
108 wait_time = hapd->dpp_resp_retry_time; in hostapd_dpp_auth_resp_retry()
114 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_auth_resp_retry()
117 hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_auth_resp_retry()
121 void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst, in hostapd_dpp_tx_status() argument
124 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_tx_status()
128 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR in hostapd_dpp_tx_status()
131 if (!hapd->dpp_auth) { in hostapd_dpp_tx_status()
141 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_tx_status()
142 hapd->dpp_auth = NULL; in hostapd_dpp_tx_status()
147 if (hapd->dpp_auth->remove_on_tx_status) { in hostapd_dpp_tx_status()
150 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_tx_status()
152 hapd, NULL); in hostapd_dpp_tx_status()
153 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, in hostapd_dpp_tx_status()
155 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
156 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_tx_status()
157 hapd->dpp_auth = NULL; in hostapd_dpp_tx_status()
161 if (hapd->dpp_auth_ok_on_ack) in hostapd_dpp_tx_status()
162 hostapd_dpp_auth_success(hapd, 1); in hostapd_dpp_tx_status()
170 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
171 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_tx_status()
175 hostapd_dpp_auth_resp_retry(hapd); in hostapd_dpp_tx_status()
186 if (!hapd->dpp_auth_ok_on_ack && hapd->dpp_auth->neg_freq > 0 && in hostapd_dpp_tx_status()
187 hapd->dpp_auth->curr_freq != hapd->dpp_auth->neg_freq) { in hostapd_dpp_tx_status()
190 hapd->dpp_auth->curr_freq, in hostapd_dpp_tx_status()
191 hapd->dpp_auth->neg_freq); in hostapd_dpp_tx_status()
192 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_tx_status()
194 if (hapd->dpp_auth->neg_freq != in hostapd_dpp_tx_status()
195 (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_tx_status()
199 hapd->dpp_auth->neg_freq, hapd->iface->freq); in hostapd_dpp_tx_status()
203 if (hapd->dpp_auth_ok_on_ack) in hostapd_dpp_tx_status()
204 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_tx_status()
210 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_reply_wait_timeout() local
211 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_reply_wait_timeout()
219 wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_reply_wait_timeout()
220 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_reply_wait_timeout()
222 os_reltime_sub(&now, &hapd->dpp_last_init, &diff); in hostapd_dpp_reply_wait_timeout()
233 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_AUTH_INIT_FAILED); in hostapd_dpp_reply_wait_timeout()
234 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_reply_wait_timeout()
235 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reply_wait_timeout()
237 hapd->dpp_auth = NULL; in hostapd_dpp_reply_wait_timeout()
246 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_reply_wait_timeout()
247 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_reply_wait_timeout()
248 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_reply_wait_timeout()
266 hapd->dpp_in_response_listen = 1; in hostapd_dpp_reply_wait_timeout()
268 if (freq != (unsigned int) hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_reply_wait_timeout()
272 freq, hapd->iface->freq); in hostapd_dpp_reply_wait_timeout()
276 hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_reply_wait_timeout()
280 static void hostapd_dpp_set_testing_options(struct hostapd_data *hapd, in hostapd_dpp_set_testing_options() argument
284 if (hapd->dpp_config_obj_override) in hostapd_dpp_set_testing_options()
286 os_strdup(hapd->dpp_config_obj_override); in hostapd_dpp_set_testing_options()
287 if (hapd->dpp_discovery_override) in hostapd_dpp_set_testing_options()
289 os_strdup(hapd->dpp_discovery_override); in hostapd_dpp_set_testing_options()
290 if (hapd->dpp_groups_override) in hostapd_dpp_set_testing_options()
291 auth->groups_override = os_strdup(hapd->dpp_groups_override); in hostapd_dpp_set_testing_options()
293 hapd->dpp_ignore_netaccesskey_mismatch; in hostapd_dpp_set_testing_options()
300 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_init_timeout() local
302 if (!hapd->dpp_auth) in hostapd_dpp_init_timeout()
305 hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_init_timeout()
309 static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd) in hostapd_dpp_auth_init_next() argument
311 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_auth_init_next()
320 os_get_reltime(&hapd->dpp_init_iter_start); in hostapd_dpp_auth_init_next()
324 if (hapd->dpp_init_max_tries) in hostapd_dpp_auth_init_next()
325 max_tries = hapd->dpp_init_max_tries; in hostapd_dpp_auth_init_next()
331 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_auth_init_next()
334 hapd, NULL); in hostapd_dpp_auth_init_next()
335 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_init_next()
336 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init_next()
337 hapd->dpp_auth = NULL; in hostapd_dpp_auth_init_next()
341 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
342 if (hapd->dpp_init_retry_time) in hostapd_dpp_auth_init_next()
343 wait_time = hapd->dpp_init_retry_time; in hostapd_dpp_auth_init_next()
347 os_reltime_sub(&now, &hapd->dpp_init_iter_start, &diff); in hostapd_dpp_auth_init_next()
357 hostapd_dpp_init_timeout, hapd, in hostapd_dpp_auth_init_next()
368 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_auth_init_next()
369 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
371 max_wait_time = hapd->dpp_resp_wait_time ? in hostapd_dpp_auth_init_next()
372 hapd->dpp_resp_wait_time : 2000; in hostapd_dpp_auth_init_next()
377 hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_auth_init_next()
384 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_auth_init_next()
388 os_get_reltime(&hapd->dpp_last_init); in hostapd_dpp_auth_init_next()
389 return hostapd_drv_send_action(hapd, freq, wait_time, in hostapd_dpp_auth_init_next()
391 wpabuf_head(hapd->dpp_auth->req_msg), in hostapd_dpp_auth_init_next()
392 wpabuf_len(hapd->dpp_auth->req_msg)); in hostapd_dpp_auth_init_next()
396 int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_auth_init() argument
407 peer_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_auth_init()
417 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, in hostapd_dpp_auth_init()
451 if (hapd->dpp_auth) { in hostapd_dpp_auth_init()
452 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_auth_init()
454 hapd, NULL); in hostapd_dpp_auth_init()
455 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, in hostapd_dpp_auth_init()
457 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_auth_init()
458 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init()
461 hapd->dpp_auth = dpp_auth_init(hapd->msg_ctx, peer_bi, own_bi, in hostapd_dpp_auth_init()
463 hapd->iface->hw_features, in hostapd_dpp_auth_init()
464 hapd->iface->num_hw_features); in hostapd_dpp_auth_init()
465 if (!hapd->dpp_auth) in hostapd_dpp_auth_init()
467 hostapd_dpp_set_testing_options(hapd, hapd->dpp_auth); in hostapd_dpp_auth_init()
468 if (dpp_set_configurator(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_auth_init()
469 hapd->dpp_auth, cmd) < 0) { in hostapd_dpp_auth_init()
470 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_auth_init()
471 hapd->dpp_auth = NULL; in hostapd_dpp_auth_init()
475 hapd->dpp_auth->neg_freq = neg_freq; in hostapd_dpp_auth_init()
478 os_memcpy(hapd->dpp_auth->peer_mac_addr, peer_bi->mac_addr, in hostapd_dpp_auth_init()
481 return hostapd_dpp_auth_init_next(hapd); in hostapd_dpp_auth_init()
487 int hostapd_dpp_listen(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_listen() argument
496 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR; in hostapd_dpp_listen()
498 hapd->dpp_allowed_roles = DPP_CAPAB_ENROLLEE; in hostapd_dpp_listen()
500 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | in hostapd_dpp_listen()
502 hapd->dpp_qr_mutual = os_strstr(cmd, " qr=mutual") != NULL; in hostapd_dpp_listen()
504 if (freq != hapd->iface->freq && hapd->iface->freq > 0) { in hostapd_dpp_listen()
508 freq, hapd->iface->freq); in hostapd_dpp_listen()
516 void hostapd_dpp_listen_stop(struct hostapd_data *hapd) in hostapd_dpp_listen_stop() argument
522 static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_req() argument
530 if (!hapd->iface->interfaces->dpp) in hostapd_dpp_rx_auth_req()
539 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
549 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
558 dpp_bootstrap_find_pair(hapd->iface->interfaces->dpp, i_bootstrap, in hostapd_dpp_rx_auth_req()
561 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
566 if (hapd->dpp_auth) { in hostapd_dpp_rx_auth_req()
567 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_FAIL in hostapd_dpp_rx_auth_req()
572 hapd->dpp_auth_ok_on_ack = 0; in hostapd_dpp_rx_auth_req()
573 hapd->dpp_auth = dpp_auth_req_rx(hapd->msg_ctx, hapd->dpp_allowed_roles, in hostapd_dpp_rx_auth_req()
574 hapd->dpp_qr_mutual, in hostapd_dpp_rx_auth_req()
576 if (!hapd->dpp_auth) { in hostapd_dpp_rx_auth_req()
580 hostapd_dpp_set_testing_options(hapd, hapd->dpp_auth); in hostapd_dpp_rx_auth_req()
581 if (dpp_set_configurator(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_rx_auth_req()
582 hapd->dpp_auth, in hostapd_dpp_rx_auth_req()
583 hapd->dpp_configurator_params) < 0) { in hostapd_dpp_rx_auth_req()
584 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_rx_auth_req()
585 hapd->dpp_auth = NULL; in hostapd_dpp_rx_auth_req()
588 os_memcpy(hapd->dpp_auth->peer_mac_addr, src, ETH_ALEN); in hostapd_dpp_rx_auth_req()
590 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_auth_req()
592 MAC2STR(src), hapd->dpp_auth->curr_freq, in hostapd_dpp_rx_auth_req()
594 hostapd_drv_send_action(hapd, hapd->dpp_auth->curr_freq, 0, in hostapd_dpp_rx_auth_req()
595 src, wpabuf_head(hapd->dpp_auth->resp_msg), in hostapd_dpp_rx_auth_req()
596 wpabuf_len(hapd->dpp_auth->resp_msg)); in hostapd_dpp_rx_auth_req()
600 static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd, in hostapd_dpp_handle_config_obj() argument
603 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_RECEIVED); in hostapd_dpp_handle_config_obj()
604 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_AKM "%s", in hostapd_dpp_handle_config_obj()
607 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_SSID "%s", in hostapd_dpp_handle_config_obj()
615 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONNECTOR "%s", in hostapd_dpp_handle_config_obj()
623 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_PASS "%s", in hostapd_dpp_handle_config_obj()
629 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONFOBJ_PSK "%s", in hostapd_dpp_handle_config_obj()
642 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
658 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
663 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_handle_config_obj()
676 struct hostapd_data *hapd = ctx; in hostapd_dpp_gas_resp_cb() local
678 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_resp_cb()
714 hostapd_dpp_handle_config_obj(hapd, auth); in hostapd_dpp_gas_resp_cb()
724 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_resp_cb()
735 wpa_msg(hapd->msg_ctx, MSG_INFO, in hostapd_dpp_gas_resp_cb()
739 hostapd_drv_send_action(hapd, auth->curr_freq, 0, in hostapd_dpp_gas_resp_cb()
750 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_gas_resp_cb()
751 hapd->dpp_auth = NULL; in hostapd_dpp_gas_resp_cb()
755 static void hostapd_dpp_start_gas_client(struct hostapd_data *hapd) in hostapd_dpp_start_gas_client() argument
757 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_start_gas_client()
780 res = gas_query_ap_req(hapd->gas, auth->peer_mac_addr, auth->curr_freq, in hostapd_dpp_start_gas_client()
781 buf, hostapd_dpp_gas_resp_cb, hapd); in hostapd_dpp_start_gas_client()
783 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in hostapd_dpp_start_gas_client()
793 static void hostapd_dpp_auth_success(struct hostapd_data *hapd, int initiator) in hostapd_dpp_auth_success() argument
796 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_AUTH_SUCCESS "init=%d", in hostapd_dpp_auth_success()
802 if (hapd->dpp_auth->configurator) { in hostapd_dpp_auth_success()
804 hapd->dpp_auth->auth_success = 0; in hostapd_dpp_auth_success()
810 if (!hapd->dpp_auth->configurator) in hostapd_dpp_auth_success()
811 hostapd_dpp_start_gas_client(hapd); in hostapd_dpp_auth_success()
815 static void hostapd_dpp_rx_auth_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_resp() argument
819 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_auth_resp()
838 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_rx_auth_resp()
846 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_rx_auth_resp()
858 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_auth_resp()
861 hostapd_drv_send_action(hapd, auth->curr_freq, 0, src, in hostapd_dpp_rx_auth_resp()
864 hapd->dpp_auth_ok_on_ack = 1; in hostapd_dpp_rx_auth_resp()
868 static void hostapd_dpp_rx_auth_conf(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_auth_conf() argument
871 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_auth_conf()
893 hostapd_dpp_auth_success(hapd, 0); in hostapd_dpp_rx_auth_conf()
902 struct hostapd_data *hapd = eloop_ctx; in hostapd_dpp_config_result_wait_timeout() local
903 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_config_result_wait_timeout()
910 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_config_result_wait_timeout()
912 hapd->dpp_auth = NULL; in hostapd_dpp_config_result_wait_timeout()
916 static void hostapd_dpp_rx_conf_result(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_conf_result() argument
919 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_rx_conf_result()
939 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_rx_conf_result()
940 hostapd_dpp_listen_stop(hapd); in hostapd_dpp_rx_conf_result()
942 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_SENT); in hostapd_dpp_rx_conf_result()
944 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_rx_conf_result()
946 hapd->dpp_auth = NULL; in hostapd_dpp_rx_conf_result()
947 eloop_cancel_timeout(hostapd_dpp_config_result_wait_timeout, hapd, in hostapd_dpp_rx_conf_result()
954 static void hostapd_dpp_send_peer_disc_resp(struct hostapd_data *hapd, in hostapd_dpp_send_peer_disc_resp() argument
962 5 + 5 + 4 + os_strlen(hapd->conf->dpp_connector)); in hostapd_dpp_send_peer_disc_resp()
1011 hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1027 wpabuf_put_le16(msg, os_strlen(hapd->conf->dpp_connector)); in hostapd_dpp_send_peer_disc_resp()
1028 wpabuf_put_str(msg, hapd->conf->dpp_connector); in hostapd_dpp_send_peer_disc_resp()
1037 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_send_peer_disc_resp()
1040 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_send_peer_disc_resp()
1046 static void hostapd_dpp_rx_peer_disc_req(struct hostapd_data *hapd, in hostapd_dpp_rx_peer_disc_req() argument
1061 if (!hapd->wpa_auth || in hostapd_dpp_rx_peer_disc_req()
1062 !(hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) || in hostapd_dpp_rx_peer_disc_req()
1063 !(hapd->conf->wpa & WPA_PROTO_RSN)) { in hostapd_dpp_rx_peer_disc_req()
1068 if (!hapd->conf->dpp_connector || !hapd->conf->dpp_netaccesskey || in hostapd_dpp_rx_peer_disc_req()
1069 !hapd->conf->dpp_csign) { in hostapd_dpp_rx_peer_disc_req()
1076 if (hapd->conf->dpp_netaccesskey_expiry && in hostapd_dpp_rx_peer_disc_req()
1077 (os_time_t) hapd->conf->dpp_netaccesskey_expiry < now.sec) { in hostapd_dpp_rx_peer_disc_req()
1097 res = dpp_peer_intro(&intro, hapd->conf->dpp_connector, in hostapd_dpp_rx_peer_disc_req()
1098 wpabuf_head(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_peer_disc_req()
1099 wpabuf_len(hapd->conf->dpp_netaccesskey), in hostapd_dpp_rx_peer_disc_req()
1100 wpabuf_head(hapd->conf->dpp_csign), in hostapd_dpp_rx_peer_disc_req()
1101 wpabuf_len(hapd->conf->dpp_csign), in hostapd_dpp_rx_peer_disc_req()
1113 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, trans_id[0], in hostapd_dpp_rx_peer_disc_req()
1118 if (!expire || (os_time_t) hapd->conf->dpp_netaccesskey_expiry < expire) in hostapd_dpp_rx_peer_disc_req()
1119 expire = hapd->conf->dpp_netaccesskey_expiry; in hostapd_dpp_rx_peer_disc_req()
1125 if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, in hostapd_dpp_rx_peer_disc_req()
1132 hostapd_dpp_send_peer_disc_resp(hapd, src, freq, trans_id[0], in hostapd_dpp_rx_peer_disc_req()
1138 hostapd_dpp_rx_pkex_exchange_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_exchange_req() argument
1150 if (!hapd->dpp_pkex_code || !hapd->dpp_pkex_bi) { in hostapd_dpp_rx_pkex_exchange_req()
1156 if (hapd->dpp_pkex) { in hostapd_dpp_rx_pkex_exchange_req()
1163 hapd->dpp_pkex = dpp_pkex_rx_exchange_req(hapd->msg_ctx, in hostapd_dpp_rx_pkex_exchange_req()
1164 hapd->dpp_pkex_bi, in hostapd_dpp_rx_pkex_exchange_req()
1165 hapd->own_addr, src, in hostapd_dpp_rx_pkex_exchange_req()
1166 hapd->dpp_pkex_identifier, in hostapd_dpp_rx_pkex_exchange_req()
1167 hapd->dpp_pkex_code, in hostapd_dpp_rx_pkex_exchange_req()
1169 if (!hapd->dpp_pkex) { in hostapd_dpp_rx_pkex_exchange_req()
1175 msg = hapd->dpp_pkex->exchange_resp; in hostapd_dpp_rx_pkex_exchange_req()
1176 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_exchange_req()
1179 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_exchange_req()
1181 if (hapd->dpp_pkex->failed) { in hostapd_dpp_rx_pkex_exchange_req()
1184 if (hapd->dpp_pkex->t > hapd->dpp_pkex->own_bi->pkex_t) in hostapd_dpp_rx_pkex_exchange_req()
1185 hapd->dpp_pkex->own_bi->pkex_t = hapd->dpp_pkex->t; in hostapd_dpp_rx_pkex_exchange_req()
1186 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_rx_pkex_exchange_req()
1187 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_exchange_req()
1193 hostapd_dpp_rx_pkex_exchange_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_exchange_resp() argument
1204 if (!hapd->dpp_pkex || !hapd->dpp_pkex->initiator || in hostapd_dpp_rx_pkex_exchange_resp()
1205 hapd->dpp_pkex->exchange_done) { in hostapd_dpp_rx_pkex_exchange_resp()
1210 msg = dpp_pkex_rx_exchange_resp(hapd->dpp_pkex, src, buf, len); in hostapd_dpp_rx_pkex_exchange_resp()
1219 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_exchange_resp()
1222 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_exchange_resp()
1229 hostapd_dpp_rx_pkex_commit_reveal_req(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_commit_reveal_req() argument
1234 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_rx_pkex_commit_reveal_req()
1248 if (hapd->dpp_pkex->failed) { in hostapd_dpp_rx_pkex_commit_reveal_req()
1250 if (hapd->dpp_pkex->t > hapd->dpp_pkex->own_bi->pkex_t) in hostapd_dpp_rx_pkex_commit_reveal_req()
1251 hapd->dpp_pkex->own_bi->pkex_t = in hostapd_dpp_rx_pkex_commit_reveal_req()
1252 hapd->dpp_pkex->t; in hostapd_dpp_rx_pkex_commit_reveal_req()
1253 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_rx_pkex_commit_reveal_req()
1254 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_req()
1262 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_rx_pkex_commit_reveal_req()
1265 hostapd_drv_send_action(hapd, freq, 0, src, in hostapd_dpp_rx_pkex_commit_reveal_req()
1269 bi = dpp_pkex_finish(hapd->iface->interfaces->dpp, pkex, src, freq); in hostapd_dpp_rx_pkex_commit_reveal_req()
1272 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_req()
1277 hostapd_dpp_rx_pkex_commit_reveal_resp(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_pkex_commit_reveal_resp() argument
1283 struct dpp_pkex *pkex = hapd->dpp_pkex; in hostapd_dpp_rx_pkex_commit_reveal_resp()
1300 bi = dpp_pkex_finish(hapd->iface->interfaces->dpp, pkex, src, freq); in hostapd_dpp_rx_pkex_commit_reveal_resp()
1303 hapd->dpp_pkex = NULL; in hostapd_dpp_rx_pkex_commit_reveal_resp()
1307 hapd->dpp_pkex_auth_cmd ? hapd->dpp_pkex_auth_cmd : ""); in hostapd_dpp_rx_pkex_commit_reveal_resp()
1311 if (hostapd_dpp_auth_init(hapd, cmd) < 0) { in hostapd_dpp_rx_pkex_commit_reveal_resp()
1319 void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src, in hostapd_dpp_rx_action() argument
1345 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
1352 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
1357 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RX "src=" MACSTR in hostapd_dpp_rx_action()
1362 hostapd_dpp_rx_auth_req(hapd, src, hdr, buf, len, freq); in hostapd_dpp_rx_action()
1365 hostapd_dpp_rx_auth_resp(hapd, src, hdr, buf, len, freq); in hostapd_dpp_rx_action()
1368 hostapd_dpp_rx_auth_conf(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
1371 hostapd_dpp_rx_peer_disc_req(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
1374 hostapd_dpp_rx_pkex_exchange_req(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
1377 hostapd_dpp_rx_pkex_exchange_resp(hapd, src, buf, len, freq); in hostapd_dpp_rx_action()
1380 hostapd_dpp_rx_pkex_commit_reveal_req(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
1384 hostapd_dpp_rx_pkex_commit_reveal_resp(hapd, src, hdr, buf, len, in hostapd_dpp_rx_action()
1389 hostapd_dpp_rx_conf_result(hapd, src, hdr, buf, len); in hostapd_dpp_rx_action()
1398 if (hapd->dpp_pkex) in hostapd_dpp_rx_action()
1399 pkex_t = hapd->dpp_pkex->t; in hostapd_dpp_rx_action()
1400 else if (hapd->dpp_pkex_bi) in hostapd_dpp_rx_action()
1401 pkex_t = hapd->dpp_pkex_bi->pkex_t; in hostapd_dpp_rx_action()
1405 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_PKEX_T_LIMIT "id=0"); in hostapd_dpp_rx_action()
1406 hostapd_dpp_pkex_remove(hapd, "*"); in hostapd_dpp_rx_action()
1412 hostapd_dpp_gas_req_handler(struct hostapd_data *hapd, const u8 *sa, in hostapd_dpp_gas_req_handler() argument
1415 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_req_handler()
1427 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_REQ_RX "src=" MACSTR, in hostapd_dpp_gas_req_handler()
1431 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_req_handler()
1436 void hostapd_dpp_gas_status_handler(struct hostapd_data *hapd, int ok) in hostapd_dpp_gas_status_handler() argument
1438 struct dpp_authentication *auth = hapd->dpp_auth; in hostapd_dpp_gas_status_handler()
1445 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
1446 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_gas_status_handler()
1453 hapd, NULL); in hostapd_dpp_gas_status_handler()
1456 hapd, NULL); in hostapd_dpp_gas_status_handler()
1460 hostapd_drv_send_action_cancel_wait(hapd); in hostapd_dpp_gas_status_handler()
1463 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_SENT); in hostapd_dpp_gas_status_handler()
1465 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_CONF_FAILED); in hostapd_dpp_gas_status_handler()
1466 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_gas_status_handler()
1467 hapd->dpp_auth = NULL; in hostapd_dpp_gas_status_handler()
1471 int hostapd_dpp_configurator_sign(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_configurator_sign() argument
1482 hostapd_dpp_set_testing_options(hapd, auth); in hostapd_dpp_configurator_sign()
1483 if (dpp_set_configurator(hapd->iface->interfaces->dpp, hapd->msg_ctx, in hostapd_dpp_configurator_sign()
1486 hostapd_dpp_handle_config_obj(hapd, auth); in hostapd_dpp_configurator_sign()
1497 int hostapd_dpp_pkex_add(struct hostapd_data *hapd, const char *cmd) in hostapd_dpp_pkex_add() argument
1506 own_bi = dpp_bootstrap_get_id(hapd->iface->interfaces->dpp, atoi(pos)); in hostapd_dpp_pkex_add()
1517 hapd->dpp_pkex_bi = own_bi; in hostapd_dpp_pkex_add()
1520 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_add()
1521 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_add()
1528 hapd->dpp_pkex_identifier = os_malloc(end - pos + 1); in hostapd_dpp_pkex_add()
1529 if (!hapd->dpp_pkex_identifier) in hostapd_dpp_pkex_add()
1531 os_memcpy(hapd->dpp_pkex_identifier, pos, end - pos); in hostapd_dpp_pkex_add()
1532 hapd->dpp_pkex_identifier[end - pos] = '\0'; in hostapd_dpp_pkex_add()
1538 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_add()
1539 hapd->dpp_pkex_code = os_strdup(pos + 6); in hostapd_dpp_pkex_add()
1540 if (!hapd->dpp_pkex_code) in hostapd_dpp_pkex_add()
1547 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_pkex_add()
1548 hapd->dpp_pkex = dpp_pkex_init(hapd->msg_ctx, own_bi, in hostapd_dpp_pkex_add()
1549 hapd->own_addr, in hostapd_dpp_pkex_add()
1550 hapd->dpp_pkex_identifier, in hostapd_dpp_pkex_add()
1551 hapd->dpp_pkex_code); in hostapd_dpp_pkex_add()
1552 if (!hapd->dpp_pkex) in hostapd_dpp_pkex_add()
1555 msg = hapd->dpp_pkex->exchange_req; in hostapd_dpp_pkex_add()
1557 wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR in hostapd_dpp_pkex_add()
1560 hostapd_drv_send_action(hapd, 2437, 0, broadcast, in hostapd_dpp_pkex_add()
1566 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pkex_add()
1567 hapd->dpp_pkex_auth_cmd = os_strdup(cmd); in hostapd_dpp_pkex_add()
1573 int hostapd_dpp_pkex_remove(struct hostapd_data *hapd, const char *id) in hostapd_dpp_pkex_remove() argument
1585 if ((id_val != 0 && id_val != 1) || !hapd->dpp_pkex_code) in hostapd_dpp_pkex_remove()
1589 os_free(hapd->dpp_pkex_code); in hostapd_dpp_pkex_remove()
1590 hapd->dpp_pkex_code = NULL; in hostapd_dpp_pkex_remove()
1591 os_free(hapd->dpp_pkex_identifier); in hostapd_dpp_pkex_remove()
1592 hapd->dpp_pkex_identifier = NULL; in hostapd_dpp_pkex_remove()
1593 os_free(hapd->dpp_pkex_auth_cmd); in hostapd_dpp_pkex_remove()
1594 hapd->dpp_pkex_auth_cmd = NULL; in hostapd_dpp_pkex_remove()
1595 hapd->dpp_pkex_bi = NULL; in hostapd_dpp_pkex_remove()
1597 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_pkex_remove()
1598 hapd->dpp_pkex = NULL; in hostapd_dpp_pkex_remove()
1603 void hostapd_dpp_stop(struct hostapd_data *hapd) in hostapd_dpp_stop() argument
1605 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_stop()
1606 hapd->dpp_auth = NULL; in hostapd_dpp_stop()
1607 dpp_pkex_free(hapd->dpp_pkex); in hostapd_dpp_stop()
1608 hapd->dpp_pkex = NULL; in hostapd_dpp_stop()
1612 int hostapd_dpp_init(struct hostapd_data *hapd) in hostapd_dpp_init() argument
1614 hapd->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | DPP_CAPAB_ENROLLEE; in hostapd_dpp_init()
1615 hapd->dpp_init_done = 1; in hostapd_dpp_init()
1620 void hostapd_dpp_deinit(struct hostapd_data *hapd) in hostapd_dpp_deinit() argument
1623 os_free(hapd->dpp_config_obj_override); in hostapd_dpp_deinit()
1624 hapd->dpp_config_obj_override = NULL; in hostapd_dpp_deinit()
1625 os_free(hapd->dpp_discovery_override); in hostapd_dpp_deinit()
1626 hapd->dpp_discovery_override = NULL; in hostapd_dpp_deinit()
1627 os_free(hapd->dpp_groups_override); in hostapd_dpp_deinit()
1628 hapd->dpp_groups_override = NULL; in hostapd_dpp_deinit()
1629 hapd->dpp_ignore_netaccesskey_mismatch = 0; in hostapd_dpp_deinit()
1631 if (!hapd->dpp_init_done) in hostapd_dpp_deinit()
1633 eloop_cancel_timeout(hostapd_dpp_reply_wait_timeout, hapd, NULL); in hostapd_dpp_deinit()
1634 eloop_cancel_timeout(hostapd_dpp_init_timeout, hapd, NULL); in hostapd_dpp_deinit()
1635 eloop_cancel_timeout(hostapd_dpp_auth_resp_retry_timeout, hapd, NULL); in hostapd_dpp_deinit()
1637 eloop_cancel_timeout(hostapd_dpp_config_result_wait_timeout, hapd, in hostapd_dpp_deinit()
1640 dpp_auth_deinit(hapd->dpp_auth); in hostapd_dpp_deinit()
1641 hapd->dpp_auth = NULL; in hostapd_dpp_deinit()
1642 hostapd_dpp_pkex_remove(hapd, "*"); in hostapd_dpp_deinit()
1643 hapd->dpp_pkex = NULL; in hostapd_dpp_deinit()
1644 os_free(hapd->dpp_configurator_params); in hostapd_dpp_deinit()
1645 hapd->dpp_configurator_params = NULL; in hostapd_dpp_deinit()