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()
93 wpabuf_clear_free(wps->dh_privkey); in wps_derive_keys()
94 wps->dh_privkey = NULL; in wps_derive_keys()
106 addr[0] = wps->nonce_e; in wps_derive_keys()
108 addr[1] = wps->mac_addr_e; in wps_derive_keys()
110 addr[2] = wps->nonce_r; in wps_derive_keys()
117 os_memcpy(wps->authkey, keys, WPS_AUTHKEY_LEN); in wps_derive_keys()
118 os_memcpy(wps->keywrapkey, keys + WPS_AUTHKEY_LEN, WPS_KEYWRAPKEY_LEN); in wps_derive_keys()
119 os_memcpy(wps->emsk, keys + WPS_AUTHKEY_LEN + WPS_KEYWRAPKEY_LEN, in wps_derive_keys()
123 wps->authkey, WPS_AUTHKEY_LEN); in wps_derive_keys()
125 wps->keywrapkey, WPS_KEYWRAPKEY_LEN); in wps_derive_keys()
126 wpa_hexdump_key(MSG_DEBUG, "WPS: EMSK", wps->emsk, WPS_EMSK_LEN); in wps_derive_keys()
132 int wps_derive_psk(struct wps_data *wps, const u8 *dev_passwd, in wps_derive_psk() argument
137 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd, in wps_derive_psk()
140 os_memcpy(wps->psk1, hash, WPS_PSK_LEN); in wps_derive_psk()
141 if (hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, in wps_derive_psk()
145 os_memcpy(wps->psk2, hash, WPS_PSK_LEN); in wps_derive_psk()
149 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK1", wps->psk1, WPS_PSK_LEN); in wps_derive_psk()
150 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK2", wps->psk2, WPS_PSK_LEN); in wps_derive_psk()
155 struct wpabuf * wps_decrypt_encr_settings(struct wps_data *wps, const u8 *encr, in wps_decrypt_encr_settings() argument
177 if (aes_128_cbc_decrypt(wps->keywrapkey, encr, wpabuf_mhead(decrypted), in wps_decrypt_encr_settings()
272 void wps_fail_event(struct wps_context *wps, enum wps_msg_type msg, in wps_fail_event() argument
277 if (wps->event_cb == NULL) in wps_fail_event()
285 wps->event_cb(wps->cb_ctx, WPS_EV_FAIL, &data); in wps_fail_event()
289 void wps_success_event(struct wps_context *wps, const u8 *mac_addr) in wps_success_event() argument
293 if (wps->event_cb == NULL) in wps_success_event()
298 wps->event_cb(wps->cb_ctx, WPS_EV_SUCCESS, &data); in wps_success_event()
302 void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part, in wps_pwd_auth_fail_event() argument
307 if (wps->event_cb == NULL) in wps_pwd_auth_fail_event()
314 wps->event_cb(wps->cb_ctx, WPS_EV_PWD_AUTH_FAIL, &data); in wps_pwd_auth_fail_event()
318 void wps_pbc_overlap_event(struct wps_context *wps) in wps_pbc_overlap_event() argument
320 if (wps->event_cb == NULL) in wps_pbc_overlap_event()
323 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_OVERLAP, NULL); in wps_pbc_overlap_event()
327 void wps_pbc_timeout_event(struct wps_context *wps) in wps_pbc_timeout_event() argument
329 if (wps->event_cb == NULL) in wps_pbc_timeout_event()
332 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_TIMEOUT, NULL); in wps_pbc_timeout_event()
336 void wps_pbc_active_event(struct wps_context *wps) in wps_pbc_active_event() argument
338 if (wps->event_cb == NULL) in wps_pbc_active_event()
341 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_ACTIVE, NULL); in wps_pbc_active_event()
345 void wps_pbc_disable_event(struct wps_context *wps) in wps_pbc_disable_event() argument
347 if (wps->event_cb == NULL) in wps_pbc_disable_event()
350 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_DISABLE, NULL); in wps_pbc_disable_event()
356 struct wpabuf * wps_get_oob_cred(struct wps_context *wps, int rf_band, in wps_get_oob_cred() argument
370 data.wps = wps; in wps_get_oob_cred()
371 data.auth_type = wps->auth_types; in wps_get_oob_cred()
372 data.encr_type = wps->encr_types; in wps_get_oob_cred()
376 wps_build_mac_addr(plain, wps->dev.mac_addr) || in wps_get_oob_cred()
383 if (wps->wps_state == WPS_STATE_NOT_CONFIGURED && data.new_psk && in wps_get_oob_cred()
384 wps->ap) { in wps_get_oob_cred()
391 os_memcpy(cred.ssid, wps->ssid, wps->ssid_len); in wps_get_oob_cred()
392 cred.ssid_len = wps->ssid_len; in wps_get_oob_cred()
398 wps->wps_state = WPS_STATE_CONFIGURED; in wps_get_oob_cred()
402 if (wps->cred_cb) in wps_get_oob_cred()
403 wps->cred_cb(wps->cb_ctx, &cred); in wps_get_oob_cred()
435 int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr) in wps_oob_use_cred() argument
452 wps->cred_cb(wps->cb_ctx, &local_cred); in wps_oob_use_cred()
575 struct wpabuf * wps_build_wsc_ack(struct wps_data *wps) in wps_build_wsc_ack() argument
587 wps_build_enrollee_nonce(wps, msg) || in wps_build_wsc_ack()
588 wps_build_registrar_nonce(wps, msg) || in wps_build_wsc_ack()
598 struct wpabuf * wps_build_wsc_nack(struct wps_data *wps) in wps_build_wsc_nack() argument
610 wps_build_enrollee_nonce(wps, msg) || in wps_build_wsc_nack()
611 wps_build_registrar_nonce(wps, msg) || in wps_build_wsc_nack()
612 wps_build_config_error(msg, wps->config_error) || in wps_build_wsc_nack()
740 static int wps_build_ssid(struct wpabuf *msg, struct wps_context *wps) in wps_build_ssid() argument
744 wps->ssid, wps->ssid_len); in wps_build_ssid()
746 wpabuf_put_be16(msg, wps->ssid_len); in wps_build_ssid()
747 wpabuf_put_data(msg, wps->ssid, wps->ssid_len); in wps_build_ssid()