Lines Matching refs:wps

62 int wps_derive_keys(struct wps_data *wps)  in wps_derive_keys()  argument
70 if (wps->dh_privkey == NULL) { in wps_derive_keys()
75 pubkey = wps->registrar ? wps->dh_pubkey_e : wps->dh_pubkey_r; in wps_derive_keys()
81 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: DH Private Key", wps->dh_privkey); in wps_derive_keys()
83 dh_shared = dh5_derive_shared(wps->dh_ctx, pubkey, wps->dh_privkey); in wps_derive_keys()
84 dh5_free(wps->dh_ctx); in wps_derive_keys()
85 wps->dh_ctx = NULL; in wps_derive_keys()
98 wpabuf_clear_free(wps->dh_privkey); in wps_derive_keys()
99 wps->dh_privkey = NULL; in wps_derive_keys()
112 addr[0] = wps->nonce_e; in wps_derive_keys()
114 addr[1] = wps->mac_addr_e; in wps_derive_keys()
116 addr[2] = wps->nonce_r; in wps_derive_keys()
123 os_memcpy(wps->authkey, keys, WPS_AUTHKEY_LEN); in wps_derive_keys()
124 os_memcpy(wps->keywrapkey, keys + WPS_AUTHKEY_LEN, WPS_KEYWRAPKEY_LEN); in wps_derive_keys()
125 os_memcpy(wps->emsk, keys + WPS_AUTHKEY_LEN + WPS_KEYWRAPKEY_LEN, in wps_derive_keys()
129 wps->authkey, WPS_AUTHKEY_LEN); in wps_derive_keys()
131 wps->keywrapkey, WPS_KEYWRAPKEY_LEN); in wps_derive_keys()
132 wpa_hexdump_key(MSG_DEBUG, "WPS: EMSK", wps->emsk, WPS_EMSK_LEN); in wps_derive_keys()
138 int wps_derive_psk(struct wps_data *wps, const u8 *dev_passwd, in wps_derive_psk() argument
143 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd, in wps_derive_psk()
146 os_memcpy(wps->psk1, hash, WPS_PSK_LEN); in wps_derive_psk()
147 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, in wps_derive_psk()
151 os_memcpy(wps->psk2, hash, WPS_PSK_LEN); in wps_derive_psk()
155 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK1", wps->psk1, WPS_PSK_LEN); in wps_derive_psk()
156 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK2", wps->psk2, WPS_PSK_LEN); in wps_derive_psk()
161 struct wpabuf * wps_decrypt_encr_settings(struct wps_data *wps, const u8 *encr, in wps_decrypt_encr_settings() argument
183 if (aes_128_cbc_decrypt(wps->keywrapkey, encr, wpabuf_mhead(decrypted), in wps_decrypt_encr_settings()
278 void wps_fail_event(struct wps_context *wps, enum wps_msg_type msg, in wps_fail_event() argument
283 if (wps->event_cb == NULL) in wps_fail_event()
291 wps->event_cb(wps->cb_ctx, WPS_EV_FAIL, &data); in wps_fail_event()
295 void wps_success_event(struct wps_context *wps, const u8 *mac_addr) in wps_success_event() argument
299 if (wps->event_cb == NULL) in wps_success_event()
304 wps->event_cb(wps->cb_ctx, WPS_EV_SUCCESS, &data); in wps_success_event()
308 void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part, in wps_pwd_auth_fail_event() argument
313 if (wps->event_cb == NULL) in wps_pwd_auth_fail_event()
320 wps->event_cb(wps->cb_ctx, WPS_EV_PWD_AUTH_FAIL, &data); in wps_pwd_auth_fail_event()
324 void wps_pbc_overlap_event(struct wps_context *wps) in wps_pbc_overlap_event() argument
326 if (wps->event_cb == NULL) in wps_pbc_overlap_event()
329 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_OVERLAP, NULL); in wps_pbc_overlap_event()
333 void wps_selected_registrar_timeout_event(struct wps_context *wps) in wps_selected_registrar_timeout_event() argument
335 if (wps->event_cb == NULL) in wps_selected_registrar_timeout_event()
338 wps->event_cb(wps->cb_ctx, WPS_EV_SELECTED_REGISTRAR_TIMEOUT, NULL); in wps_selected_registrar_timeout_event()
341 void wps_pbc_timeout_event(struct wps_context *wps) in wps_pbc_timeout_event() argument
343 if (wps->event_cb == NULL) in wps_pbc_timeout_event()
346 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_TIMEOUT, NULL); in wps_pbc_timeout_event()
350 void wps_pbc_active_event(struct wps_context *wps) in wps_pbc_active_event() argument
352 if (wps->event_cb == NULL) in wps_pbc_active_event()
355 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_ACTIVE, NULL); in wps_pbc_active_event()
359 void wps_pbc_disable_event(struct wps_context *wps) in wps_pbc_disable_event() argument
361 if (wps->event_cb == NULL) in wps_pbc_disable_event()
364 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_DISABLE, NULL); in wps_pbc_disable_event()
370 struct wpabuf * wps_get_oob_cred(struct wps_context *wps, int rf_band, in wps_get_oob_cred() argument
384 data.wps = wps; in wps_get_oob_cred()
385 data.auth_type = wps->auth_types; in wps_get_oob_cred()
386 data.encr_type = wps->encr_types; in wps_get_oob_cred()
390 wps_build_mac_addr(plain, wps->dev.mac_addr) || in wps_get_oob_cred()
397 if (wps->wps_state == WPS_STATE_NOT_CONFIGURED && data.new_psk && in wps_get_oob_cred()
398 wps->ap) { in wps_get_oob_cred()
405 os_memcpy(cred.ssid, wps->ssid, wps->ssid_len); in wps_get_oob_cred()
406 cred.ssid_len = wps->ssid_len; in wps_get_oob_cred()
412 wps->wps_state = WPS_STATE_CONFIGURED; in wps_get_oob_cred()
416 if (wps->cred_cb) in wps_get_oob_cred()
417 wps->cred_cb(wps->cb_ctx, &cred); in wps_get_oob_cred()
451 int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr) in wps_oob_use_cred() argument
468 wps->cred_cb(wps->cb_ctx, &local_cred); in wps_oob_use_cred()
591 struct wpabuf * wps_build_wsc_ack(struct wps_data *wps) in wps_build_wsc_ack() argument
603 wps_build_enrollee_nonce(wps, msg) || in wps_build_wsc_ack()
604 wps_build_registrar_nonce(wps, msg) || in wps_build_wsc_ack()
614 struct wpabuf * wps_build_wsc_nack(struct wps_data *wps) in wps_build_wsc_nack() argument
626 wps_build_enrollee_nonce(wps, msg) || in wps_build_wsc_nack()
627 wps_build_registrar_nonce(wps, msg) || in wps_build_wsc_nack()
628 wps_build_config_error(msg, wps->config_error) || in wps_build_wsc_nack()
756 static int wps_build_ssid(struct wpabuf *msg, struct wps_context *wps) in wps_build_ssid() argument
760 wps->ssid, wps->ssid_len); in wps_build_ssid()
762 wpabuf_put_be16(msg, wps->ssid_len); in wps_build_ssid()
763 wpabuf_put_data(msg, wps->ssid, wps->ssid_len); in wps_build_ssid()