Home | History | Annotate | Download | only in wps

Lines Matching refs:wps

21 int wps_build_public_key(struct wps_data *wps, struct wpabuf *msg)
25 wpa_printf(MSG_DEBUG, "WPS: * Public Key");
26 wpabuf_free(wps->dh_privkey);
27 if (wps->dev_pw_id != DEV_PW_DEFAULT && wps->wps->dh_privkey) {
28 wpa_printf(MSG_DEBUG, "WPS: Using pre-configured DH keys");
29 wps->dh_privkey = wpabuf_dup(wps->wps->dh_privkey);
30 wps->dh_ctx = wps->wps->dh_ctx;
31 wps->wps->dh_ctx = NULL;
32 pubkey = wpabuf_dup(wps->wps->dh_pubkey);
34 } else if (wps->dev_pw_id >= 0x10 && wps->wps->ap &&
35 wps->dev_pw_id == wps->wps->ap_nfc_dev_pw_id) {
36 wpa_printf(MSG_DEBUG, "WPS: Using NFC password token DH keys");
37 wps->dh_privkey = wpabuf_dup(wps->wps->ap_nfc_dh_privkey);
38 pubkey = wpabuf_dup(wps->wps->ap_nfc_dh_pubkey);
39 wps->dh_ctx = dh5_init_fixed(wps->dh_privkey, pubkey);
42 wpa_printf(MSG_DEBUG, "WPS: Generate new DH keys");
43 wps->dh_privkey = NULL;
44 dh5_free(wps->dh_ctx);
45 wps->dh_ctx = dh5_init(&wps->dh_privkey, &pubkey);
48 if (wps->dh_ctx == NULL || wps->dh_privkey == NULL || pubkey == NULL) {
49 wpa_printf(MSG_DEBUG, "WPS: Failed to initialize "
54 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: DH Private Key", wps->dh_privkey);
55 wpa_hexdump_buf(MSG_DEBUG, "WPS: DH own Public Key", pubkey);
61 if (wps->registrar) {
62 wpabuf_free(wps->dh_pubkey_r);
63 wps->dh_pubkey_r = pubkey;
65 wpabuf_free(wps->dh_pubkey_e);
66 wps->dh_pubkey_e = pubkey;
75 wpa_printf(MSG_DEBUG, "WPS: * Request Type");
85 wpa_printf(MSG_DEBUG, "WPS: * Response Type (%d)", type);
95 wpa_printf(MSG_DEBUG, "WPS: * Config Methods (%x)", methods);
105 wpa_printf(MSG_DEBUG, "WPS: * UUID-E");
115 wpa_printf(MSG_DEBUG, "WPS: * Device Password ID (%d)", id);
125 wpa_printf(MSG_DEBUG, "WPS: * Configuration Error (%d)", err);
133 int wps_build_authenticator(struct wps_data *wps, struct wpabuf *msg)
139 if (wps->last_msg == NULL) {
140 wpa_printf(MSG_DEBUG, "WPS: Last message not available for "
148 addr[0] = wpabuf_head(wps->last_msg);
149 len[0] = wpabuf_len(wps->last_msg);
152 hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 2, addr, len, hash);
154 wpa_printf(MSG_DEBUG, "WPS: * Authenticator");
170 wpa_printf(MSG_DEBUG, "WPS: * Version (hardcoded 0x10)");
188 wpa_printf(MSG_DEBUG, "WPS: * Version2 (0x%x)", WPS_VERSION);
194 wpa_printf(MSG_DEBUG, "WPS: * Request to Enroll (1)");
202 wpa_printf(MSG_DEBUG, "WPS: * AuthorizedMACs (count=%d)",
208 wpa_printf(MSG_DEBUG, "WPS: AuthorizedMAC: " MACSTR,
217 wpa_printf(MSG_DEBUG, "WPS: * Extensibility Testing - extra "
230 wpa_printf(MSG_DEBUG, "WPS: * Message Type (%d)", msg_type);
238 int wps_build_enrollee_nonce(struct wps_data *wps, struct wpabuf *msg)
240 wpa_printf(MSG_DEBUG, "WPS: * Enrollee Nonce");
243 wpabuf_put_data(msg, wps->nonce_e, WPS_NONCE_LEN);
248 int wps_build_registrar_nonce(struct wps_data *wps, struct wpabuf *msg)
250 wpa_printf(MSG_DEBUG, "WPS: * Registrar Nonce");
253 wpabuf_put_data(msg, wps->nonce_r, WPS_NONCE_LEN);
258 int wps_build_auth_type_flags(struct wps_data *wps, struct wpabuf *msg)
264 wpa_printf(MSG_DEBUG, "WPS: * Authentication Type Flags");
272 int wps_build_encr_type_flags(struct wps_data *wps, struct wpabuf *msg)
278 wpa_printf(MSG_DEBUG, "WPS: * Encryption Type Flags");
286 int wps_build_conn_type_flags(struct wps_data *wps, struct wpabuf *msg)
288 wpa_printf(MSG_DEBUG, "WPS: * Connection Type Flags");
296 int wps_build_assoc_state(struct wps_data *wps, struct wpabuf *msg)
298 wpa_printf(MSG_DEBUG, "WPS: * Association State");
306 int wps_build_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg)
310 wpa_printf(MSG_DEBUG, "WPS: * Key Wrap Authenticator");
311 hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg),
321 int wps_build_encr_settings(struct wps_data *wps, struct wpabuf *msg,
328 wpa_printf(MSG_DEBUG, "WPS: * Encrypted Settings");
343 if (aes_128_cbc_encrypt(wps->keywrapkey, iv, data, wpabuf_len(plain)))
373 int wps_build_oob_dev_password(struct wpabuf *msg, struct wps_context *wps)
377 wpa_printf(MSG_DEBUG, "WPS: * OOB Device Password");
379 if (os_get_random((u8 *) &wps->oob_dev_pw_id, sizeof(u16)) < 0) {
380 wpa_printf(MSG_ERROR, "WPS: device password id "
384 wps->oob_dev_pw_id |= 0x0010;
388 wpa_printf(MSG_ERROR, "WPS: OOB device password "
394 wpabuf_put(wps->oob_conf.dev_password,
395 wpabuf_size(wps->oob_conf.dev_password)),
396 wpabuf_size(wps->oob_conf.dev_password),
399 return wps_build_oob_dev_pw(msg, wps->oob_dev_pw_id, wps->dh_pubkey,
406 /* Encapsulate WPS IE data with one (or more, if needed) IE headers */