P2P: Add Device Name into WPS IE in Probe Request frames
[libeap.git] / src / wps / wps.h
1 /*
2  * Wi-Fi Protected Setup
3  * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef WPS_H
16 #define WPS_H
17
18 #include "wps_defs.h"
19
20 /**
21  * enum wsc_op_code - EAP-WSC OP-Code values
22  */
23 enum wsc_op_code {
24         WSC_UPnP = 0 /* No OP Code in UPnP transport */,
25         WSC_Start = 0x01,
26         WSC_ACK = 0x02,
27         WSC_NACK = 0x03,
28         WSC_MSG = 0x04,
29         WSC_Done = 0x05,
30         WSC_FRAG_ACK = 0x06
31 };
32
33 struct wps_registrar;
34 struct upnp_wps_device_sm;
35 struct wps_er;
36
37 /**
38  * struct wps_credential - WPS Credential
39  * @ssid: SSID
40  * @ssid_len: Length of SSID
41  * @auth_type: Authentication Type (WPS_AUTH_OPEN, .. flags)
42  * @encr_type: Encryption Type (WPS_ENCR_NONE, .. flags)
43  * @key_idx: Key index
44  * @key: Key
45  * @key_len: Key length in octets
46  * @mac_addr: MAC address of the Credential receiver
47  * @cred_attr: Unparsed Credential attribute data (used only in cred_cb());
48  *      this may be %NULL, if not used
49  * @cred_attr_len: Length of cred_attr in octets
50  */
51 struct wps_credential {
52         u8 ssid[32];
53         size_t ssid_len;
54         u16 auth_type;
55         u16 encr_type;
56         u8 key_idx;
57         u8 key[64];
58         size_t key_len;
59         u8 mac_addr[ETH_ALEN];
60         const u8 *cred_attr;
61         size_t cred_attr_len;
62 };
63
64 #define WPS_DEV_TYPE_LEN 8
65 #define WPS_DEV_TYPE_BUFSIZE 21
66
67 /**
68  * struct wps_device_data - WPS Device Data
69  * @mac_addr: Device MAC address
70  * @device_name: Device Name (0..32 octets encoded in UTF-8)
71  * @manufacturer: Manufacturer (0..64 octets encoded in UTF-8)
72  * @model_name: Model Name (0..32 octets encoded in UTF-8)
73  * @model_number: Model Number (0..32 octets encoded in UTF-8)
74  * @serial_number: Serial Number (0..32 octets encoded in UTF-8)
75  * @pri_dev_type: Primary Device Type
76  * @os_version: OS Version
77  * @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ flags)
78  * @p2p: Whether the device is a P2P device
79  */
80 struct wps_device_data {
81         u8 mac_addr[ETH_ALEN];
82         char *device_name;
83         char *manufacturer;
84         char *model_name;
85         char *model_number;
86         char *serial_number;
87         u8 pri_dev_type[WPS_DEV_TYPE_LEN];
88         u32 os_version;
89         u8 rf_bands;
90
91         int p2p;
92 };
93
94 struct oob_conf_data {
95         enum {
96                 OOB_METHOD_UNKNOWN = 0,
97                 OOB_METHOD_DEV_PWD_E,
98                 OOB_METHOD_DEV_PWD_R,
99                 OOB_METHOD_CRED,
100         } oob_method;
101         struct wpabuf *dev_password;
102         struct wpabuf *pubkey_hash;
103 };
104
105 /**
106  * struct wps_config - WPS configuration for a single registration protocol run
107  */
108 struct wps_config {
109         /**
110          * wps - Pointer to long term WPS context
111          */
112         struct wps_context *wps;
113
114         /**
115          * registrar - Whether this end is a Registrar
116          */
117         int registrar;
118
119         /**
120          * pin - Enrollee Device Password (%NULL for Registrar or PBC)
121          */
122         const u8 *pin;
123
124         /**
125          * pin_len - Length on pin in octets
126          */
127         size_t pin_len;
128
129         /**
130          * pbc - Whether this is protocol run uses PBC
131          */
132         int pbc;
133
134         /**
135          * assoc_wps_ie: (Re)AssocReq WPS IE (in AP; %NULL if not AP)
136          */
137         const struct wpabuf *assoc_wps_ie;
138
139         /**
140          * new_ap_settings - New AP settings (%NULL if not used)
141          *
142          * This parameter provides new AP settings when using a wireless
143          * stations as a Registrar to configure the AP. %NULL means that AP
144          * will not be reconfigured, i.e., the station will only learn the
145          * current AP settings by using AP PIN.
146          */
147         const struct wps_credential *new_ap_settings;
148
149         /**
150          * peer_addr: MAC address of the peer in AP; %NULL if not AP
151          */
152         const u8 *peer_addr;
153
154         /**
155          * use_psk_key - Use PSK format key in Credential
156          *
157          * Force PSK format to be used instead of ASCII passphrase when
158          * building Credential for an Enrollee. The PSK value is set in
159          * struct wpa_context::psk.
160          */
161         int use_psk_key;
162 };
163
164 struct wps_data * wps_init(const struct wps_config *cfg);
165
166 void wps_deinit(struct wps_data *data);
167
168 /**
169  * enum wps_process_res - WPS message processing result
170  */
171 enum wps_process_res {
172         /**
173          * WPS_DONE - Processing done
174          */
175         WPS_DONE,
176
177         /**
178          * WPS_CONTINUE - Processing continues
179          */
180         WPS_CONTINUE,
181
182         /**
183          * WPS_FAILURE - Processing failed
184          */
185         WPS_FAILURE,
186
187         /**
188          * WPS_PENDING - Processing continues, but waiting for an external
189          *      event (e.g., UPnP message from an external Registrar)
190          */
191         WPS_PENDING
192 };
193 enum wps_process_res wps_process_msg(struct wps_data *wps,
194                                      enum wsc_op_code op_code,
195                                      const struct wpabuf *msg);
196
197 struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code);
198
199 int wps_is_selected_pbc_registrar(const struct wpabuf *msg);
200 int wps_is_selected_pin_registrar(const struct wpabuf *msg);
201 int wps_ap_priority_compar(const struct wpabuf *wps_a,
202                            const struct wpabuf *wps_b);
203 int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
204                            int ver1_compat);
205 const u8 * wps_get_uuid_e(const struct wpabuf *msg);
206
207 struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type);
208 struct wpabuf * wps_build_assoc_resp_ie(void);
209 struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
210                                        const u8 *uuid,
211                                        enum wps_request_type req_type);
212
213
214 /**
215  * struct wps_registrar_config - WPS Registrar configuration
216  */
217 struct wps_registrar_config {
218         /**
219          * new_psk_cb - Callback for new PSK
220          * @ctx: Higher layer context data (cb_ctx)
221          * @mac_addr: MAC address of the Enrollee
222          * @psk: The new PSK
223          * @psk_len: The length of psk in octets
224          * Returns: 0 on success, -1 on failure
225          *
226          * This callback is called when a new per-device PSK is provisioned.
227          */
228         int (*new_psk_cb)(void *ctx, const u8 *mac_addr, const u8 *psk,
229                           size_t psk_len);
230
231         /**
232          * set_ie_cb - Callback for WPS IE changes
233          * @ctx: Higher layer context data (cb_ctx)
234          * @beacon_ie: WPS IE for Beacon
235          * @probe_resp_ie: WPS IE for Probe Response
236          * Returns: 0 on success, -1 on failure
237          *
238          * This callback is called whenever the WPS IE in Beacon or Probe
239          * Response frames needs to be changed (AP only). Callee is responsible
240          * for freeing the buffers.
241          */
242         int (*set_ie_cb)(void *ctx, struct wpabuf *beacon_ie,
243                          struct wpabuf *probe_resp_ie);
244
245         /**
246          * pin_needed_cb - Callback for requesting a PIN
247          * @ctx: Higher layer context data (cb_ctx)
248          * @uuid_e: UUID-E of the unknown Enrollee
249          * @dev: Device Data from the unknown Enrollee
250          *
251          * This callback is called whenever an unknown Enrollee requests to use
252          * PIN method and a matching PIN (Device Password) is not found in
253          * Registrar data.
254          */
255         void (*pin_needed_cb)(void *ctx, const u8 *uuid_e,
256                               const struct wps_device_data *dev);
257
258         /**
259          * reg_success_cb - Callback for reporting successful registration
260          * @ctx: Higher layer context data (cb_ctx)
261          * @mac_addr: MAC address of the Enrollee
262          * @uuid_e: UUID-E of the Enrollee
263          *
264          * This callback is called whenever an Enrollee completes registration
265          * successfully.
266          */
267         void (*reg_success_cb)(void *ctx, const u8 *mac_addr,
268                                const u8 *uuid_e);
269
270         /**
271          * set_sel_reg_cb - Callback for reporting selected registrar changes
272          * @ctx: Higher layer context data (cb_ctx)
273          * @sel_reg: Whether the Registrar is selected
274          * @dev_passwd_id: Device Password ID to indicate with method or
275          *      specific password the Registrar intends to use
276          * @sel_reg_config_methods: Bit field of active config methods
277          *
278          * This callback is called whenever the Selected Registrar state
279          * changes (e.g., a new PIN becomes available or PBC is invoked). This
280          * callback is only used by External Registrar implementation;
281          * set_ie_cb() is used by AP implementation in similar caes, but it
282          * provides the full WPS IE data instead of just the minimal Registrar
283          * state information.
284          */
285         void (*set_sel_reg_cb)(void *ctx, int sel_reg, u16 dev_passwd_id,
286                                u16 sel_reg_config_methods);
287
288         /**
289          * enrollee_seen_cb - Callback for reporting Enrollee based on ProbeReq
290          * @ctx: Higher layer context data (cb_ctx)
291          * @addr: MAC address of the Enrollee
292          * @uuid_e: UUID of the Enrollee
293          * @pri_dev_type: Primary device type
294          * @config_methods: Config Methods
295          * @dev_password_id: Device Password ID
296          * @request_type: Request Type
297          * @dev_name: Device Name (if available)
298          */
299         void (*enrollee_seen_cb)(void *ctx, const u8 *addr, const u8 *uuid_e,
300                                  const u8 *pri_dev_type, u16 config_methods,
301                                  u16 dev_password_id, u8 request_type,
302                                  const char *dev_name);
303
304         /**
305          * cb_ctx: Higher layer context data for Registrar callbacks
306          */
307         void *cb_ctx;
308
309         /**
310          * skip_cred_build: Do not build credential
311          *
312          * This option can be used to disable internal code that builds
313          * Credential attribute into M8 based on the current network
314          * configuration and Enrollee capabilities. The extra_cred data will
315          * then be used as the Credential(s).
316          */
317         int skip_cred_build;
318
319         /**
320          * extra_cred: Additional Credential attribute(s)
321          *
322          * This optional data (set to %NULL to disable) can be used to add
323          * Credential attribute(s) for other networks into M8. If
324          * skip_cred_build is set, this will also override the automatically
325          * generated Credential attribute.
326          */
327         const u8 *extra_cred;
328
329         /**
330          * extra_cred_len: Length of extra_cred in octets
331          */
332         size_t extra_cred_len;
333
334         /**
335          * disable_auto_conf - Disable auto-configuration on first registration
336          *
337          * By default, the AP that is started in not configured state will
338          * generate a random PSK and move to configured state when the first
339          * registration protocol run is completed successfully. This option can
340          * be used to disable this functionality and leave it up to an external
341          * program to take care of configuration. This requires the extra_cred
342          * to be set with a suitable Credential and skip_cred_build being used.
343          */
344         int disable_auto_conf;
345
346         /**
347          * static_wep_only - Whether the BSS supports only static WEP
348          */
349         int static_wep_only;
350 };
351
352
353 /**
354  * enum wps_event - WPS event types
355  */
356 enum wps_event {
357         /**
358          * WPS_EV_M2D - M2D received (Registrar did not know us)
359          */
360         WPS_EV_M2D,
361
362         /**
363          * WPS_EV_FAIL - Registration failed
364          */
365         WPS_EV_FAIL,
366
367         /**
368          * WPS_EV_SUCCESS - Registration succeeded
369          */
370         WPS_EV_SUCCESS,
371
372         /**
373          * WPS_EV_PWD_AUTH_FAIL - Password authentication failed
374          */
375         WPS_EV_PWD_AUTH_FAIL,
376
377         /**
378          * WPS_EV_PBC_OVERLAP - PBC session overlap detected
379          */
380         WPS_EV_PBC_OVERLAP,
381
382         /**
383          * WPS_EV_PBC_TIMEOUT - PBC walktime expired before protocol run start
384          */
385         WPS_EV_PBC_TIMEOUT,
386
387         /**
388          * WPS_EV_ER_AP_ADD - ER: AP added
389          */
390         WPS_EV_ER_AP_ADD,
391
392         /**
393          * WPS_EV_ER_AP_REMOVE - ER: AP removed
394          */
395         WPS_EV_ER_AP_REMOVE,
396
397         /**
398          * WPS_EV_ER_ENROLLEE_ADD - ER: Enrollee added
399          */
400         WPS_EV_ER_ENROLLEE_ADD,
401
402         /**
403          * WPS_EV_ER_ENROLLEE_REMOVE - ER: Enrollee removed
404          */
405         WPS_EV_ER_ENROLLEE_REMOVE,
406
407         /**
408          * WPS_EV_ER_AP_SETTINGS - ER: AP Settings learned
409          */
410         WPS_EV_ER_AP_SETTINGS
411 };
412
413 /**
414  * union wps_event_data - WPS event data
415  */
416 union wps_event_data {
417         /**
418          * struct wps_event_m2d - M2D event data
419          */
420         struct wps_event_m2d {
421                 u16 config_methods;
422                 const u8 *manufacturer;
423                 size_t manufacturer_len;
424                 const u8 *model_name;
425                 size_t model_name_len;
426                 const u8 *model_number;
427                 size_t model_number_len;
428                 const u8 *serial_number;
429                 size_t serial_number_len;
430                 const u8 *dev_name;
431                 size_t dev_name_len;
432                 const u8 *primary_dev_type; /* 8 octets */
433                 u16 config_error;
434                 u16 dev_password_id;
435         } m2d;
436
437         /**
438          * struct wps_event_fail - Registration failure information
439          * @msg: enum wps_msg_type
440          */
441         struct wps_event_fail {
442                 int msg;
443         } fail;
444
445         struct wps_event_pwd_auth_fail {
446                 int enrollee;
447                 int part;
448         } pwd_auth_fail;
449
450         struct wps_event_er_ap {
451                 const u8 *uuid;
452                 const u8 *mac_addr;
453                 const char *friendly_name;
454                 const char *manufacturer;
455                 const char *manufacturer_url;
456                 const char *model_description;
457                 const char *model_name;
458                 const char *model_number;
459                 const char *model_url;
460                 const char *serial_number;
461                 const char *upc;
462                 const u8 *pri_dev_type;
463                 u8 wps_state;
464         } ap;
465
466         struct wps_event_er_enrollee {
467                 const u8 *uuid;
468                 const u8 *mac_addr;
469                 int m1_received;
470                 u16 config_methods;
471                 u16 dev_passwd_id;
472                 const u8 *pri_dev_type;
473                 const char *dev_name;
474                 const char *manufacturer;
475                 const char *model_name;
476                 const char *model_number;
477                 const char *serial_number;
478         } enrollee;
479
480         struct wps_event_er_ap_settings {
481                 const u8 *uuid;
482                 const struct wps_credential *cred;
483         } ap_settings;
484 };
485
486 /**
487  * struct upnp_pending_message - Pending PutWLANResponse messages
488  * @next: Pointer to next pending message or %NULL
489  * @addr: NewWLANEventMAC
490  * @msg: NewMessage
491  * @type: Message Type
492  */
493 struct upnp_pending_message {
494         struct upnp_pending_message *next;
495         u8 addr[ETH_ALEN];
496         struct wpabuf *msg;
497         enum wps_msg_type type;
498 };
499
500 /**
501  * struct wps_context - Long term WPS context data
502  *
503  * This data is stored at the higher layer Authenticator or Supplicant data
504  * structures and it is maintained over multiple registration protocol runs.
505  */
506 struct wps_context {
507         /**
508          * ap - Whether the local end is an access point
509          */
510         int ap;
511
512         /**
513          * registrar - Pointer to WPS registrar data from wps_registrar_init()
514          */
515         struct wps_registrar *registrar;
516
517         /**
518          * wps_state - Current WPS state
519          */
520         enum wps_state wps_state;
521
522         /**
523          * ap_setup_locked - Whether AP setup is locked (only used at AP)
524          */
525         int ap_setup_locked;
526
527         /**
528          * uuid - Own UUID
529          */
530         u8 uuid[16];
531
532         /**
533          * ssid - SSID
534          *
535          * This SSID is used by the Registrar to fill in information for
536          * Credentials. In addition, AP uses it when acting as an Enrollee to
537          * notify Registrar of the current configuration.
538          */
539         u8 ssid[32];
540
541         /**
542          * ssid_len - Length of ssid in octets
543          */
544         size_t ssid_len;
545
546         /**
547          * dev - Own WPS device data
548          */
549         struct wps_device_data dev;
550
551         /**
552          * oob_conf - OOB Config data
553          */
554         struct oob_conf_data oob_conf;
555
556         /**
557          * oob_dev_pw_id - OOB Device password id
558          */
559         u16 oob_dev_pw_id;
560
561         /**
562          * dh_ctx - Context data for Diffie-Hellman operation
563          */
564         void *dh_ctx;
565
566         /**
567          * dh_privkey - Diffie-Hellman private key
568          */
569         struct wpabuf *dh_privkey;
570
571         /**
572          * dh_pubkey_oob - Diffie-Hellman public key
573          */
574         struct wpabuf *dh_pubkey;
575
576         /**
577          * config_methods - Enabled configuration methods
578          *
579          * Bit field of WPS_CONFIG_*
580          */
581         u16 config_methods;
582
583         /**
584          * encr_types - Enabled encryption types (bit field of WPS_ENCR_*)
585          */
586         u16 encr_types;
587
588         /**
589          * auth_types - Authentication types (bit field of WPS_AUTH_*)
590          */
591         u16 auth_types;
592
593         /**
594          * network_key - The current Network Key (PSK) or %NULL to generate new
595          *
596          * If %NULL, Registrar will generate per-device PSK. In addition, AP
597          * uses this when acting as an Enrollee to notify Registrar of the
598          * current configuration.
599          *
600          * When using WPA/WPA2-Person, this key can be either the ASCII
601          * passphrase (8..63 characters) or the 32-octet PSK (64 hex
602          * characters). When this is set to the ASCII passphrase, the PSK can
603          * be provided in the psk buffer and used per-Enrollee to control which
604          * key type is included in the Credential (e.g., to reduce calculation
605          * need on low-powered devices by provisioning PSK while still allowing
606          * other devices to get the passphrase).
607          */
608         u8 *network_key;
609
610         /**
611          * network_key_len - Length of network_key in octets
612          */
613         size_t network_key_len;
614
615         /**
616          * psk - The current network PSK
617          *
618          * This optional value can be used to provide the current PSK if
619          * network_key is set to the ASCII passphrase.
620          */
621         u8 psk[32];
622
623         /**
624          * psk_set - Whether psk value is set
625          */
626         int psk_set;
627
628         /**
629          * ap_settings - AP Settings override for M7 (only used at AP)
630          *
631          * If %NULL, AP Settings attributes will be generated based on the
632          * current network configuration.
633          */
634         u8 *ap_settings;
635
636         /**
637          * ap_settings_len - Length of ap_settings in octets
638          */
639         size_t ap_settings_len;
640
641         /**
642          * friendly_name - Friendly Name (required for UPnP)
643          */
644         char *friendly_name;
645
646         /**
647          * manufacturer_url - Manufacturer URL (optional for UPnP)
648          */
649         char *manufacturer_url;
650
651         /**
652          * model_description - Model Description (recommended for UPnP)
653          */
654         char *model_description;
655
656         /**
657          * model_url - Model URL (optional for UPnP)
658          */
659         char *model_url;
660
661         /**
662          * upc - Universal Product Code (optional for UPnP)
663          */
664         char *upc;
665
666         /**
667          * cred_cb - Callback to notify that new Credentials were received
668          * @ctx: Higher layer context data (cb_ctx)
669          * @cred: The received Credential
670          * Return: 0 on success, -1 on failure
671          */
672         int (*cred_cb)(void *ctx, const struct wps_credential *cred);
673
674         /**
675          * event_cb - Event callback (state information about progress)
676          * @ctx: Higher layer context data (cb_ctx)
677          * @event: Event type
678          * @data: Event data
679          */
680         void (*event_cb)(void *ctx, enum wps_event event,
681                          union wps_event_data *data);
682
683         /**
684          * cb_ctx: Higher layer context data for callbacks
685          */
686         void *cb_ctx;
687
688         struct upnp_wps_device_sm *wps_upnp;
689
690         /* Pending messages from UPnP PutWLANResponse */
691         struct upnp_pending_message *upnp_msgs;
692 };
693
694 struct oob_device_data {
695         char *device_name;
696         char *device_path;
697         void * (*init_func)(struct wps_context *, struct oob_device_data *,
698                             int);
699         struct wpabuf * (*read_func)(void *);
700         int (*write_func)(void *, struct wpabuf *);
701         void (*deinit_func)(void *);
702 };
703
704 struct oob_nfc_device_data {
705         int (*init_func)(char *);
706         void * (*read_func)(size_t *);
707         int (*write_func)(void *, size_t);
708         void (*deinit_func)(void);
709 };
710
711 struct wps_registrar *
712 wps_registrar_init(struct wps_context *wps,
713                    const struct wps_registrar_config *cfg);
714 void wps_registrar_deinit(struct wps_registrar *reg);
715 int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr,
716                           const u8 *uuid, const u8 *pin, size_t pin_len,
717                           int timeout);
718 int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid);
719 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
720 int wps_registrar_button_pushed(struct wps_registrar *reg);
721 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
722                                 const struct wpabuf *wps_data);
723 int wps_registrar_update_ie(struct wps_registrar *reg);
724 int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr,
725                            char *buf, size_t buflen);
726
727 unsigned int wps_pin_checksum(unsigned int pin);
728 unsigned int wps_pin_valid(unsigned int pin);
729 unsigned int wps_generate_pin(void);
730 void wps_free_pending_msgs(struct upnp_pending_message *msgs);
731
732 struct oob_device_data * wps_get_oob_device(char *device_type);
733 struct oob_nfc_device_data * wps_get_oob_nfc_device(char *device_name);
734 int wps_get_oob_method(char *method);
735 int wps_process_oob(struct wps_context *wps, struct oob_device_data *oob_dev,
736                     int registrar);
737 int wps_attr_text(struct wpabuf *data, char *buf, char *end);
738
739 struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname,
740                             const char *filter);
741 void wps_er_refresh(struct wps_er *er);
742 void wps_er_deinit(struct wps_er *er, void (*cb)(void *ctx), void *ctx);
743 void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
744                         u16 sel_reg_config_methods);
745 int wps_er_pbc(struct wps_er *er, const u8 *uuid);
746 int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *pin,
747                  size_t pin_len);
748 int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *pin,
749                   size_t pin_len, const struct wps_credential *cred);
750
751 int wps_dev_type_str2bin(const char *str, u8 dev_type[WPS_DEV_TYPE_LEN]);
752 char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf,
753                             size_t buf_len);
754 void uuid_gen_mac_addr(const u8 *mac_addr, u8 *uuid);
755 u16 wps_config_methods_str2bin(const char *str);
756
757 #ifdef CONFIG_WPS_STRICT
758 int wps_validate_beacon(const struct wpabuf *wps_ie);
759 int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, int probe);
760 int wps_validate_probe_req(const struct wpabuf *wps_ie);
761 int wps_validate_assoc_req(const struct wpabuf *wps_ie);
762 int wps_validate_assoc_resp(const struct wpabuf *wps_ie);
763 int wps_validate_m1(const struct wpabuf *tlvs);
764 int wps_validate_m2(const struct wpabuf *tlvs);
765 int wps_validate_m2d(const struct wpabuf *tlvs);
766 int wps_validate_m3(const struct wpabuf *tlvs);
767 int wps_validate_m4(const struct wpabuf *tlvs);
768 int wps_validate_m4_encr(const struct wpabuf *tlvs);
769 int wps_validate_m5(const struct wpabuf *tlvs);
770 int wps_validate_m5_encr(const struct wpabuf *tlvs);
771 int wps_validate_m6(const struct wpabuf *tlvs);
772 int wps_validate_m6_encr(const struct wpabuf *tlvs);
773 int wps_validate_m7(const struct wpabuf *tlvs);
774 int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap);
775 int wps_validate_m8(const struct wpabuf *tlvs);
776 int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap);
777 int wps_validate_wsc_ack(const struct wpabuf *tlvs);
778 int wps_validate_wsc_nack(const struct wpabuf *tlvs);
779 int wps_validate_wsc_done(const struct wpabuf *tlvs);
780 int wps_validate_upnp_set_selected_registrar(const struct wpabuf *tlvs);
781 #else /* CONFIG_WPS_STRICT */
782 static inline int wps_validate_beacon(const struct wpabuf *wps_ie){
783         return 0;
784 }
785
786 static inline int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie,
787                                                  int probe)
788 {
789         return 0;
790 }
791
792 static inline int wps_validate_probe_req(const struct wpabuf *wps_ie)
793 {
794         return 0;
795 }
796
797 static inline int wps_validate_assoc_req(const struct wpabuf *wps_ie)
798 {
799         return 0;
800 }
801
802 static inline int wps_validate_assoc_resp(const struct wpabuf *wps_ie)
803 {
804         return 0;
805 }
806
807 static inline int wps_validate_m1(const struct wpabuf *tlvs)
808 {
809         return 0;
810 }
811
812 static inline int wps_validate_m2(const struct wpabuf *tlvs)
813 {
814         return 0;
815 }
816
817 static inline int wps_validate_m2d(const struct wpabuf *tlvs)
818 {
819         return 0;
820 }
821
822 static inline int wps_validate_m3(const struct wpabuf *tlvs)
823 {
824         return 0;
825 }
826
827 static inline int wps_validate_m4(const struct wpabuf *tlvs)
828 {
829         return 0;
830 }
831
832 static inline int wps_validate_m4_encr(const struct wpabuf *tlvs)
833 {
834         return 0;
835 }
836
837 static inline int wps_validate_m5(const struct wpabuf *tlvs)
838 {
839         return 0;
840 }
841
842 static inline int wps_validate_m5_encr(const struct wpabuf *tlvs)
843 {
844         return 0;
845 }
846
847 static inline int wps_validate_m6(const struct wpabuf *tlvs)
848 {
849         return 0;
850 }
851
852 static inline int wps_validate_m6_encr(const struct wpabuf *tlvs)
853 {
854         return 0;
855 }
856
857 static inline int wps_validate_m7(const struct wpabuf *tlvs)
858 {
859         return 0;
860 }
861
862 static inline int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap)
863 {
864         return 0;
865 }
866
867 static inline int wps_validate_m8(const struct wpabuf *tlvs)
868 {
869         return 0;
870 }
871
872 static inline int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap)
873 {
874         return 0;
875 }
876
877 static inline int wps_validate_wsc_ack(const struct wpabuf *tlvs)
878 {
879         return 0;
880 }
881
882 static inline int wps_validate_wsc_nack(const struct wpabuf *tlvs)
883 {
884         return 0;
885 }
886
887 static inline int wps_validate_wsc_done(const struct wpabuf *tlvs)
888 {
889         return 0;
890 }
891
892 static inline int wps_validate_upnp_set_selected_registrar(
893         const struct wpabuf *tlvs)
894 {
895         return 0;
896 }
897 #endif /* CONFIG_WPS_STRICT */
898
899 #endif /* WPS_H */