2 * Wi-Fi Protected Setup
3 * Copyright (c) 2007-2013, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "common/ieee802_11_defs.h"
16 * enum wsc_op_code - EAP-WSC OP-Code values
19 WSC_UPnP = 0 /* No OP Code in UPnP transport */,
29 struct upnp_wps_device_sm;
31 struct wps_parse_attr;
34 * struct wps_credential - WPS Credential
36 * @ssid_len: Length of SSID
37 * @auth_type: Authentication Type (WPS_AUTH_OPEN, .. flags)
38 * @encr_type: Encryption Type (WPS_ENCR_NONE, .. flags)
41 * @key_len: Key length in octets
42 * @mac_addr: MAC address of the Credential receiver
43 * @cred_attr: Unparsed Credential attribute data (used only in cred_cb());
44 * this may be %NULL, if not used
45 * @cred_attr_len: Length of cred_attr in octets
47 struct wps_credential {
48 u8 ssid[SSID_MAX_LEN];
55 u8 mac_addr[ETH_ALEN];
60 #define WPS_DEV_TYPE_LEN 8
61 #define WPS_DEV_TYPE_BUFSIZE 21
62 #define WPS_SEC_DEV_TYPE_MAX_LEN 128
63 /* maximum number of advertised WPS vendor extension attributes */
64 #define MAX_WPS_VENDOR_EXTENSIONS 10
65 /* maximum size of WPS Vendor extension attribute */
66 #define WPS_MAX_VENDOR_EXT_LEN 1024
67 /* maximum number of parsed WPS vendor extension attributes */
68 #define MAX_WPS_PARSE_VENDOR_EXT 10
71 * struct wps_device_data - WPS Device Data
72 * @mac_addr: Device MAC address
73 * @device_name: Device Name (0..32 octets encoded in UTF-8)
74 * @manufacturer: Manufacturer (0..64 octets encoded in UTF-8)
75 * @model_name: Model Name (0..32 octets encoded in UTF-8)
76 * @model_number: Model Number (0..32 octets encoded in UTF-8)
77 * @serial_number: Serial Number (0..32 octets encoded in UTF-8)
78 * @pri_dev_type: Primary Device Type
79 * @sec_dev_type: Array of secondary device types
80 * @num_sec_dev_type: Number of secondary device types
81 * @os_version: OS Version
82 * @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ, WPS_RF_60GHZ flags)
83 * @p2p: Whether the device is a P2P device
85 struct wps_device_data {
86 u8 mac_addr[ETH_ALEN];
92 u8 pri_dev_type[WPS_DEV_TYPE_LEN];
93 #define WPS_SEC_DEVICE_TYPES 5
94 u8 sec_dev_type[WPS_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
99 struct wpabuf *vendor_ext_m1;
100 struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
106 * struct wps_config - WPS configuration for a single registration protocol run
110 * wps - Pointer to long term WPS context
112 struct wps_context *wps;
115 * registrar - Whether this end is a Registrar
120 * pin - Enrollee Device Password (%NULL for Registrar or PBC)
125 * pin_len - Length on pin in octets
130 * pbc - Whether this is protocol run uses PBC
135 * assoc_wps_ie: (Re)AssocReq WPS IE (in AP; %NULL if not AP)
137 const struct wpabuf *assoc_wps_ie;
140 * new_ap_settings - New AP settings (%NULL if not used)
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.
147 const struct wps_credential *new_ap_settings;
150 * peer_addr: MAC address of the peer in AP; %NULL if not AP
155 * use_psk_key - Use PSK format key in Credential
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.
164 * dev_pw_id - Device Password ID for Enrollee when PIN is used
169 * p2p_dev_addr - P2P Device Address from (Re)Association Request
171 * On AP/GO, this is set to the P2P Device Address of the associating
172 * P2P client if a P2P IE is included in the (Re)Association Request
173 * frame and the P2P Device Address is included. Otherwise, this is set
174 * to %NULL to indicate the station does not have a P2P Device Address.
176 const u8 *p2p_dev_addr;
179 * pbc_in_m1 - Do not remove PushButton config method in M1 (AP)
181 * This can be used to enable a workaround to allow Windows 7 to use
187 * peer_pubkey_hash - Peer public key hash or %NULL if not known
189 const u8 *peer_pubkey_hash;
192 struct wps_data * wps_init(const struct wps_config *cfg);
194 void wps_deinit(struct wps_data *data);
197 * enum wps_process_res - WPS message processing result
199 enum wps_process_res {
201 * WPS_DONE - Processing done
206 * WPS_CONTINUE - Processing continues
211 * WPS_FAILURE - Processing failed
216 * WPS_PENDING - Processing continues, but waiting for an external
217 * event (e.g., UPnP message from an external Registrar)
221 enum wps_process_res wps_process_msg(struct wps_data *wps,
222 enum wsc_op_code op_code,
223 const struct wpabuf *msg);
225 struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code);
227 int wps_is_selected_pbc_registrar(const struct wpabuf *msg);
228 int wps_is_selected_pin_registrar(const struct wpabuf *msg);
229 int wps_ap_priority_compar(const struct wpabuf *wps_a,
230 const struct wpabuf *wps_b);
231 int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
233 const u8 * wps_get_uuid_e(const struct wpabuf *msg);
234 int wps_is_20(const struct wpabuf *msg);
236 struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type);
237 struct wpabuf * wps_build_assoc_resp_ie(void);
238 struct wpabuf * wps_build_probe_req_ie(u16 pw_id, struct wps_device_data *dev,
240 enum wps_request_type req_type,
241 unsigned int num_req_dev_types,
242 const u8 *req_dev_types);
246 * struct wps_registrar_config - WPS Registrar configuration
248 struct wps_registrar_config {
250 * new_psk_cb - Callback for new PSK
251 * @ctx: Higher layer context data (cb_ctx)
252 * @mac_addr: MAC address of the Enrollee
253 * @p2p_dev_addr: P2P Device Address of the Enrollee or all zeros if not
255 * @psk_len: The length of psk in octets
256 * Returns: 0 on success, -1 on failure
258 * This callback is called when a new per-device PSK is provisioned.
260 int (*new_psk_cb)(void *ctx, const u8 *mac_addr, const u8 *p2p_dev_addr,
261 const u8 *psk, size_t psk_len);
264 * set_ie_cb - Callback for WPS IE changes
265 * @ctx: Higher layer context data (cb_ctx)
266 * @beacon_ie: WPS IE for Beacon
267 * @probe_resp_ie: WPS IE for Probe Response
268 * Returns: 0 on success, -1 on failure
270 * This callback is called whenever the WPS IE in Beacon or Probe
271 * Response frames needs to be changed (AP only). Callee is responsible
272 * for freeing the buffers.
274 int (*set_ie_cb)(void *ctx, struct wpabuf *beacon_ie,
275 struct wpabuf *probe_resp_ie);
278 * pin_needed_cb - Callback for requesting a PIN
279 * @ctx: Higher layer context data (cb_ctx)
280 * @uuid_e: UUID-E of the unknown Enrollee
281 * @dev: Device Data from the unknown Enrollee
283 * This callback is called whenever an unknown Enrollee requests to use
284 * PIN method and a matching PIN (Device Password) is not found in
287 void (*pin_needed_cb)(void *ctx, const u8 *uuid_e,
288 const struct wps_device_data *dev);
291 * reg_success_cb - Callback for reporting successful registration
292 * @ctx: Higher layer context data (cb_ctx)
293 * @mac_addr: MAC address of the Enrollee
294 * @uuid_e: UUID-E of the Enrollee
295 * @dev_pw: Device Password (PIN) used during registration
296 * @dev_pw_len: Length of dev_pw in octets
298 * This callback is called whenever an Enrollee completes registration
301 void (*reg_success_cb)(void *ctx, const u8 *mac_addr,
302 const u8 *uuid_e, const u8 *dev_pw,
306 * set_sel_reg_cb - Callback for reporting selected registrar changes
307 * @ctx: Higher layer context data (cb_ctx)
308 * @sel_reg: Whether the Registrar is selected
309 * @dev_passwd_id: Device Password ID to indicate with method or
310 * specific password the Registrar intends to use
311 * @sel_reg_config_methods: Bit field of active config methods
313 * This callback is called whenever the Selected Registrar state
314 * changes (e.g., a new PIN becomes available or PBC is invoked). This
315 * callback is only used by External Registrar implementation;
316 * set_ie_cb() is used by AP implementation in similar caes, but it
317 * provides the full WPS IE data instead of just the minimal Registrar
320 void (*set_sel_reg_cb)(void *ctx, int sel_reg, u16 dev_passwd_id,
321 u16 sel_reg_config_methods);
324 * enrollee_seen_cb - Callback for reporting Enrollee based on ProbeReq
325 * @ctx: Higher layer context data (cb_ctx)
326 * @addr: MAC address of the Enrollee
327 * @uuid_e: UUID of the Enrollee
328 * @pri_dev_type: Primary device type
329 * @config_methods: Config Methods
330 * @dev_password_id: Device Password ID
331 * @request_type: Request Type
332 * @dev_name: Device Name (if available)
334 void (*enrollee_seen_cb)(void *ctx, const u8 *addr, const u8 *uuid_e,
335 const u8 *pri_dev_type, u16 config_methods,
336 u16 dev_password_id, u8 request_type,
337 const char *dev_name);
340 * cb_ctx: Higher layer context data for Registrar callbacks
345 * skip_cred_build: Do not build credential
347 * This option can be used to disable internal code that builds
348 * Credential attribute into M8 based on the current network
349 * configuration and Enrollee capabilities. The extra_cred data will
350 * then be used as the Credential(s).
355 * extra_cred: Additional Credential attribute(s)
357 * This optional data (set to %NULL to disable) can be used to add
358 * Credential attribute(s) for other networks into M8. If
359 * skip_cred_build is set, this will also override the automatically
360 * generated Credential attribute.
362 const u8 *extra_cred;
365 * extra_cred_len: Length of extra_cred in octets
367 size_t extra_cred_len;
370 * disable_auto_conf - Disable auto-configuration on first registration
372 * By default, the AP that is started in not configured state will
373 * generate a random PSK and move to configured state when the first
374 * registration protocol run is completed successfully. This option can
375 * be used to disable this functionality and leave it up to an external
376 * program to take care of configuration. This requires the extra_cred
377 * to be set with a suitable Credential and skip_cred_build being used.
379 int disable_auto_conf;
382 * static_wep_only - Whether the BSS supports only static WEP
387 * dualband - Whether this is a concurrent dualband AP
392 * force_per_enrollee_psk - Force per-Enrollee random PSK
394 * This forces per-Enrollee random PSK to be generated even if a default
395 * PSK is set for a network.
397 int force_per_enrollee_psk;
402 * enum wps_event - WPS event types
406 * WPS_EV_M2D - M2D received (Registrar did not know us)
411 * WPS_EV_FAIL - Registration failed
416 * WPS_EV_SUCCESS - Registration succeeded
421 * WPS_EV_PWD_AUTH_FAIL - Password authentication failed
423 WPS_EV_PWD_AUTH_FAIL,
426 * WPS_EV_PBC_OVERLAP - PBC session overlap detected
431 * WPS_EV_PBC_TIMEOUT - PBC walktime expired before protocol run start
436 * WPS_EV_PBC_ACTIVE - PBC mode was activated
441 * WPS_EV_PBC_DISABLE - PBC mode was disabled
446 * WPS_EV_ER_AP_ADD - ER: AP added
451 * WPS_EV_ER_AP_REMOVE - ER: AP removed
456 * WPS_EV_ER_ENROLLEE_ADD - ER: Enrollee added
458 WPS_EV_ER_ENROLLEE_ADD,
461 * WPS_EV_ER_ENROLLEE_REMOVE - ER: Enrollee removed
463 WPS_EV_ER_ENROLLEE_REMOVE,
466 * WPS_EV_ER_AP_SETTINGS - ER: AP Settings learned
468 WPS_EV_ER_AP_SETTINGS,
471 * WPS_EV_ER_SET_SELECTED_REGISTRAR - ER: SetSelectedRegistrar event
473 WPS_EV_ER_SET_SELECTED_REGISTRAR,
476 * WPS_EV_AP_PIN_SUCCESS - External Registrar used correct AP PIN
478 WPS_EV_AP_PIN_SUCCESS
482 * union wps_event_data - WPS event data
484 union wps_event_data {
486 * struct wps_event_m2d - M2D event data
488 struct wps_event_m2d {
490 const u8 *manufacturer;
491 size_t manufacturer_len;
492 const u8 *model_name;
493 size_t model_name_len;
494 const u8 *model_number;
495 size_t model_number_len;
496 const u8 *serial_number;
497 size_t serial_number_len;
500 const u8 *primary_dev_type; /* 8 octets */
506 * struct wps_event_fail - Registration failure information
507 * @msg: enum wps_msg_type
509 struct wps_event_fail {
512 u16 error_indication;
513 u8 peer_macaddr[ETH_ALEN];
516 struct wps_event_success {
517 u8 peer_macaddr[ETH_ALEN];
520 struct wps_event_pwd_auth_fail {
523 u8 peer_macaddr[ETH_ALEN];
526 struct wps_event_er_ap {
529 const char *friendly_name;
530 const char *manufacturer;
531 const char *manufacturer_url;
532 const char *model_description;
533 const char *model_name;
534 const char *model_number;
535 const char *model_url;
536 const char *serial_number;
538 const u8 *pri_dev_type;
542 struct wps_event_er_enrollee {
548 const u8 *pri_dev_type;
549 const char *dev_name;
550 const char *manufacturer;
551 const char *model_name;
552 const char *model_number;
553 const char *serial_number;
556 struct wps_event_er_ap_settings {
558 const struct wps_credential *cred;
561 struct wps_event_er_set_selected_registrar {
565 u16 sel_reg_config_methods;
567 WPS_ER_SET_SEL_REG_START,
568 WPS_ER_SET_SEL_REG_DONE,
569 WPS_ER_SET_SEL_REG_FAILED
575 * struct upnp_pending_message - Pending PutWLANResponse messages
576 * @next: Pointer to next pending message or %NULL
577 * @addr: NewWLANEventMAC
579 * @type: Message Type
581 struct upnp_pending_message {
582 struct upnp_pending_message *next;
585 enum wps_msg_type type;
589 * struct wps_context - Long term WPS context data
591 * This data is stored at the higher layer Authenticator or Supplicant data
592 * structures and it is maintained over multiple registration protocol runs.
596 * ap - Whether the local end is an access point
601 * registrar - Pointer to WPS registrar data from wps_registrar_init()
603 struct wps_registrar *registrar;
606 * wps_state - Current WPS state
608 enum wps_state wps_state;
611 * ap_setup_locked - Whether AP setup is locked (only used at AP)
623 * This SSID is used by the Registrar to fill in information for
624 * Credentials. In addition, AP uses it when acting as an Enrollee to
625 * notify Registrar of the current configuration.
627 u8 ssid[SSID_MAX_LEN];
630 * ssid_len - Length of ssid in octets
635 * dev - Own WPS device data
637 struct wps_device_data dev;
640 * dh_ctx - Context data for Diffie-Hellman operation
645 * dh_privkey - Diffie-Hellman private key
647 struct wpabuf *dh_privkey;
650 * dh_pubkey_oob - Diffie-Hellman public key
652 struct wpabuf *dh_pubkey;
655 * config_methods - Enabled configuration methods
657 * Bit field of WPS_CONFIG_*
662 * encr_types - Enabled encryption types (bit field of WPS_ENCR_*)
667 * auth_types - Authentication types (bit field of WPS_AUTH_*)
672 * encr_types - Current AP encryption type (WPS_ENCR_*)
677 * ap_auth_type - Current AP authentication types (WPS_AUTH_*)
682 * network_key - The current Network Key (PSK) or %NULL to generate new
684 * If %NULL, Registrar will generate per-device PSK. In addition, AP
685 * uses this when acting as an Enrollee to notify Registrar of the
686 * current configuration.
688 * When using WPA/WPA2-Person, this key can be either the ASCII
689 * passphrase (8..63 characters) or the 32-octet PSK (64 hex
690 * characters). When this is set to the ASCII passphrase, the PSK can
691 * be provided in the psk buffer and used per-Enrollee to control which
692 * key type is included in the Credential (e.g., to reduce calculation
693 * need on low-powered devices by provisioning PSK while still allowing
694 * other devices to get the passphrase).
699 * network_key_len - Length of network_key in octets
701 size_t network_key_len;
704 * psk - The current network PSK
706 * This optional value can be used to provide the current PSK if
707 * network_key is set to the ASCII passphrase.
712 * psk_set - Whether psk value is set
717 * ap_settings - AP Settings override for M7 (only used at AP)
719 * If %NULL, AP Settings attributes will be generated based on the
720 * current network configuration.
725 * ap_settings_len - Length of ap_settings in octets
727 size_t ap_settings_len;
730 * friendly_name - Friendly Name (required for UPnP)
735 * manufacturer_url - Manufacturer URL (optional for UPnP)
737 char *manufacturer_url;
740 * model_description - Model Description (recommended for UPnP)
742 char *model_description;
745 * model_url - Model URL (optional for UPnP)
750 * upc - Universal Product Code (optional for UPnP)
755 * cred_cb - Callback to notify that new Credentials were received
756 * @ctx: Higher layer context data (cb_ctx)
757 * @cred: The received Credential
758 * Return: 0 on success, -1 on failure
760 int (*cred_cb)(void *ctx, const struct wps_credential *cred);
763 * event_cb - Event callback (state information about progress)
764 * @ctx: Higher layer context data (cb_ctx)
768 void (*event_cb)(void *ctx, enum wps_event event,
769 union wps_event_data *data);
772 * rf_band_cb - Fetch currently used RF band
773 * @ctx: Higher layer context data (cb_ctx)
774 * Return: Current used RF band or 0 if not known
776 int (*rf_band_cb)(void *ctx);
779 * cb_ctx: Higher layer context data for callbacks
783 struct upnp_wps_device_sm *wps_upnp;
785 /* Pending messages from UPnP PutWLANResponse */
786 struct upnp_pending_message *upnp_msgs;
788 u16 ap_nfc_dev_pw_id;
789 struct wpabuf *ap_nfc_dh_pubkey;
790 struct wpabuf *ap_nfc_dh_privkey;
791 struct wpabuf *ap_nfc_dev_pw;
794 struct wps_registrar *
795 wps_registrar_init(struct wps_context *wps,
796 const struct wps_registrar_config *cfg);
797 void wps_registrar_deinit(struct wps_registrar *reg);
798 int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr,
799 const u8 *uuid, const u8 *pin, size_t pin_len,
801 int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid);
802 int wps_registrar_wps_cancel(struct wps_registrar *reg);
803 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
804 int wps_registrar_button_pushed(struct wps_registrar *reg,
805 const u8 *p2p_dev_addr);
806 void wps_registrar_complete(struct wps_registrar *registrar, const u8 *uuid_e,
807 const u8 *dev_pw, size_t dev_pw_len);
808 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
809 const struct wpabuf *wps_data,
811 int wps_registrar_update_ie(struct wps_registrar *reg);
812 int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr,
813 char *buf, size_t buflen);
814 int wps_registrar_config_ap(struct wps_registrar *reg,
815 struct wps_credential *cred);
816 int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg,
817 const u8 *pubkey_hash, u16 pw_id,
818 const u8 *dev_pw, size_t dev_pw_len,
819 int pk_hash_provided_oob);
820 int wps_registrar_add_nfc_password_token(struct wps_registrar *reg,
821 const u8 *oob_dev_pw,
822 size_t oob_dev_pw_len);
823 void wps_registrar_flush(struct wps_registrar *reg);
825 int wps_build_credential_wrap(struct wpabuf *msg,
826 const struct wps_credential *cred);
828 unsigned int wps_pin_checksum(unsigned int pin);
829 unsigned int wps_pin_valid(unsigned int pin);
830 unsigned int wps_generate_pin(void);
831 int wps_pin_str_valid(const char *pin);
832 void wps_free_pending_msgs(struct upnp_pending_message *msgs);
834 struct wpabuf * wps_get_oob_cred(struct wps_context *wps, int rf_band,
836 int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr);
837 int wps_attr_text(struct wpabuf *data, char *buf, char *end);
838 const char * wps_ei_str(enum wps_error_indication ei);
840 struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname,
842 void wps_er_refresh(struct wps_er *er);
843 void wps_er_deinit(struct wps_er *er, void (*cb)(void *ctx), void *ctx);
844 void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
845 u16 sel_reg_config_methods);
846 int wps_er_pbc(struct wps_er *er, const u8 *uuid, const u8 *addr);
847 const u8 * wps_er_get_sta_uuid(struct wps_er *er, const u8 *addr);
848 int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *addr,
849 const u8 *pin, size_t pin_len);
850 int wps_er_set_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
851 const struct wps_credential *cred);
852 int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
853 const u8 *pin, size_t pin_len,
854 const struct wps_credential *cred);
855 struct wpabuf * wps_er_config_token_from_cred(struct wps_context *wps,
856 struct wps_credential *cred);
857 struct wpabuf * wps_er_nfc_config_token(struct wps_er *er, const u8 *uuid,
859 struct wpabuf * wps_er_nfc_handover_sel(struct wps_er *er,
860 struct wps_context *wps, const u8 *uuid,
861 const u8 *addr, struct wpabuf *pubkey);
863 int wps_dev_type_str2bin(const char *str, u8 dev_type[WPS_DEV_TYPE_LEN]);
864 char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf,
866 void uuid_gen_mac_addr(const u8 *mac_addr, u8 *uuid);
867 u16 wps_config_methods_str2bin(const char *str);
868 struct wpabuf * wps_build_nfc_pw_token(u16 dev_pw_id,
869 const struct wpabuf *pubkey,
870 const struct wpabuf *dev_pw);
871 struct wpabuf * wps_nfc_token_build(int ndef, int id, struct wpabuf *pubkey,
872 struct wpabuf *dev_pw);
873 int wps_nfc_gen_dh(struct wpabuf **pubkey, struct wpabuf **privkey);
874 struct wpabuf * wps_nfc_token_gen(int ndef, int *id, struct wpabuf **pubkey,
875 struct wpabuf **privkey,
876 struct wpabuf **dev_pw);
877 struct wpabuf * wps_build_nfc_handover_req(struct wps_context *ctx,
878 struct wpabuf *nfc_dh_pubkey);
879 struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
880 struct wpabuf *nfc_dh_pubkey,
881 const u8 *bssid, int freq);
882 struct wpabuf * wps_build_nfc_handover_req_p2p(struct wps_context *ctx,
883 struct wpabuf *nfc_dh_pubkey);
884 struct wpabuf * wps_build_nfc_handover_sel_p2p(struct wps_context *ctx,
886 struct wpabuf *nfc_dh_pubkey,
887 struct wpabuf *nfc_dev_pw);
890 struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf);
891 struct wpabuf * ndef_build_wifi(const struct wpabuf *buf);
892 struct wpabuf * ndef_parse_p2p(const struct wpabuf *buf);
893 struct wpabuf * ndef_build_p2p(const struct wpabuf *buf);
895 #ifdef CONFIG_WPS_STRICT
896 int wps_validate_beacon(const struct wpabuf *wps_ie);
897 int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, int probe,
899 int wps_validate_probe_req(const struct wpabuf *wps_ie, const u8 *addr);
900 int wps_validate_assoc_req(const struct wpabuf *wps_ie);
901 int wps_validate_assoc_resp(const struct wpabuf *wps_ie);
902 int wps_validate_m1(const struct wpabuf *tlvs);
903 int wps_validate_m2(const struct wpabuf *tlvs);
904 int wps_validate_m2d(const struct wpabuf *tlvs);
905 int wps_validate_m3(const struct wpabuf *tlvs);
906 int wps_validate_m4(const struct wpabuf *tlvs);
907 int wps_validate_m4_encr(const struct wpabuf *tlvs, int wps2);
908 int wps_validate_m5(const struct wpabuf *tlvs);
909 int wps_validate_m5_encr(const struct wpabuf *tlvs, int wps2);
910 int wps_validate_m6(const struct wpabuf *tlvs);
911 int wps_validate_m6_encr(const struct wpabuf *tlvs, int wps2);
912 int wps_validate_m7(const struct wpabuf *tlvs);
913 int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap, int wps2);
914 int wps_validate_m8(const struct wpabuf *tlvs);
915 int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap, int wps2);
916 int wps_validate_wsc_ack(const struct wpabuf *tlvs);
917 int wps_validate_wsc_nack(const struct wpabuf *tlvs);
918 int wps_validate_wsc_done(const struct wpabuf *tlvs);
919 int wps_validate_upnp_set_selected_registrar(const struct wpabuf *tlvs);
920 #else /* CONFIG_WPS_STRICT */
921 static inline int wps_validate_beacon(const struct wpabuf *wps_ie){
925 static inline int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie,
926 int probe, const u8 *addr)
931 static inline int wps_validate_probe_req(const struct wpabuf *wps_ie,
937 static inline int wps_validate_assoc_req(const struct wpabuf *wps_ie)
942 static inline int wps_validate_assoc_resp(const struct wpabuf *wps_ie)
947 static inline int wps_validate_m1(const struct wpabuf *tlvs)
952 static inline int wps_validate_m2(const struct wpabuf *tlvs)
957 static inline int wps_validate_m2d(const struct wpabuf *tlvs)
962 static inline int wps_validate_m3(const struct wpabuf *tlvs)
967 static inline int wps_validate_m4(const struct wpabuf *tlvs)
972 static inline int wps_validate_m4_encr(const struct wpabuf *tlvs, int wps2)
977 static inline int wps_validate_m5(const struct wpabuf *tlvs)
982 static inline int wps_validate_m5_encr(const struct wpabuf *tlvs, int wps2)
987 static inline int wps_validate_m6(const struct wpabuf *tlvs)
992 static inline int wps_validate_m6_encr(const struct wpabuf *tlvs, int wps2)
997 static inline int wps_validate_m7(const struct wpabuf *tlvs)
1002 static inline int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap,
1008 static inline int wps_validate_m8(const struct wpabuf *tlvs)
1013 static inline int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap,
1019 static inline int wps_validate_wsc_ack(const struct wpabuf *tlvs)
1024 static inline int wps_validate_wsc_nack(const struct wpabuf *tlvs)
1029 static inline int wps_validate_wsc_done(const struct wpabuf *tlvs)
1034 static inline int wps_validate_upnp_set_selected_registrar(
1035 const struct wpabuf *tlvs)
1039 #endif /* CONFIG_WPS_STRICT */