]> git.ipfire.org Git - thirdparty/hostap.git/blob - src/wps/wps.c
P2P NFC: Report connection handover as trigger for P2P
[thirdparty/hostap.git] / src / wps / wps.c
1 /*
2 * Wi-Fi Protected Setup
3 * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9 #include "includes.h"
10
11 #include "common.h"
12 #include "crypto/dh_group5.h"
13 #include "common/ieee802_11_defs.h"
14 #include "wps_i.h"
15 #include "wps_dev_attr.h"
16
17
18 #ifdef CONFIG_WPS_TESTING
19 int wps_version_number = 0x20;
20 int wps_testing_dummy_cred = 0;
21 #endif /* CONFIG_WPS_TESTING */
22
23
24 /**
25 * wps_init - Initialize WPS Registration protocol data
26 * @cfg: WPS configuration
27 * Returns: Pointer to allocated data or %NULL on failure
28 *
29 * This function is used to initialize WPS data for a registration protocol
30 * instance (i.e., each run of registration protocol as a Registrar of
31 * Enrollee. The caller is responsible for freeing this data after the
32 * registration run has been completed by calling wps_deinit().
33 */
34 struct wps_data * wps_init(const struct wps_config *cfg)
35 {
36 struct wps_data *data = os_zalloc(sizeof(*data));
37 if (data == NULL)
38 return NULL;
39 data->wps = cfg->wps;
40 data->registrar = cfg->registrar;
41 if (cfg->registrar) {
42 os_memcpy(data->uuid_r, cfg->wps->uuid, WPS_UUID_LEN);
43 } else {
44 os_memcpy(data->mac_addr_e, cfg->wps->dev.mac_addr, ETH_ALEN);
45 os_memcpy(data->uuid_e, cfg->wps->uuid, WPS_UUID_LEN);
46 }
47 if (cfg->pin) {
48 data->dev_pw_id = cfg->dev_pw_id;
49 data->dev_password = os_malloc(cfg->pin_len);
50 if (data->dev_password == NULL) {
51 os_free(data);
52 return NULL;
53 }
54 os_memcpy(data->dev_password, cfg->pin, cfg->pin_len);
55 data->dev_password_len = cfg->pin_len;
56 wpa_hexdump_key(MSG_DEBUG, "WPS: AP PIN dev_password",
57 data->dev_password, data->dev_password_len);
58 }
59
60 #ifdef CONFIG_WPS_NFC
61 if (cfg->pin == NULL &&
62 cfg->dev_pw_id == DEV_PW_NFC_CONNECTION_HANDOVER)
63 data->dev_pw_id = cfg->dev_pw_id;
64
65 if (cfg->wps->ap && !cfg->registrar && cfg->wps->ap_nfc_dev_pw_id) {
66 /* Keep AP PIN as alternative Device Password */
67 data->alt_dev_pw_id = data->dev_pw_id;
68 data->alt_dev_password = data->dev_password;
69 data->alt_dev_password_len = data->dev_password_len;
70
71 data->dev_pw_id = cfg->wps->ap_nfc_dev_pw_id;
72 data->dev_password =
73 os_malloc(wpabuf_len(cfg->wps->ap_nfc_dev_pw));
74 if (data->dev_password == NULL) {
75 os_free(data);
76 return NULL;
77 }
78 os_memcpy(data->dev_password,
79 wpabuf_head(cfg->wps->ap_nfc_dev_pw),
80 wpabuf_len(cfg->wps->ap_nfc_dev_pw));
81 data->dev_password_len = wpabuf_len(cfg->wps->ap_nfc_dev_pw);
82 wpa_hexdump_key(MSG_DEBUG, "WPS: NFC dev_password",
83 data->dev_password, data->dev_password_len);
84 }
85 #endif /* CONFIG_WPS_NFC */
86
87 data->pbc = cfg->pbc;
88 if (cfg->pbc) {
89 /* Use special PIN '00000000' for PBC */
90 data->dev_pw_id = DEV_PW_PUSHBUTTON;
91 os_free(data->dev_password);
92 data->dev_password = (u8 *) os_strdup("00000000");
93 if (data->dev_password == NULL) {
94 os_free(data);
95 return NULL;
96 }
97 data->dev_password_len = 8;
98 }
99
100 data->state = data->registrar ? RECV_M1 : SEND_M1;
101
102 if (cfg->assoc_wps_ie) {
103 struct wps_parse_attr attr;
104 wpa_hexdump_buf(MSG_DEBUG, "WPS: WPS IE from (Re)AssocReq",
105 cfg->assoc_wps_ie);
106 if (wps_parse_msg(cfg->assoc_wps_ie, &attr) < 0) {
107 wpa_printf(MSG_DEBUG, "WPS: Failed to parse WPS IE "
108 "from (Re)AssocReq");
109 } else if (attr.request_type == NULL) {
110 wpa_printf(MSG_DEBUG, "WPS: No Request Type attribute "
111 "in (Re)AssocReq WPS IE");
112 } else {
113 wpa_printf(MSG_DEBUG, "WPS: Request Type (from WPS IE "
114 "in (Re)AssocReq WPS IE): %d",
115 *attr.request_type);
116 data->request_type = *attr.request_type;
117 }
118 }
119
120 if (cfg->new_ap_settings) {
121 data->new_ap_settings =
122 os_malloc(sizeof(*data->new_ap_settings));
123 if (data->new_ap_settings == NULL) {
124 os_free(data->dev_password);
125 os_free(data);
126 return NULL;
127 }
128 os_memcpy(data->new_ap_settings, cfg->new_ap_settings,
129 sizeof(*data->new_ap_settings));
130 }
131
132 if (cfg->peer_addr)
133 os_memcpy(data->peer_dev.mac_addr, cfg->peer_addr, ETH_ALEN);
134 if (cfg->p2p_dev_addr)
135 os_memcpy(data->p2p_dev_addr, cfg->p2p_dev_addr, ETH_ALEN);
136
137 data->use_psk_key = cfg->use_psk_key;
138 data->pbc_in_m1 = cfg->pbc_in_m1;
139
140 if (cfg->peer_pubkey_hash) {
141 os_memcpy(data->peer_pubkey_hash, cfg->peer_pubkey_hash,
142 WPS_OOB_PUBKEY_HASH_LEN);
143 data->peer_pubkey_hash_set = 1;
144 }
145
146 return data;
147 }
148
149
150 /**
151 * wps_deinit - Deinitialize WPS Registration protocol data
152 * @data: WPS Registration protocol data from wps_init()
153 */
154 void wps_deinit(struct wps_data *data)
155 {
156 #ifdef CONFIG_WPS_NFC
157 if (data->registrar && data->nfc_pw_token)
158 wps_registrar_remove_nfc_pw_token(data->wps->registrar,
159 data->nfc_pw_token);
160 #endif /* CONFIG_WPS_NFC */
161
162 if (data->wps_pin_revealed) {
163 wpa_printf(MSG_DEBUG, "WPS: Full PIN information revealed and "
164 "negotiation failed");
165 if (data->registrar)
166 wps_registrar_invalidate_pin(data->wps->registrar,
167 data->uuid_e);
168 } else if (data->registrar)
169 wps_registrar_unlock_pin(data->wps->registrar, data->uuid_e);
170
171 wpabuf_free(data->dh_privkey);
172 wpabuf_free(data->dh_pubkey_e);
173 wpabuf_free(data->dh_pubkey_r);
174 wpabuf_free(data->last_msg);
175 os_free(data->dev_password);
176 os_free(data->alt_dev_password);
177 os_free(data->new_psk);
178 wps_device_data_free(&data->peer_dev);
179 os_free(data->new_ap_settings);
180 dh5_free(data->dh_ctx);
181 os_free(data);
182 }
183
184
185 /**
186 * wps_process_msg - Process a WPS message
187 * @wps: WPS Registration protocol data from wps_init()
188 * @op_code: Message OP Code
189 * @msg: Message data
190 * Returns: Processing result
191 *
192 * This function is used to process WPS messages with OP Codes WSC_ACK,
193 * WSC_NACK, WSC_MSG, and WSC_Done. The caller (e.g., EAP server/peer) is
194 * responsible for reassembling the messages before calling this function.
195 * Response to this message is built by calling wps_get_msg().
196 */
197 enum wps_process_res wps_process_msg(struct wps_data *wps,
198 enum wsc_op_code op_code,
199 const struct wpabuf *msg)
200 {
201 if (wps->registrar)
202 return wps_registrar_process_msg(wps, op_code, msg);
203 else
204 return wps_enrollee_process_msg(wps, op_code, msg);
205 }
206
207
208 /**
209 * wps_get_msg - Build a WPS message
210 * @wps: WPS Registration protocol data from wps_init()
211 * @op_code: Buffer for returning message OP Code
212 * Returns: The generated WPS message or %NULL on failure
213 *
214 * This function is used to build a response to a message processed by calling
215 * wps_process_msg(). The caller is responsible for freeing the buffer.
216 */
217 struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code)
218 {
219 if (wps->registrar)
220 return wps_registrar_get_msg(wps, op_code);
221 else
222 return wps_enrollee_get_msg(wps, op_code);
223 }
224
225
226 /**
227 * wps_is_selected_pbc_registrar - Check whether WPS IE indicates active PBC
228 * @msg: WPS IE contents from Beacon or Probe Response frame
229 * Returns: 1 if PBC Registrar is active, 0 if not
230 */
231 int wps_is_selected_pbc_registrar(const struct wpabuf *msg)
232 {
233 struct wps_parse_attr attr;
234
235 /*
236 * In theory, this could also verify that attr.sel_reg_config_methods
237 * includes WPS_CONFIG_PUSHBUTTON, but some deployed AP implementations
238 * do not set Selected Registrar Config Methods attribute properly, so
239 * it is safer to just use Device Password ID here.
240 */
241
242 if (wps_parse_msg(msg, &attr) < 0 ||
243 !attr.selected_registrar || *attr.selected_registrar == 0 ||
244 !attr.dev_password_id ||
245 WPA_GET_BE16(attr.dev_password_id) != DEV_PW_PUSHBUTTON)
246 return 0;
247
248 #ifdef CONFIG_WPS_STRICT
249 if (!attr.sel_reg_config_methods ||
250 !(WPA_GET_BE16(attr.sel_reg_config_methods) &
251 WPS_CONFIG_PUSHBUTTON))
252 return 0;
253 #endif /* CONFIG_WPS_STRICT */
254
255 return 1;
256 }
257
258
259 static int is_selected_pin_registrar(struct wps_parse_attr *attr)
260 {
261 /*
262 * In theory, this could also verify that attr.sel_reg_config_methods
263 * includes WPS_CONFIG_LABEL, WPS_CONFIG_DISPLAY, or WPS_CONFIG_KEYPAD,
264 * but some deployed AP implementations do not set Selected Registrar
265 * Config Methods attribute properly, so it is safer to just use
266 * Device Password ID here.
267 */
268
269 if (!attr->selected_registrar || *attr->selected_registrar == 0)
270 return 0;
271
272 if (attr->dev_password_id != NULL &&
273 WPA_GET_BE16(attr->dev_password_id) == DEV_PW_PUSHBUTTON)
274 return 0;
275
276 #ifdef CONFIG_WPS_STRICT
277 if (!attr->sel_reg_config_methods ||
278 !(WPA_GET_BE16(attr->sel_reg_config_methods) &
279 (WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD)))
280 return 0;
281 #endif /* CONFIG_WPS_STRICT */
282
283 return 1;
284 }
285
286
287 /**
288 * wps_is_selected_pin_registrar - Check whether WPS IE indicates active PIN
289 * @msg: WPS IE contents from Beacon or Probe Response frame
290 * Returns: 1 if PIN Registrar is active, 0 if not
291 */
292 int wps_is_selected_pin_registrar(const struct wpabuf *msg)
293 {
294 struct wps_parse_attr attr;
295
296 if (wps_parse_msg(msg, &attr) < 0)
297 return 0;
298
299 return is_selected_pin_registrar(&attr);
300 }
301
302
303 /**
304 * wps_is_addr_authorized - Check whether WPS IE authorizes MAC address
305 * @msg: WPS IE contents from Beacon or Probe Response frame
306 * @addr: MAC address to search for
307 * @ver1_compat: Whether to use version 1 compatibility mode
308 * Returns: 2 if the specified address is explicit authorized, 1 if address is
309 * authorized (broadcast), 0 if not
310 */
311 int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
312 int ver1_compat)
313 {
314 struct wps_parse_attr attr;
315 unsigned int i;
316 const u8 *pos;
317 const u8 bcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
318
319 if (wps_parse_msg(msg, &attr) < 0)
320 return 0;
321
322 if (!attr.version2 && ver1_compat) {
323 /*
324 * Version 1.0 AP - AuthorizedMACs not used, so revert back to
325 * old mechanism of using SelectedRegistrar.
326 */
327 return is_selected_pin_registrar(&attr);
328 }
329
330 if (!attr.authorized_macs)
331 return 0;
332
333 pos = attr.authorized_macs;
334 for (i = 0; i < attr.authorized_macs_len / ETH_ALEN; i++) {
335 if (os_memcmp(pos, addr, ETH_ALEN) == 0)
336 return 2;
337 if (os_memcmp(pos, bcast, ETH_ALEN) == 0)
338 return 1;
339 pos += ETH_ALEN;
340 }
341
342 return 0;
343 }
344
345
346 /**
347 * wps_ap_priority_compar - Prioritize WPS IE from two APs
348 * @wps_a: WPS IE contents from Beacon or Probe Response frame
349 * @wps_b: WPS IE contents from Beacon or Probe Response frame
350 * Returns: 1 if wps_b is considered more likely selection for WPS
351 * provisioning, -1 if wps_a is considered more like, or 0 if no preference
352 */
353 int wps_ap_priority_compar(const struct wpabuf *wps_a,
354 const struct wpabuf *wps_b)
355 {
356 struct wps_parse_attr attr_a, attr_b;
357 int sel_a, sel_b;
358
359 if (wps_a == NULL || wps_parse_msg(wps_a, &attr_a) < 0)
360 return 1;
361 if (wps_b == NULL || wps_parse_msg(wps_b, &attr_b) < 0)
362 return -1;
363
364 sel_a = attr_a.selected_registrar && *attr_a.selected_registrar != 0;
365 sel_b = attr_b.selected_registrar && *attr_b.selected_registrar != 0;
366
367 if (sel_a && !sel_b)
368 return -1;
369 if (!sel_a && sel_b)
370 return 1;
371
372 return 0;
373 }
374
375
376 /**
377 * wps_get_uuid_e - Get UUID-E from WPS IE
378 * @msg: WPS IE contents from Beacon or Probe Response frame
379 * Returns: Pointer to UUID-E or %NULL if not included
380 *
381 * The returned pointer is to the msg contents and it remains valid only as
382 * long as the msg buffer is valid.
383 */
384 const u8 * wps_get_uuid_e(const struct wpabuf *msg)
385 {
386 struct wps_parse_attr attr;
387
388 if (wps_parse_msg(msg, &attr) < 0)
389 return NULL;
390 return attr.uuid_e;
391 }
392
393
394 /**
395 * wps_is_20 - Check whether WPS attributes claim support for WPS 2.0
396 */
397 int wps_is_20(const struct wpabuf *msg)
398 {
399 struct wps_parse_attr attr;
400
401 if (msg == NULL || wps_parse_msg(msg, &attr) < 0)
402 return 0;
403 return attr.version2 != NULL;
404 }
405
406
407 /**
408 * wps_build_assoc_req_ie - Build WPS IE for (Re)Association Request
409 * @req_type: Value for Request Type attribute
410 * Returns: WPS IE or %NULL on failure
411 *
412 * The caller is responsible for freeing the buffer.
413 */
414 struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type)
415 {
416 struct wpabuf *ie;
417 u8 *len;
418
419 wpa_printf(MSG_DEBUG, "WPS: Building WPS IE for (Re)Association "
420 "Request");
421 ie = wpabuf_alloc(100);
422 if (ie == NULL)
423 return NULL;
424
425 wpabuf_put_u8(ie, WLAN_EID_VENDOR_SPECIFIC);
426 len = wpabuf_put(ie, 1);
427 wpabuf_put_be32(ie, WPS_DEV_OUI_WFA);
428
429 if (wps_build_version(ie) ||
430 wps_build_req_type(ie, req_type) ||
431 wps_build_wfa_ext(ie, 0, NULL, 0)) {
432 wpabuf_free(ie);
433 return NULL;
434 }
435
436 *len = wpabuf_len(ie) - 2;
437
438 return ie;
439 }
440
441
442 /**
443 * wps_build_assoc_resp_ie - Build WPS IE for (Re)Association Response
444 * Returns: WPS IE or %NULL on failure
445 *
446 * The caller is responsible for freeing the buffer.
447 */
448 struct wpabuf * wps_build_assoc_resp_ie(void)
449 {
450 struct wpabuf *ie;
451 u8 *len;
452
453 wpa_printf(MSG_DEBUG, "WPS: Building WPS IE for (Re)Association "
454 "Response");
455 ie = wpabuf_alloc(100);
456 if (ie == NULL)
457 return NULL;
458
459 wpabuf_put_u8(ie, WLAN_EID_VENDOR_SPECIFIC);
460 len = wpabuf_put(ie, 1);
461 wpabuf_put_be32(ie, WPS_DEV_OUI_WFA);
462
463 if (wps_build_version(ie) ||
464 wps_build_resp_type(ie, WPS_RESP_AP) ||
465 wps_build_wfa_ext(ie, 0, NULL, 0)) {
466 wpabuf_free(ie);
467 return NULL;
468 }
469
470 *len = wpabuf_len(ie) - 2;
471
472 return ie;
473 }
474
475
476 /**
477 * wps_build_probe_req_ie - Build WPS IE for Probe Request
478 * @pw_id: Password ID (DEV_PW_PUSHBUTTON for active PBC and DEV_PW_DEFAULT for
479 * most other use cases)
480 * @dev: Device attributes
481 * @uuid: Own UUID
482 * @req_type: Value for Request Type attribute
483 * @num_req_dev_types: Number of requested device types
484 * @req_dev_types: Requested device types (8 * num_req_dev_types octets) or
485 * %NULL if none
486 * Returns: WPS IE or %NULL on failure
487 *
488 * The caller is responsible for freeing the buffer.
489 */
490 struct wpabuf * wps_build_probe_req_ie(u16 pw_id, struct wps_device_data *dev,
491 const u8 *uuid,
492 enum wps_request_type req_type,
493 unsigned int num_req_dev_types,
494 const u8 *req_dev_types)
495 {
496 struct wpabuf *ie;
497
498 wpa_printf(MSG_DEBUG, "WPS: Building WPS IE for Probe Request");
499
500 ie = wpabuf_alloc(500);
501 if (ie == NULL)
502 return NULL;
503
504 if (wps_build_version(ie) ||
505 wps_build_req_type(ie, req_type) ||
506 wps_build_config_methods(ie, dev->config_methods) ||
507 wps_build_uuid_e(ie, uuid) ||
508 wps_build_primary_dev_type(dev, ie) ||
509 wps_build_rf_bands(dev, ie, 0) ||
510 wps_build_assoc_state(NULL, ie) ||
511 wps_build_config_error(ie, WPS_CFG_NO_ERROR) ||
512 wps_build_dev_password_id(ie, pw_id) ||
513 #ifdef CONFIG_WPS2
514 wps_build_manufacturer(dev, ie) ||
515 wps_build_model_name(dev, ie) ||
516 wps_build_model_number(dev, ie) ||
517 wps_build_dev_name(dev, ie) ||
518 wps_build_wfa_ext(ie, req_type == WPS_REQ_ENROLLEE, NULL, 0) ||
519 #endif /* CONFIG_WPS2 */
520 wps_build_req_dev_type(dev, ie, num_req_dev_types, req_dev_types)
521 ||
522 wps_build_secondary_dev_type(dev, ie)
523 ) {
524 wpabuf_free(ie);
525 return NULL;
526 }
527
528 #ifndef CONFIG_WPS2
529 if (dev->p2p && wps_build_dev_name(dev, ie)) {
530 wpabuf_free(ie);
531 return NULL;
532 }
533 #endif /* CONFIG_WPS2 */
534
535 return wps_ie_encapsulate(ie);
536 }
537
538
539 void wps_free_pending_msgs(struct upnp_pending_message *msgs)
540 {
541 struct upnp_pending_message *p, *prev;
542 p = msgs;
543 while (p) {
544 prev = p;
545 p = p->next;
546 wpabuf_free(prev->msg);
547 os_free(prev);
548 }
549 }
550
551
552 int wps_attr_text(struct wpabuf *data, char *buf, char *end)
553 {
554 struct wps_parse_attr attr;
555 char *pos = buf;
556 int ret;
557
558 if (wps_parse_msg(data, &attr) < 0)
559 return -1;
560
561 if (attr.wps_state) {
562 if (*attr.wps_state == WPS_STATE_NOT_CONFIGURED)
563 ret = os_snprintf(pos, end - pos,
564 "wps_state=unconfigured\n");
565 else if (*attr.wps_state == WPS_STATE_CONFIGURED)
566 ret = os_snprintf(pos, end - pos,
567 "wps_state=configured\n");
568 else
569 ret = 0;
570 if (ret < 0 || ret >= end - pos)
571 return pos - buf;
572 pos += ret;
573 }
574
575 if (attr.ap_setup_locked && *attr.ap_setup_locked) {
576 ret = os_snprintf(pos, end - pos,
577 "wps_ap_setup_locked=1\n");
578 if (ret < 0 || ret >= end - pos)
579 return pos - buf;
580 pos += ret;
581 }
582
583 if (attr.selected_registrar && *attr.selected_registrar) {
584 ret = os_snprintf(pos, end - pos,
585 "wps_selected_registrar=1\n");
586 if (ret < 0 || ret >= end - pos)
587 return pos - buf;
588 pos += ret;
589 }
590
591 if (attr.dev_password_id) {
592 ret = os_snprintf(pos, end - pos,
593 "wps_device_password_id=%u\n",
594 WPA_GET_BE16(attr.dev_password_id));
595 if (ret < 0 || ret >= end - pos)
596 return pos - buf;
597 pos += ret;
598 }
599
600 if (attr.sel_reg_config_methods) {
601 ret = os_snprintf(pos, end - pos,
602 "wps_selected_registrar_config_methods="
603 "0x%04x\n",
604 WPA_GET_BE16(attr.sel_reg_config_methods));
605 if (ret < 0 || ret >= end - pos)
606 return pos - buf;
607 pos += ret;
608 }
609
610 if (attr.primary_dev_type) {
611 char devtype[WPS_DEV_TYPE_BUFSIZE];
612 ret = os_snprintf(pos, end - pos,
613 "wps_primary_device_type=%s\n",
614 wps_dev_type_bin2str(attr.primary_dev_type,
615 devtype,
616 sizeof(devtype)));
617 if (ret < 0 || ret >= end - pos)
618 return pos - buf;
619 pos += ret;
620 }
621
622 if (attr.dev_name) {
623 char *str = os_malloc(attr.dev_name_len + 1);
624 size_t i;
625 if (str == NULL)
626 return pos - buf;
627 for (i = 0; i < attr.dev_name_len; i++) {
628 if (attr.dev_name[i] < 32)
629 str[i] = '_';
630 else
631 str[i] = attr.dev_name[i];
632 }
633 str[i] = '\0';
634 ret = os_snprintf(pos, end - pos, "wps_device_name=%s\n", str);
635 os_free(str);
636 if (ret < 0 || ret >= end - pos)
637 return pos - buf;
638 pos += ret;
639 }
640
641 if (attr.config_methods) {
642 ret = os_snprintf(pos, end - pos,
643 "wps_config_methods=0x%04x\n",
644 WPA_GET_BE16(attr.config_methods));
645 if (ret < 0 || ret >= end - pos)
646 return pos - buf;
647 pos += ret;
648 }
649
650 return pos - buf;
651 }
652
653
654 const char * wps_ei_str(enum wps_error_indication ei)
655 {
656 switch (ei) {
657 case WPS_EI_NO_ERROR:
658 return "No Error";
659 case WPS_EI_SECURITY_TKIP_ONLY_PROHIBITED:
660 return "TKIP Only Prohibited";
661 case WPS_EI_SECURITY_WEP_PROHIBITED:
662 return "WEP Prohibited";
663 case WPS_EI_AUTH_FAILURE:
664 return "Authentication Failure";
665 default:
666 return "Unknown";
667 }
668 }