Home | History | Annotate | Download | only in wps

Lines Matching refs:wps

59 int wps_derive_keys(struct wps_data *wps)
67 if (wps->dh_privkey == NULL) {
68 wpa_printf(MSG_DEBUG, "WPS: Own DH private key not available");
72 pubkey = wps->registrar ? wps->dh_pubkey_e : wps->dh_pubkey_r;
74 wpa_printf(MSG_DEBUG, "WPS: Peer DH public key not available");
78 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: DH Private Key", wps->dh_privkey);
79 wpa_hexdump_buf(MSG_DEBUG, "WPS: DH peer Public Key", pubkey);
80 dh_shared = dh5_derive_shared(wps->dh_ctx, pubkey, wps->dh_privkey);
81 dh5_free(wps->dh_ctx);
82 wps->dh_ctx = NULL;
85 wpa_printf(MSG_DEBUG, "WPS: Failed to derive DH shared key");
90 wpabuf_free(wps->dh_privkey);
91 wps->dh_privkey = NULL;
93 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: DH shared key", dh_shared);
99 wpa_hexdump_key(MSG_DEBUG, "WPS: DHKey", dhkey, sizeof(dhkey));
103 addr[0] = wps->nonce_e;
105 addr[1] = wps->mac_addr_e;
107 addr[2] = wps->nonce_r;
110 wpa_hexdump_key(MSG_DEBUG, "WPS: KDK", kdk, sizeof(kdk));
114 os_memcpy(wps->authkey, keys, WPS_AUTHKEY_LEN);
115 os_memcpy(wps->keywrapkey, keys + WPS_AUTHKEY_LEN, WPS_KEYWRAPKEY_LEN);
116 os_memcpy(wps->emsk, keys + WPS_AUTHKEY_LEN + WPS_KEYWRAPKEY_LEN,
119 wpa_hexdump_key(MSG_DEBUG, "WPS: AuthKey",
120 wps->authkey, WPS_AUTHKEY_LEN);
121 wpa_hexdump_key(MSG_DEBUG, "WPS: KeyWrapKey",
122 wps->keywrapkey, WPS_KEYWRAPKEY_LEN);
123 wpa_hexdump_key(MSG_DEBUG, "WPS: EMSK", wps->emsk, WPS_EMSK_LEN);
129 void wps_derive_psk(struct wps_data *wps, const u8 *dev_passwd,
134 hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd,
136 os_memcpy(wps->psk1, hash, WPS_PSK_LEN);
137 hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN,
140 os_memcpy(wps->psk2, hash, WPS_PSK_LEN);
142 wpa_hexdump_ascii_key(MSG_DEBUG, "WPS: Device Password",
144 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK1", wps->psk1, WPS_PSK_LEN);
145 wpa_hexdump_key(MSG_DEBUG, "WPS: PSK2", wps->psk2, WPS_PSK_LEN);
149 struct wpabuf * wps_decrypt_encr_settings(struct wps_data *wps, const u8 *encr,
161 wpa_printf(MSG_DEBUG, "WPS: No Encrypted Settings received");
169 wpa_hexdump(MSG_MSGDUMP, "WPS: Encrypted Settings", encr, encr_len);
171 if (aes_128_cbc_decrypt(wps->keywrapkey, encr, wpabuf_mhead(decrypted),
177 wpa_hexdump_buf_key(MSG_MSGDUMP, "WPS: Decrypted Encrypted Settings",
183 wpa_printf(MSG_DEBUG, "WPS: Invalid PKCS#5 v2.0 pad value");
189 wpa_printf(MSG_DEBUG, "WPS: Invalid PKCS#5 v2.0 pad "
268 void wps_fail_event(struct wps_context *wps, enum wps_msg_type msg,
273 if (wps->event_cb == NULL)
281 wps->event_cb(wps->cb_ctx, WPS_EV_FAIL, &data);
285 void wps_success_event(struct wps_context *wps, const u8 *mac_addr)
289 if (wps->event_cb == NULL)
294 wps->event_cb(wps->cb_ctx, WPS_EV_SUCCESS, &data);
298 void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part,
303 if (wps->event_cb == NULL)
310 wps->event_cb(wps->cb_ctx, WPS_EV_PWD_AUTH_FAIL, &data);
314 void wps_pbc_overlap_event(struct wps_context *wps)
316 if (wps->event_cb == NULL)
319 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_OVERLAP, NULL);
323 void wps_pbc_timeout_event(struct wps_context *wps)
325 if (wps->event_cb == NULL)
328 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_TIMEOUT, NULL);
332 void wps_pbc_active_event(struct wps_context *wps)
334 if (wps->event_cb == NULL)
337 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_ACTIVE, NULL);
341 void wps_pbc_disable_event(struct wps_context *wps)
343 if (wps->event_cb == NULL)
346 wps->event_cb(wps->cb_ctx, WPS_EV_PBC_DISABLE, NULL);
352 struct wpabuf * wps_get_oob_cred(struct wps_context *wps)
359 wpa_printf(MSG_ERROR, "WPS: Failed to allocate memory for OOB "
365 data.wps = wps;
366 data.auth_type = wps->auth_types;
367 data.encr_type = wps->encr_types;
376 if (wps->wps_state == WPS_STATE_NOT_CONFIGURED && data.new_psk &&
377 wps->ap) {
380 wpa_printf(MSG_DEBUG, "WPS: Moving to Configured state based "
384 os_memcpy(cred.ssid, wps->ssid, wps->ssid_len);
385 cred.ssid_len = wps->ssid_len;
391 wps->wps_state = WPS_STATE_CONFIGURED;
393 "WPS: Generated random passphrase",
395 if (wps->cred_cb)
396 wps->cred_cb(wps->cb_ctx, &cred);
419 wpa_printf(MSG_ERROR, "WPS: Failed to build NFC password "
429 int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr)
442 wpa_printf(MSG_ERROR, "WPS: Failed to parse OOB "
446 wps->cred_cb(wps->cb_ctx, &local_cred);
568 struct wpabuf * wps_build_wsc_ack(struct wps_data *wps)
572 wpa_printf(MSG_DEBUG, "WPS: Building Message WSC_ACK");
580 wps_build_enrollee_nonce(wps, msg) ||
581 wps_build_registrar_nonce(wps, msg) ||
591 struct wpabuf * wps_build_wsc_nack(struct wps_data *wps)
595 wpa_printf(MSG_DEBUG, "WPS: Building Message WSC_NACK");
603 wps_build_enrollee_nonce(wps, msg) ||
604 wps_build_registrar_nonce(wps, msg) ||
605 wps_build_config_error(msg, wps->config_error) ||