Home | History | Annotate | Download | only in wps

Lines Matching refs:wps

23 static int wps_build_mac_addr(struct wps_data *wps, struct wpabuf *msg)
25 wpa_printf(MSG_DEBUG, "WPS: * MAC Address");
28 wpabuf_put_data(msg, wps->mac_addr_e, ETH_ALEN);
33 static int wps_build_wps_state(struct wps_data *wps, struct wpabuf *msg)
36 if (wps->wps->ap)
37 state = wps->wps->wps_state;
40 wpa_printf(MSG_DEBUG, "WPS: * Wi-Fi Protected Setup State (%d)",
49 static int wps_build_e_hash(struct wps_data *wps, struct wpabuf *msg)
55 if (os_get_random(wps->snonce, 2 * WPS_SECRET_NONCE_LEN) < 0)
57 wpa_hexdump(MSG_DEBUG, "WPS: E-S1", wps->snonce, WPS_SECRET_NONCE_LEN);
58 wpa_hexdump(MSG_DEBUG, "WPS: E-S2",
59 wps->snonce + WPS_SECRET_NONCE_LEN, WPS_SECRET_NONCE_LEN);
61 if (wps->dh_pubkey_e == NULL || wps->dh_pubkey_r == NULL) {
62 wpa_printf(MSG_DEBUG, "WPS: DH public keys not available for "
67 wpa_printf(MSG_DEBUG, "WPS: * E-Hash1");
72 addr[0] = wps->snonce;
74 addr[1] = wps->psk1;
76 addr[2] = wpabuf_head(wps->dh_pubkey_e);
77 len[2] = wpabuf_len(wps->dh_pubkey_e);
78 addr[3] = wpabuf_head(wps->dh_pubkey_r);
79 len[3] = wpabuf_len(wps->dh_pubkey_r);
80 hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash);
81 wpa_hexdump(MSG_DEBUG, "WPS: E-Hash1", hash, SHA256_MAC_LEN);
83 wpa_printf(MSG_DEBUG, "WPS: * E-Hash2");
88 addr[0] = wps->snonce + WPS_SECRET_NONCE_LEN;
89 addr[1] = wps->psk2;
90 hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash);
91 wpa_hexdump(MSG_DEBUG, "WPS: E-Hash2", hash, SHA256_MAC_LEN);
97 static int wps_build_e_snonce1(struct wps_data *wps, struct wpabuf *msg)
99 wpa_printf(MSG_DEBUG, "WPS: * E-SNonce1");
102 wpabuf_put_data(msg, wps->snonce, WPS_SECRET_NONCE_LEN);
107 static int wps_build_e_snonce2(struct wps_data *wps, struct wpabuf *msg)
109 wpa_printf(MSG_DEBUG, "WPS: * E-SNonce2");
112 wpabuf_put_data(msg, wps->snonce + WPS_SECRET_NONCE_LEN,
118 static struct wpabuf * wps_build_m1(struct wps_data *wps)
123 if (os_get_random(wps->nonce_e, WPS_NONCE_LEN) < 0)
125 wpa_hexdump(MSG_DEBUG, "WPS: Enrollee Nonce",
126 wps->nonce_e, WPS_NONCE_LEN);
128 wpa_printf(MSG_DEBUG, "WPS: Building Message M1");
134 if (wps->pbc)
139 wps_build_uuid_e(msg, wps->uuid_e) ||
140 wps_build_mac_addr(wps, msg) ||
141 wps_build_enrollee_nonce(wps, msg) ||
142 wps_build_public_key(wps, msg) ||
143 wps_build_auth_type_flags(wps, msg) ||
144 wps_build_encr_type_flags(wps, msg) ||
145 wps_build_conn_type_flags(wps, msg) ||
147 wps_build_wps_state(wps, msg) ||
148 wps_build_device_attrs(&wps->wps->dev, msg) ||
149 wps_build_rf_bands(&wps->wps->dev, msg) ||
150 wps_build_assoc_state(wps, msg) ||
151 wps_build_dev_password_id(msg, wps->dev_pw_id) ||
153 wps_build_os_version(&wps->wps->dev, msg)) {
158 wps->state = RECV_M2;
163 static struct wpabuf * wps_build_m3(struct wps_data *wps)
167 wpa_printf(MSG_DEBUG, "WPS: Building Message M3");
169 if (wps->dev_password == NULL) {
170 wpa_printf(MSG_DEBUG, "WPS: No Device Password available");
173 wps_derive_psk(wps, wps->dev_password, wps->dev_password_len);
181 wps_build_registrar_nonce(wps, msg) ||
182 wps_build_e_hash(wps, msg) ||
183 wps_build_authenticator(wps, msg)) {
188 wps->state = RECV_M4;
193 static struct wpabuf * wps_build_m5(struct wps_data *wps)
197 wpa_printf(MSG_DEBUG, "WPS: Building Message M5");
211 wps_build_registrar_nonce(wps, msg) ||
212 wps_build_e_snonce1(wps, plain) ||
213 wps_build_key_wrap_auth(wps, plain) ||
214 wps_build_encr_settings(wps, msg, plain) ||
215 wps_build_authenticator(wps, msg)) {
222 wps->state = RECV_M6;
227 static int wps_build_cred_ssid(struct wps_data *wps, struct wpabuf *msg)
229 wpa_printf(MSG_DEBUG, "WPS: * SSID");
231 wpabuf_put_be16(msg, wps->wps->ssid_len);
232 wpabuf_put_data(msg, wps->wps->ssid, wps->wps->ssid_len);
237 static int wps_build_cred_auth_type(struct wps_data *wps, struct wpabuf *msg)
239 wpa_printf(MSG_DEBUG, "WPS: * Authentication Type");
242 wpabuf_put_be16(msg, wps->wps->auth_types);
247 static int wps_build_cred_encr_type(struct wps_data *wps, struct wpabuf *msg)
249 wpa_printf(MSG_DEBUG, "WPS: * Encryption Type");
252 wpabuf_put_be16(msg, wps->wps->encr_types);
257 static int wps_build_cred_network_key(struct wps_data *wps, struct wpabuf *msg)
259 wpa_printf(MSG_DEBUG, "WPS: * Network Key");
261 wpabuf_put_be16(msg, wps->wps->network_key_len);
262 wpabuf_put_data(msg, wps->wps->network_key, wps->wps->network_key_len);
267 static int wps_build_cred_mac_addr(struct wps_data *wps, struct wpabuf *msg)
269 wpa_printf(MSG_DEBUG, "WPS: * MAC Address (AP BSSID)");
272 wpabuf_put_data(msg, wps->wps->dev.mac_addr, ETH_ALEN);
277 static int wps_build_ap_settings(struct wps_data *wps, struct wpabuf *plain)
279 if (wps->wps->ap_settings) {
280 wpa_printf(MSG_DEBUG, "WPS: * AP Settings (pre-configured)");
281 wpabuf_put_data(plain, wps->wps->ap_settings,
282 wps->wps->ap_settings_len);
286 return wps_build_cred_ssid(wps, plain) ||
287 wps_build_cred_mac_addr(wps, plain) ||
288 wps_build_cred_auth_type(wps, plain) ||
289 wps_build_cred_encr_type(wps, plain) ||
290 wps_build_cred_network_key(wps, plain);
294 static struct wpabuf * wps_build_m7(struct wps_data *wps)
298 wpa_printf(MSG_DEBUG, "WPS: Building Message M7");
300 plain = wpabuf_alloc(500 + wps->wps->ap_settings_len);
304 msg = wpabuf_alloc(1000 + wps->wps->ap_settings_len);
312 wps_build_registrar_nonce(wps, msg) ||
313 wps_build_e_snonce2(wps, plain) ||
314 (wps->wps->ap && wps_build_ap_settings(wps, plain)) ||
315 wps_build_key_wrap_auth(wps, plain) ||
316 wps_build_encr_settings(wps, msg, plain) ||
317 wps_build_authenticator(wps, msg)) {
324 wps->state = RECV_M8;
329 static struct wpabuf * wps_build_wsc_done(struct wps_data *wps)
333 wpa_printf(MSG_DEBUG, "WPS: Building Message WSC_Done");
341 wps_build_enrollee_nonce(wps, msg) ||
342 wps_build_registrar_nonce(wps, msg)) {
347 if (wps->wps->ap)
348 wps->state = RECV_ACK;
350 wps_success_event(wps->wps);
351 wps->state = WPS_FINISHED;
357 static struct wpabuf * wps_build_wsc_ack(struct wps_data *wps)
361 wpa_printf(MSG_DEBUG, "WPS: Building Message WSC_ACK");
369 wps_build_enrollee_nonce(wps, msg) ||
370 wps_build_registrar_nonce(wps, msg)) {
379 static struct wpabuf * wps_build_wsc_nack(struct wps_data *wps)
383 wpa_printf(MSG_DEBUG, "WPS: Building Message WSC_NACK");
391 wps_build_enrollee_nonce(wps, msg) ||
392 wps_build_registrar_nonce(wps, msg) ||
393 wps_build_config_error(msg, wps->config_error)) {
402 struct wpabuf * wps_enrollee_get_msg(struct wps_data *wps,
407 switch (wps->state) {
409 msg = wps_build_m1(wps);
413 msg = wps_build_m3(wps);
417 msg = wps_build_m5(wps);
421 msg = wps_build_m7(wps);
425 if (wps->wps->ap) {
426 msg = wps_build_wsc_nack(wps);
430 msg = wps_build_wsc_ack(wps);
434 wps->state = RECV_M2;
438 msg = wps_build_wsc_nack(wps);
442 msg = wps_build_wsc_done(wps);
446 wpa_printf(MSG_DEBUG, "WPS: Unsupported state %d for building "
447 "a message", wps->state);
455 wpabuf_free(wps->last_msg);
456 wps->last_msg = wpabuf_dup(msg);
463 static int wps_process_registrar_nonce(struct wps_data *wps, const u8 *r_nonce)
466 wpa_printf(MSG_DEBUG, "WPS: No Registrar Nonce received");
470 os_memcpy(wps->nonce_r, r_nonce, WPS_NONCE_LEN);
471 wpa_hexdump(MSG_DEBUG, "WPS: Registrar Nonce",
472 wps->nonce_r, WPS_NONCE_LEN);
478 static int wps_process_enrollee_nonce(struct wps_data *wps, const u8 *e_nonce)
481 wpa_printf(MSG_DEBUG, "WPS: No Enrollee Nonce received");
485 if (os_memcmp(wps->nonce_e, e_nonce, WPS_NONCE_LEN) != 0) {
486 wpa_printf(MSG_DEBUG, "WPS: Invalid Enrollee Nonce received");
494 static int wps_process_uuid_r(struct wps_data *wps, const u8 *uuid_r)
497 wpa_printf(MSG_DEBUG, "WPS: No UUID-R received");
501 os_memcpy(wps->uuid_r, uuid_r, WPS_UUID_LEN);
502 wpa_hexdump(MSG_DEBUG, "WPS: UUID-R", wps->uuid_r, WPS_UUID_LEN);
508 static int wps_process_pubkey(struct wps_data *wps, const u8 *pk,
512 wpa_printf(MSG_DEBUG, "WPS: No Public Key received");
516 wpabuf_free(wps->dh_pubkey_r);
517 wps->dh_pubkey_r = wpabuf_alloc_copy(pk, pk_len);
518 if (wps->dh_pubkey_r == NULL)
521 if (wps_derive_keys(wps) < 0)
528 static int wps_process_r_hash1(struct wps_data *wps, const u8 *r_hash1)
531 wpa_printf(MSG_DEBUG, "WPS: No R-Hash1 received");
535 os_memcpy(wps->peer_hash1, r_hash1, WPS_HASH_LEN);
536 wpa_hexdump(MSG_DEBUG, "WPS: R-Hash1", wps->peer_hash1, WPS_HASH_LEN);
542 static int wps_process_r_hash2(struct wps_data *wps, const u8 *r_hash2)
545 wpa_printf(MSG_DEBUG, "WPS: No R-Hash2 received");
549 os_memcpy(wps->peer_hash2, r_hash2, WPS_HASH_LEN);
550 wpa_hexdump(MSG_DEBUG, "WPS: R-Hash2", wps->peer_hash2, WPS_HASH_LEN);
556 static int wps_process_r_snonce1(struct wps_data *wps, const u8 *r_snonce1)
563 wpa_printf(MSG_DEBUG, "WPS: No R-SNonce1 received");
567 wpa_hexdump_key(MSG_DEBUG, "WPS: R-SNonce1", r_snonce1,
573 addr[1] = wps->psk1;
575 addr[2] = wpabuf_head(wps->dh_pubkey_e);
576 len[2] = wpabuf_len(wps->dh_pubkey_e);
577 addr[3] = wpabuf_head(wps->dh_pubkey_r);
578 len[3] = wpabuf_len(wps->dh_pubkey_r);
579 hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash);
581 if (os_memcmp(wps->peer_hash1, hash, WPS_HASH_LEN) != 0) {
582 wpa_printf(MSG_DEBUG, "WPS: R-Hash1 derived from R-S1 does "
584 wps->config_error = WPS_CFG_DEV_PASSWORD_AUTH_FAILURE;
585 wps_pwd_auth_fail_event(wps->wps, 1, 1);
589 wpa_printf(MSG_DEBUG, "WPS: Registrar proved knowledge of the first "
596 static int wps_process_r_snonce2(struct wps_data *wps, const u8 *r_snonce2)
603 wpa_printf(MSG_DEBUG, "WPS: No R-SNonce2 received");
607 wpa_hexdump_key(MSG_DEBUG, "WPS: R-SNonce2", r_snonce2,
613 addr[1] = wps->psk2;
615 addr[2] = wpabuf_head(wps->dh_pubkey_e);
616 len[2] = wpabuf_len(wps->dh_pubkey_e);
617 addr[3] = wpabuf_head(wps->dh_pubkey_r);
618 len[3] = wpabuf_len(wps->dh_pubkey_r);
619 hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 4, addr, len, hash);
621 if (os_memcmp(wps->peer_hash2, hash, WPS_HASH_LEN) != 0) {
622 wpa_printf(MSG_DEBUG, "WPS: R-Hash2 derived from R-S2 does "
624 wps->config_error = WPS_CFG_DEV_PASSWORD_AUTH_FAILURE;
625 wps_pwd_auth_fail_event(wps->wps, 1, 2);
629 wpa_printf(MSG_DEBUG, "WPS: Registrar proved knowledge of the second "
636 static int wps_process_cred_e(struct wps_data *wps, const u8 *cred,
642 wpa_printf(MSG_DEBUG, "WPS: Received Credential");
643 os_memset(&wps->cred, 0, sizeof(wps->cred));
646 wps_process_cred(&attr, &wps->cred))
649 if (os_memcmp(wps->cred.mac_addr, wps->wps->dev.mac_addr, ETH_ALEN) !=
651 wpa_printf(MSG_DEBUG, "WPS: MAC Address in the Credential ("
653 ")", MAC2STR(wps->cred.mac_addr),
654 MAC2STR(wps->wps->dev.mac_addr));
664 if (wps->wps->cred_cb) {
665 wps->cred.cred_attr = cred - 4;
666 wps->cred.cred_attr_len = cred_len + 4;
667 wps->wps->cred_cb(wps->wps->cb_ctx, &wps->cred);
668 wps->cred.cred_attr = NULL;
669 wps->cred.cred_attr_len = 0;
676 static int wps_process_creds(struct wps_data *wps, const u8 *cred[],
681 if (wps->wps->ap)
685 wpa_printf(MSG_DEBUG, "WPS: No Credential attributes "
691 if (wps_process_cred_e(wps, cred[i], cred_len[i]))
699 static int wps_process_ap_settings_e(struct wps_data *wps,
705 if (!wps->wps->ap)
711 wpa_printf(MSG_INFO, "WPS: Received new AP configuration from "
714 if (os_memcmp(cred.mac_addr, wps->wps->dev.mac_addr, ETH_ALEN) !=
716 wpa_printf(MSG_DEBUG, "WPS: MAC Address in the AP Settings ("
719 MAC2STR(wps->wps->dev.mac_addr));
729 if (wps->wps->cred_cb) {
732 wps->wps->cred_cb(wps->wps->cb_ctx, &cred);
739 static enum wps_process_res wps_process_m2(struct wps_data *wps,
743 wpa_printf(MSG_DEBUG, "WPS: Received M2");
745 if (wps->state != RECV_M2) {
746 wpa_printf(MSG_DEBUG, "WPS: Unexpected state (%d) for "
747 "receiving M2", wps->state);
748 wps->state = SEND_WSC_NACK;
752 if (wps_process_registrar_nonce(wps, attr->registrar_nonce) ||
753 wps_process_enrollee_nonce(wps, attr->enrollee_nonce) ||
754 wps_process_uuid_r(wps, attr->uuid_r) ||
755 wps_process_pubkey(wps, attr->public_key, attr->public_key_len) ||
756 wps_process_authenticator(wps, attr->authenticator, msg)) {
757 wps->state = SEND_WSC_NACK;
761 if (wps->wps->ap && wps->wps->ap_setup_locked) {
762 wpa_printf(MSG_DEBUG, "WPS: AP Setup is locked - refuse "
764 wps->config_error = WPS_CFG_SETUP_LOCKED;
765 wps->state = SEND_WSC_NACK;
769 wps->state = SEND_M3;
774 static enum wps_process_res wps_process_m2d(struct wps_data *wps,
777 wpa_printf(MSG_DEBUG, "WPS: Received M2D");
779 if (wps->state != RECV_M2) {
780 wpa_printf(MSG_DEBUG, "WPS: Unexpected state (%d) for "
781 "receiving M2D", wps->state);
782 wps->state = SEND_WSC_NACK;
786 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Manufacturer",
788 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Model Name",
790 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Model Number",
792 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Serial Number",
794 wpa_hexdump_ascii(MSG_DEBUG, "WPS: Device Name",
797 if (wps->wps->event_cb) {
821 wps->wps->event_cb(wps->wps->cb_ctx, WPS_EV_M2D, &data);
824 wps->state = RECEIVED_M2D;
829 static enum wps_process_res wps_process_m4(struct wps_data *wps,
836 wpa_printf(MSG_DEBUG, "WPS: Received M4");
838 if (wps->state != RECV_M4) {
839 wpa_printf(MSG_DEBUG, "WPS: Unexpected state (%d) for "
840 "receiving M4", wps->state);
841 wps->state = SEND_WSC_NACK;
845 if (wps_process_enrollee_nonce(wps, attr->enrollee_nonce) ||
846 wps_process_authenticator(wps, attr->authenticator, msg) ||
847 wps_process_r_hash1(wps, attr->r_hash1) ||
848 wps_process_r_hash2(wps, attr->r_hash2)) {
849 wps->state = SEND_WSC_NACK;
853 decrypted = wps_decrypt_encr_settings(wps, attr->encr_settings,
856 wpa_printf(MSG_DEBUG, "WPS: Failed to decrypted Encrypted "
858 wps->state = SEND_WSC_NACK;
862 wpa_printf(MSG_DEBUG, "WPS: Processing decrypted Encrypted Settings "
865 wps_process_key_wrap_auth(wps, decrypted, eattr.key_wrap_auth) ||
866 wps_process_r_snonce1(wps, eattr.r_snonce1)) {
868 wps->state = SEND_WSC_NACK;
873 wps->state = SEND_M5;
878 static enum wps_process_res wps_process_m6(struct wps_data *wps,
885 wpa_printf(MSG_DEBUG, "WPS: Received M6");
887 if (wps->state != RECV_M6) {
888 wpa_printf(MSG_DEBUG, "WPS: Unexpected state (%d) for "
889 "receiving M6", wps->state);
890 wps->state = SEND_WSC_NACK;
894 if (wps_process_enrollee_nonce(wps, attr->enrollee_nonce) ||
895 wps_process_authenticator(wps, attr->authenticator, msg)) {
896 wps->state = SEND_WSC_NACK;
900 decrypted = wps_decrypt_encr_settings(wps, attr->encr_settings,
903 wpa_printf(MSG_DEBUG, "WPS: Failed to decrypted Encrypted "
905 wps->state = SEND_WSC_NACK;
909 wpa_printf(MSG_DEBUG, "WPS: Processing decrypted Encrypted Settings "
912 wps_process_key_wrap_auth(wps, decrypted, eattr.key_wrap_auth) ||
913 wps_process_r_snonce2(wps, eattr.r_snonce2)) {
915 wps->state = SEND_WSC_NACK;
920 wps->state = SEND_M7;
925 static enum wps_process_res wps_process_m8(struct wps_data *wps,
932 wpa_printf(MSG_DEBUG, "WPS: Received M8");
934 if (wps->state != RECV_M8) {
935 wpa_printf(MSG_DEBUG, "WPS: Unexpected state (%d) for "
936 "receiving M8", wps->state);
937 wps->state = SEND_WSC_NACK;
941 if (wps_process_enrollee_nonce(wps, attr->enrollee_nonce) ||
942 wps_process_authenticator(wps, attr->authenticator, msg)) {
943 wps->state = SEND_WSC_NACK;
947 decrypted = wps_decrypt_encr_settings(wps, attr->encr_settings,
950 wpa_printf(MSG_DEBUG, "WPS: Failed to decrypted Encrypted "
952 wps->state = SEND_WSC_NACK;
956 wpa_printf(MSG_DEBUG, "WPS: Processing decrypted Encrypted Settings "
959 wps_process_key_wrap_auth(wps, decrypted, eattr.key_wrap_auth) ||
960 wps_process_creds(wps, eattr.cred, eattr.cred_len,
962 wps_process_ap_settings_e(wps, &eattr, decrypted)) {
964 wps->state = SEND_WSC_NACK;
969 wps->state = WPS_MSG_DONE;
974 static enum wps_process_res wps_process_wsc_msg(struct wps_data *wps,
980 wpa_printf(MSG_DEBUG, "WPS: Received WSC_MSG");
986 wpa_printf(MSG_DEBUG, "WPS: Unsupported message version 0x%x",
992 os_memcmp(wps->nonce_e, attr.enrollee_nonce, WPS_NONCE_LEN != 0)) {
993 wpa_printf(MSG_DEBUG, "WPS: Mismatch in enrollee nonce");
998 wpa_printf(MSG_DEBUG, "WPS: No Message Type attribute");
1004 ret = wps_process_m2(wps, msg, &attr);
1007 ret = wps_process_m2d(wps, &attr);
1010 ret = wps_process_m4(wps, msg, &attr);
1011 if (ret == WPS_FAILURE || wps->state == SEND_WSC_NACK)
1012 wps_fail_event(wps->wps, WPS_M4);
1015 ret = wps_process_m6(wps, msg, &attr);
1016 if (ret == WPS_FAILURE || wps->state == SEND_WSC_NACK)
1017 wps_fail_event(wps->wps, WPS_M6);
1020 ret = wps_process_m8(wps, msg, &attr);
1021 if (ret == WPS_FAILURE || wps->state == SEND_WSC_NACK)
1022 wps_fail_event(wps->wps, WPS_M8);
1025 wpa_printf(MSG_DEBUG, "WPS: Unsupported Message Type %d",
1040 wpabuf_free(wps->last_msg);
1041 wps->last_msg = wpabuf_dup(msg);
1048 static enum wps_process_res wps_process_wsc_ack(struct wps_data *wps,
1053 wpa_printf(MSG_DEBUG, "WPS: Received WSC_ACK");
1059 wpa_printf(MSG_DEBUG, "WPS: Unsupported message version 0x%x",
1065 wpa_printf(MSG_DEBUG, "WPS: No Message Type attribute");
1070 wpa_printf(MSG_DEBUG, "WPS: Invalid Message Type %d",
1076 os_memcmp(wps->nonce_r, attr.registrar_nonce, WPS_NONCE_LEN != 0))
1078 wpa_printf(MSG_DEBUG, "WPS: Mismatch in registrar nonce");
1083 os_memcmp(wps->nonce_e, attr.enrollee_nonce, WPS_NONCE_LEN != 0)) {
1084 wpa_printf(MSG_DEBUG, "WPS: Mismatch in enrollee nonce");
1088 if (wps->state == RECV_ACK && wps->wps->ap) {
1089 wpa_printf(MSG_DEBUG, "WPS: External Registrar registration "
1091 wps_success_event(wps->wps);
1092 wps->state = WPS_FINISHED;
1100 static enum wps_process_res wps_process_wsc_nack(struct wps_data *wps,
1105 wpa_printf(MSG_DEBUG, "WPS: Received WSC_NACK");
1111 wpa_printf(MSG_DEBUG, "WPS: Unsupported message version 0x%x",
1117 wpa_printf(MSG_DEBUG, "WPS: No Message Type attribute");
1122 wpa_printf(MSG_DEBUG, "WPS: Invalid Message Type %d",
1128 os_memcmp(wps->nonce_r, attr.registrar_nonce, WPS_NONCE_LEN != 0))
1130 wpa_printf(MSG_DEBUG, "WPS: Mismatch in registrar nonce");
1131 wpa_hexdump(MSG_DEBUG, "WPS: Received Registrar Nonce",
1133 wpa_hexdump(MSG_DEBUG, "WPS: Expected Registrar Nonce",
1134 wps->nonce_r, WPS_NONCE_LEN);
1139 os_memcmp(wps->nonce_e, attr.enrollee_nonce, WPS_NONCE_LEN != 0)) {
1140 wpa_printf(MSG_DEBUG, "WPS: Mismatch in enrollee nonce");
1141 wpa_hexdump(MSG_DEBUG, "WPS: Received Enrollee Nonce",
1143 wpa_hexdump(MSG_DEBUG, "WPS: Expected Enrollee Nonce",
1144 wps->nonce_e, WPS_NONCE_LEN);
1149 wpa_printf(MSG_DEBUG, "WPS: No Configuration Error attribute "
1154 wpa_printf(MSG_DEBUG, "WPS: Registrar terminated negotiation with "
1157 switch (wps->state) {
1159 wps_fail_event(wps->wps, WPS_M3);
1162 wps_fail_event(wps->wps, WPS_M5);
1165 wps_fail_event(wps->wps, WPS_M7);
1173 wps->state = SEND_WSC_NACK;
1179 enum wps_process_res wps_enrollee_process_msg(struct wps_data *wps,
1184 wpa_printf(MSG_DEBUG, "WPS: Processing received message (len=%lu "
1202 return wps_process_wsc_msg(wps, msg);
1204 return wps_process_wsc_ack(wps, msg);
1206 return wps_process_wsc_nack(wps, msg);
1208 wpa_printf(MSG_DEBUG, "WPS: Unsupported op_code %d", op_code);