45 u8 ssid[SSID_MAX_LEN];
52 u8 mac_addr[ETH_ALEN];
57 #define WPS_DEV_TYPE_LEN 8
58 #define WPS_DEV_TYPE_BUFSIZE 21
59 #define WPS_SEC_DEV_TYPE_MAX_LEN 128
61 #define MAX_WPS_VENDOR_EXTENSIONS 10
63 #define WPS_MAX_VENDOR_EXT_LEN 1024
65 #define MAX_WPS_PARSE_VENDOR_EXT 10
83 u8 mac_addr[ETH_ALEN];
89 u8 pri_dev_type[WPS_DEV_TYPE_LEN];
90 #define WPS_SEC_DEVICE_TYPES 5
91 u8 sec_dev_type[WPS_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
96 struct wpabuf *vendor_ext_m1;
97 struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
233 const struct wpabuf *msg);
240 const struct wpabuf *wps_b);
250 enum wps_request_type req_type,
251 unsigned int num_req_dev_types,
252 const u8 *req_dev_types);
271 int (*
new_psk_cb)(
void *ctx,
const u8 *mac_addr,
const u8 *p2p_dev_addr,
272 const u8 *psk,
size_t psk_len);
286 struct wpabuf *probe_resp_ie);
313 const u8 *uuid_e,
const u8 *dev_pw,
332 u16 sel_reg_config_methods);
346 const u8 *pri_dev_type, u16 config_methods,
347 u16 dev_password_id, u8 request_type,
348 const char *dev_name);
518 const u8 *manufacturer;
519 size_t manufacturer_len;
520 const u8 *model_name;
521 size_t model_name_len;
522 const u8 *model_number;
523 size_t model_number_len;
524 const u8 *serial_number;
525 size_t serial_number_len;
528 const u8 *primary_dev_type;
540 u16 error_indication;
541 u8 peer_macaddr[ETH_ALEN];
545 u8 peer_macaddr[ETH_ALEN];
551 u8 peer_macaddr[ETH_ALEN];
557 const char *friendly_name;
558 const char *manufacturer;
559 const char *manufacturer_url;
560 const char *model_description;
561 const char *model_name;
562 const char *model_number;
563 const char *model_url;
564 const char *serial_number;
566 const u8 *pri_dev_type;
576 const u8 *pri_dev_type;
577 const char *dev_name;
578 const char *manufacturer;
579 const char *model_name;
580 const char *model_number;
581 const char *serial_number;
593 u16 sel_reg_config_methods;
595 WPS_ER_SET_SEL_REG_START,
596 WPS_ER_SET_SEL_REG_DONE,
597 WPS_ER_SET_SEL_REG_FAILED
613 enum wps_msg_type type;
842 u16 ap_nfc_dev_pw_id;
843 struct wpabuf *ap_nfc_dh_pubkey;
844 struct wpabuf *ap_nfc_dh_privkey;
845 struct wpabuf *ap_nfc_dev_pw;
853 const u8 *uuid,
const u8 *pin,
size_t pin_len,
859 const u8 *p2p_dev_addr);
860 void wps_registrar_complete(
struct wps_registrar *registrar,
const u8 *uuid_e,
861 const u8 *dev_pw,
size_t dev_pw_len);
866 int wps_registrar_get_info(
struct wps_registrar *reg,
const u8 *addr,
867 char *buf,
size_t buflen);
870 int wps_registrar_add_nfc_pw_token(
struct wps_registrar *reg,
871 const u8 *pubkey_hash, u16 pw_id,
872 const u8 *dev_pw,
size_t dev_pw_len,
873 int pk_hash_provided_oob);
874 int wps_registrar_add_nfc_password_token(
struct wps_registrar *reg,
875 const u8 *oob_dev_pw,
876 size_t oob_dev_pw_len);
879 int wps_build_credential_wrap(
struct wpabuf *msg,
885 int wps_pin_str_valid(
const char *pin);
891 int wps_attr_text(
struct wpabuf *data,
char *buf,
char *end);
892 const char * wps_ei_str(
enum wps_error_indication ei);
896 void wps_er_refresh(
struct wps_er *er);
897 void wps_er_deinit(
struct wps_er *er,
void (*cb)(
void *ctx),
void *ctx);
898 void wps_er_set_sel_reg(
struct wps_er *er,
int sel_reg, u16 dev_passwd_id,
899 u16 sel_reg_config_methods);
900 int wps_er_pbc(
struct wps_er *er,
const u8 *uuid,
const u8 *addr);
901 const u8 * wps_er_get_sta_uuid(
struct wps_er *er,
const u8 *addr);
902 int wps_er_learn(
struct wps_er *er,
const u8 *uuid,
const u8 *addr,
903 const u8 *pin,
size_t pin_len);
904 int wps_er_set_config(
struct wps_er *er,
const u8 *uuid,
const u8 *addr,
906 int wps_er_config(
struct wps_er *er,
const u8 *uuid,
const u8 *addr,
907 const u8 *pin,
size_t pin_len,
911 struct wpabuf * wps_er_nfc_config_token(
struct wps_er *er,
const u8 *uuid,
913 struct wpabuf * wps_er_nfc_handover_sel(
struct wps_er *er,
915 const u8 *addr,
struct wpabuf *pubkey);
917 int wps_dev_type_str2bin(
const char *str, u8 dev_type[WPS_DEV_TYPE_LEN]);
918 char * wps_dev_type_bin2str(
const u8 dev_type[WPS_DEV_TYPE_LEN],
char *buf,
920 void uuid_gen_mac_addr(
const u8 *mac_addr, u8 *uuid);
921 u16 wps_config_methods_str2bin(
const char *str);
922 struct wpabuf * wps_build_nfc_pw_token(u16 dev_pw_id,
923 const struct wpabuf *pubkey,
924 const struct wpabuf *dev_pw);
925 struct wpabuf * wps_nfc_token_build(
int ndef,
int id,
struct wpabuf *pubkey,
927 int wps_nfc_gen_dh(
struct wpabuf **pubkey,
struct wpabuf **privkey);
928 struct wpabuf * wps_nfc_token_gen(
int ndef,
int *
id,
struct wpabuf **pubkey,
932 struct wpabuf *nfc_dh_pubkey);
934 struct wpabuf *nfc_dh_pubkey,
935 const u8 *bssid,
int freq);
937 struct wpabuf *nfc_dh_pubkey);
940 struct wpabuf *nfc_dh_pubkey,
941 struct wpabuf *nfc_dev_pw);
944 struct wpabuf * ndef_parse_wifi(
const struct wpabuf *buf);
945 struct wpabuf * ndef_build_wifi(
const struct wpabuf *buf);
946 struct wpabuf * ndef_parse_p2p(
const struct wpabuf *buf);
947 struct wpabuf * ndef_build_p2p(
const struct wpabuf *buf);
949 #ifdef CONFIG_WPS_STRICT
950 int wps_validate_beacon(
const struct wpabuf *wps_ie);
951 int wps_validate_beacon_probe_resp(
const struct wpabuf *wps_ie,
int probe,
953 int wps_validate_probe_req(
const struct wpabuf *wps_ie,
const u8 *addr);
954 int wps_validate_assoc_req(
const struct wpabuf *wps_ie);
955 int wps_validate_assoc_resp(
const struct wpabuf *wps_ie);
956 int wps_validate_m1(
const struct wpabuf *tlvs);
957 int wps_validate_m2(
const struct wpabuf *tlvs);
958 int wps_validate_m2d(
const struct wpabuf *tlvs);
959 int wps_validate_m3(
const struct wpabuf *tlvs);
960 int wps_validate_m4(
const struct wpabuf *tlvs);
961 int wps_validate_m4_encr(
const struct wpabuf *tlvs,
int wps2);
962 int wps_validate_m5(
const struct wpabuf *tlvs);
963 int wps_validate_m5_encr(
const struct wpabuf *tlvs,
int wps2);
964 int wps_validate_m6(
const struct wpabuf *tlvs);
965 int wps_validate_m6_encr(
const struct wpabuf *tlvs,
int wps2);
966 int wps_validate_m7(
const struct wpabuf *tlvs);
967 int wps_validate_m7_encr(
const struct wpabuf *tlvs,
int ap,
int wps2);
968 int wps_validate_m8(
const struct wpabuf *tlvs);
969 int wps_validate_m8_encr(
const struct wpabuf *tlvs,
int ap,
int wps2);
970 int wps_validate_wsc_ack(
const struct wpabuf *tlvs);
971 int wps_validate_wsc_nack(
const struct wpabuf *tlvs);
972 int wps_validate_wsc_done(
const struct wpabuf *tlvs);
973 int wps_validate_upnp_set_selected_registrar(
const struct wpabuf *tlvs);
975 static inline int wps_validate_beacon(
const struct wpabuf *wps_ie){
979 static inline int wps_validate_beacon_probe_resp(
const struct wpabuf *wps_ie,
980 int probe,
const u8 *addr)
985 static inline int wps_validate_probe_req(
const struct wpabuf *wps_ie,
991 static inline int wps_validate_assoc_req(
const struct wpabuf *wps_ie)
996 static inline int wps_validate_assoc_resp(
const struct wpabuf *wps_ie)
1001 static inline int wps_validate_m1(
const struct wpabuf *tlvs)
1006 static inline int wps_validate_m2(
const struct wpabuf *tlvs)
1011 static inline int wps_validate_m2d(
const struct wpabuf *tlvs)
1016 static inline int wps_validate_m3(
const struct wpabuf *tlvs)
1021 static inline int wps_validate_m4(
const struct wpabuf *tlvs)
1026 static inline int wps_validate_m4_encr(
const struct wpabuf *tlvs,
int wps2)
1031 static inline int wps_validate_m5(
const struct wpabuf *tlvs)
1036 static inline int wps_validate_m5_encr(
const struct wpabuf *tlvs,
int wps2)
1041 static inline int wps_validate_m6(
const struct wpabuf *tlvs)
1046 static inline int wps_validate_m6_encr(
const struct wpabuf *tlvs,
int wps2)
1051 static inline int wps_validate_m7(
const struct wpabuf *tlvs)
1056 static inline int wps_validate_m7_encr(
const struct wpabuf *tlvs,
int ap,
1062 static inline int wps_validate_m8(
const struct wpabuf *tlvs)
1067 static inline int wps_validate_m8_encr(
const struct wpabuf *tlvs,
int ap,
1073 static inline int wps_validate_wsc_ack(
const struct wpabuf *tlvs)
1078 static inline int wps_validate_wsc_nack(
const struct wpabuf *tlvs)
1083 static inline int wps_validate_wsc_done(
const struct wpabuf *tlvs)
1088 static inline int wps_validate_upnp_set_selected_registrar(
1089 const struct wpabuf *tlvs)
int use_psk_key
Use PSK format key in Credential.
Definition: wps.h:162
ER: AP Settings learned.
Definition: wps.h:493
Processing continues, but waiting for an external.
Definition: wps.h:229
wps_event
WPS event types.
Definition: wps.h:416
const u8 * extra_cred
extra_cred: Additional Credential attribute(s)
Definition: wps.h:371
void * cb_ctx
cb_ctx: Higher layer context data for Registrar callbacks
Definition: wps.h:351
M2D event data.
Definition: wps.h:516
int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr, int ver1_compat)
Check whether WPS IE authorizes MAC address.
Definition: wps.c:309
ER: AP added.
Definition: wps.h:469
char * model_description
Model Description (recommended for UPnP)
Definition: wps.h:796
u8 ssid[SSID_MAX_LEN]
SSID.
Definition: wps.h:662
char * upc
Universal Product Code (optional for UPnP)
Definition: wps.h:808
WPS registration protocol data.
Definition: wps_i.h:20
Wi-Fi Protected Setup - message definitions.
struct wpabuf * wps_build_probe_req_ie(u16 pw_id, struct wps_device_data *dev, const u8 *uuid, enum wps_request_type req_type, unsigned int num_req_dev_types, const u8 *req_dev_types)
Build WPS IE for Probe Request.
Definition: wps.c:489
size_t pin_len
Length on pin in octets.
Definition: wps.h:129
size_t ssid_len
Length of ssid in octets.
Definition: wps.h:668
Registration succeeded.
Definition: wps.h:433
int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr, const u8 *uuid, const u8 *pin, size_t pin_len, int timeout)
Configure a new PIN for Registrar.
Definition: wps_registrar.c:732
Pending PutWLANResponse messages.
Definition: wps.h:609
struct wpabuf * wps_build_assoc_resp_ie(void)
Build WPS IE for (Re)Association Response.
Definition: wps.c:447
struct wps_context * wps
Pointer to long term WPS context.
Definition: wps_i.h:25
int(* cred_cb)(void *ctx, const struct wps_credential *cred)
Callback to notify that new Credentials were received.
Definition: wps.h:816
u16 auth_types
Authentication types (bit field of WPS_AUTH_*)
Definition: wps.h:712
wsc_op_code
EAP-WSC OP-Code values.
Definition: wps.h:15
const u8 * peer_pubkey_hash
Peer public key hash or NULL if not known.
Definition: wps.h:194
int ap
Whether the local end is an access point.
Definition: wps.h:628
Definition: wps_registrar.c:137
int(* set_ie_cb)(void *ctx, struct wpabuf *beacon_ie, struct wpabuf *probe_resp_ie)
Callback for WPS IE changes.
Definition: wps.h:285
ER: Enrollee added.
Definition: wps.h:481
ER: SetSelectedRegistrar event.
Definition: wps.h:499
int wps_is_selected_pin_registrar(const struct wpabuf *msg)
Check whether WPS IE indicates active PIN.
Definition: wps.c:290
int registrar
Whether this end is a Registrar.
Definition: wps.h:117
int dualband
Whether this is a concurrent dualband AP.
Definition: wps.h:399
ER: Enrollee removed.
Definition: wps.h:487
PBC mode was activated.
Definition: wps.h:457
int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid)
Invalidate a PIN for a specific UUID-E.
Definition: wps_registrar.c:858
Definition: wps_upnp_i.h:123
int wps_is_20(const struct wpabuf *msg)
Check whether WPS attributes claim support for WPS 2.0.
Definition: wps.c:396
unsigned int wps_generate_pin(void)
Generate a random PIN.
Definition: wps_common.c:234
u8 psk[32]
The current network PSK.
Definition: wps.h:757
char * friendly_name
Friendly Name (required for UPnP)
Definition: wps.h:784
void(* pin_needed_cb)(void *ctx, const u8 *uuid_e, const struct wps_device_data *dev)
Callback for requesting a PIN.
Definition: wps.h:298
wps_process_res
WPS message processing result.
Definition: wps.h:205
u8 uuid[16]
Own UUID.
Definition: wps.h:652
int disable_auto_conf
Disable auto-configuration on first registration.
Definition: wps.h:387
enum wps_state wps_state
Current WPS state.
Definition: wps.h:640
M2D received (Registrar did not know us)
Definition: wps.h:421
enum wps_process_res wps_process_msg(struct wps_data *wps, enum wsc_op_code op_code, const struct wpabuf *msg)
Process a WPS message.
Definition: wps.c:195
void wps_deinit(struct wps_data *data)
Deinitialize WPS Registration protocol data.
Definition: wps.c:152
WPS configuration for a single registration protocol run.
Definition: wps.h:106
Registration failed.
Definition: wps.h:427
u16 dev_pw_id
Device Password ID for Enrollee when PIN is used.
Definition: wps.h:168
u16 ap_auth_type
Current AP authentication types (WPS_AUTH_*)
Definition: wps.h:724
int pbc
Whether this is protocol run uses PBC.
Definition: wps.h:135
PBC session overlap detected.
Definition: wps.h:445
void(* set_sel_reg_cb)(void *ctx, int sel_reg, u16 dev_passwd_id, u16 sel_reg_config_methods)
Callback for reporting selected registrar changes.
Definition: wps.h:331
unsigned int wps_pin_checksum(unsigned int pin)
Compute PIN checksum.
Definition: wps_common.c:205
int ap_setup_locked
Whether AP setup is locked (only used at AP)
Definition: wps.h:646
union wps_event_data - WPS event data
Definition: wps.h:511
int wps_is_selected_pbc_registrar(const struct wpabuf *msg)
Check whether WPS IE indicates active PBC.
Definition: wps.c:229
Registration failure information.
Definition: wps.h:537
void(* event_cb)(void *ctx, enum wps_event event, union wps_event_data *data)
Event callback (state information about progress)
Definition: wps.h:824
WPS Device Data.
Definition: wps.h:82
struct wps_registrar * registrar
Pointer to WPS registrar data from wps_registrar_init()
Definition: wps.h:634
int psk_set
Whether psk value is set.
Definition: wps.h:763
void * dh_ctx
Context data for Diffie-Hellman operation.
Definition: wps.h:680
size_t network_key_len
Length of network_key in octets.
Definition: wps.h:748
PBC mode was disabled.
Definition: wps.h:463
u16 config_methods
Enabled configuration methods.
Definition: wps.h:700
int wps_ap_priority_compar(const struct wpabuf *wps_a, const struct wpabuf *wps_b)
Prioritize WPS IE from two APs.
Definition: wps.c:351
void(* reg_success_cb)(void *ctx, const u8 *mac_addr, const u8 *uuid_e, const u8 *dev_pw, size_t dev_pw_len)
Callback for reporting successful registration.
Definition: wps.h:312
const u8 * peer_addr
peer_addr: MAC address of the peer in AP; NULL if not AP
Definition: wps.h:152
struct wpabuf * dh_pubkey
Diffie-Hellman public key.
Definition: wps.h:692
Password authentication failed.
Definition: wps.h:439
int pbc_in_m1
Do not remove PushButton config method in M1 (AP)
Definition: wps.h:188
struct wpabuf * dh_privkey
Diffie-Hellman private key.
Definition: wps.h:686
const u8 * p2p_dev_addr
P2P Device Address from (Re)Association Request.
Definition: wps.h:179
PBC walktime expired before protocol run start.
Definition: wps.h:451
int wps_registrar_button_pushed(struct wps_registrar *reg, const u8 *p2p_dev_addr)
Notify Registrar that AP button was pushed.
Definition: wps_registrar.c:990
int force_per_enrollee_psk
Force per-Enrollee random PSK.
Definition: wps.h:408
struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type)
Build WPS IE for (Re)Association Request.
Definition: wps.c:413
u16 ap_encr_type
Current AP encryption type (WPS_ENCR_*)
Definition: wps.h:718
u16 encr_types
Enabled encryption types (bit field of WPS_ENCR_*)
Definition: wps.h:706
Definition: wps_attr_parse.h:10
size_t extra_cred_len
extra_cred_len: Length of extra_cred in octets
Definition: wps.h:374
char * manufacturer_url
Manufacturer URL (optional for UPnP)
Definition: wps.h:790
void wps_registrar_deinit(struct wps_registrar *reg)
Deinitialize WPS Registrar data.
Definition: wps_registrar.c:695
External Registrar used correct AP PIN.
Definition: wps.h:505
struct wps_device_data dev
Own WPS device data.
Definition: wps.h:674
u8 * network_key
The current Network Key (PSK) or NULL to generate new.
Definition: wps.h:742
IEEE 802.11 Frame type definitions Copyright (c) 2007-2008 Intel Corporation.
ER: AP removed.
Definition: wps.h:475
struct wps_context * wps
Pointer to long term WPS context.
Definition: wps.h:111
Processing done.
Definition: wps.h:210
WPS Credential.
Definition: wps.h:44
WPS Registrar configuration.
Definition: wps.h:259
Processing continues.
Definition: wps.h:216
struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code)
Build a WPS message.
Definition: wps.c:215
const u8 * wps_get_uuid_e(const struct wpabuf *msg)
Get UUID-E from WPS IE.
Definition: wps.c:382
u8 * ap_settings
AP Settings override for M7 (only used at AP)
Definition: wps.h:772
int(* rf_band_cb)(void *ctx)
Fetch currently used RF band.
Definition: wps.h:832
struct wps_data * wps_init(const struct wps_config *cfg)
Initialize WPS Registration protocol data.
Definition: wps.c:31
int(* new_psk_cb)(void *ctx, const u8 *mac_addr, const u8 *p2p_dev_addr, const u8 *psk, size_t psk_len)
Callback for new PSK.
Definition: wps.h:271
const u8 * pin
Enrollee Device Password (NULL for Registrar or PBC)
Definition: wps.h:123
struct wps_registrar * wps_registrar_init(struct wps_context *wps, const struct wps_registrar_config *cfg)
Initialize WPS Registrar data.
Definition: wps_registrar.c:633
int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid)
Unlock a PIN for a specific UUID-E.
Definition: wps_registrar.c:935
size_t ap_settings_len
Length of ap_settings in octets.
Definition: wps.h:778
unsigned int wps_pin_valid(unsigned int pin)
Check whether a PIN has a valid checksum.
Definition: wps_common.c:224
char * model_url
Model URL (optional for UPnP)
Definition: wps.h:802
int skip_cred_build
skip_cred_build: Do not build credential
Definition: wps.h:361
const struct wps_credential * new_ap_settings
New AP settings (NULL if not used)
Definition: wps.h:149
void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr, const struct wpabuf *wps_data, int p2p_wildcard)
Notify Registrar of Probe Request.
Definition: wps_registrar.c:1091
Long term WPS context data.
Definition: wps.h:623
void * cb_ctx
cb_ctx: Higher layer context data for callbacks
Definition: wps.h:835
const struct wpabuf * assoc_wps_ie
assoc_wps_ie: (Re)AssocReq WPS IE (in AP; NULL if not AP)
Definition: wps.h:138
void(* enrollee_seen_cb)(void *ctx, const u8 *addr, const u8 *uuid_e, const u8 *pri_dev_type, u16 config_methods, u16 dev_password_id, u8 request_type, const char *dev_name)
Callback for reporting Enrollee based on ProbeReq.
Definition: wps.h:345
Processing failed.
Definition: wps.h:222
int static_wep_only
Whether the BSS supports only static WEP.
Definition: wps.h:393