wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wps.h
Go to the documentation of this file.
1 
5 #ifndef WPS_H
6 #define WPS_H
7 
9 #include "wps_defs.h"
10 
16  WSC_UPnP = 0 /* No OP Code in UPnP transport */,
17  WSC_Start = 0x01,
18  WSC_ACK = 0x02,
19  WSC_NACK = 0x03,
20  WSC_MSG = 0x04,
21  WSC_Done = 0x05,
22  WSC_FRAG_ACK = 0x06
23 };
24 
25 struct wps_registrar;
26 struct upnp_wps_device_sm;
27 struct wps_er;
28 struct wps_parse_attr;
29 
45  u8 ssid[SSID_MAX_LEN];
46  size_t ssid_len;
47  u16 auth_type;
48  u16 encr_type;
49  u8 key_idx;
50  u8 key[64];
51  size_t key_len;
52  u8 mac_addr[ETH_ALEN];
53  const u8 *cred_attr;
54  size_t cred_attr_len;
55 };
56 
57 #define WPS_DEV_TYPE_LEN 8
58 #define WPS_DEV_TYPE_BUFSIZE 21
59 #define WPS_SEC_DEV_TYPE_MAX_LEN 128
60 /* maximum number of advertised WPS vendor extension attributes */
61 #define MAX_WPS_VENDOR_EXTENSIONS 10
62 /* maximum size of WPS Vendor extension attribute */
63 #define WPS_MAX_VENDOR_EXT_LEN 1024
64 /* maximum number of parsed WPS vendor extension attributes */
65 #define MAX_WPS_PARSE_VENDOR_EXT 10
66 
83  u8 mac_addr[ETH_ALEN];
84  char *device_name;
85  char *manufacturer;
86  char *model_name;
87  char *model_number;
88  char *serial_number;
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];
92  u8 num_sec_dev_types;
93  u32 os_version;
94  u8 rf_bands;
95  u16 config_methods;
96  struct wpabuf *vendor_ext_m1;
97  struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
98 
99  int p2p;
100 };
101 
106 struct wps_config {
111  struct wps_context *wps;
112 
118 
123  const u8 *pin;
124 
129  size_t pin_len;
130 
135  int pbc;
136 
138  const struct wpabuf *assoc_wps_ie;
139 
150 
152  const u8 *peer_addr;
153 
163 
169 
179  const u8 *p2p_dev_addr;
180 
189 
194  const u8 *peer_pubkey_hash;
195 };
196 
197 struct wps_data * wps_init(const struct wps_config *cfg);
198 
199 void wps_deinit(struct wps_data *data);
200 
211 
217 
223 
230 };
232  enum wsc_op_code op_code,
233  const struct wpabuf *msg);
234 
235 struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code);
236 
237 int wps_is_selected_pbc_registrar(const struct wpabuf *msg);
238 int wps_is_selected_pin_registrar(const struct wpabuf *msg);
239 int wps_ap_priority_compar(const struct wpabuf *wps_a,
240  const struct wpabuf *wps_b);
241 int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
242  int ver1_compat);
243 const u8 * wps_get_uuid_e(const struct wpabuf *msg);
244 int wps_is_20(const struct wpabuf *msg);
245 
246 struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type);
247 struct wpabuf * wps_build_assoc_resp_ie(void);
248 struct wpabuf * wps_build_probe_req_ie(u16 pw_id, struct wps_device_data *dev,
249  const u8 *uuid,
250  enum wps_request_type req_type,
251  unsigned int num_req_dev_types,
252  const u8 *req_dev_types);
253 
254 
271  int (*new_psk_cb)(void *ctx, const u8 *mac_addr, const u8 *p2p_dev_addr,
272  const u8 *psk, size_t psk_len);
273 
285  int (*set_ie_cb)(void *ctx, struct wpabuf *beacon_ie,
286  struct wpabuf *probe_resp_ie);
287 
298  void (*pin_needed_cb)(void *ctx, const u8 *uuid_e,
299  const struct wps_device_data *dev);
300 
312  void (*reg_success_cb)(void *ctx, const u8 *mac_addr,
313  const u8 *uuid_e, const u8 *dev_pw,
314  size_t dev_pw_len);
315 
331  void (*set_sel_reg_cb)(void *ctx, int sel_reg, u16 dev_passwd_id,
332  u16 sel_reg_config_methods);
333 
345  void (*enrollee_seen_cb)(void *ctx, const u8 *addr, const u8 *uuid_e,
346  const u8 *pri_dev_type, u16 config_methods,
347  u16 dev_password_id, u8 request_type,
348  const char *dev_name);
349 
351  void *cb_ctx;
352 
362 
371  const u8 *extra_cred;
372 
375 
388 
394 
399  int dualband;
400 
409 };
410 
411 
416 enum wps_event {
422 
428 
434 
440 
446 
452 
458 
464 
470 
476 
482 
488 
494 
500 
506 };
507 
516  struct wps_event_m2d {
517  u16 config_methods;
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;
526  const u8 *dev_name;
527  size_t dev_name_len;
528  const u8 *primary_dev_type; /* 8 octets */
529  u16 config_error;
530  u16 dev_password_id;
531  } m2d;
532 
537  struct wps_event_fail {
538  int msg;
539  u16 config_error;
540  u16 error_indication;
541  u8 peer_macaddr[ETH_ALEN];
542  } fail;
543 
545  u8 peer_macaddr[ETH_ALEN];
546  } success;
547 
549  int enrollee;
550  int part;
551  u8 peer_macaddr[ETH_ALEN];
552  } pwd_auth_fail;
553 
555  const u8 *uuid;
556  const u8 *mac_addr;
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;
565  const char *upc;
566  const u8 *pri_dev_type;
567  u8 wps_state;
568  } ap;
569 
571  const u8 *uuid;
572  const u8 *mac_addr;
573  int m1_received;
574  u16 config_methods;
575  u16 dev_passwd_id;
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;
582  } enrollee;
583 
585  const u8 *uuid;
586  const struct wps_credential *cred;
587  } ap_settings;
588 
590  const u8 *uuid;
591  int sel_reg;
592  u16 dev_passwd_id;
593  u16 sel_reg_config_methods;
594  enum {
595  WPS_ER_SET_SEL_REG_START,
596  WPS_ER_SET_SEL_REG_DONE,
597  WPS_ER_SET_SEL_REG_FAILED
598  } state;
599  } set_sel_reg;
600 };
601 
610  struct upnp_pending_message *next;
611  u8 addr[ETH_ALEN];
612  struct wpabuf *msg;
613  enum wps_msg_type type;
614 };
615 
623 struct wps_context {
628  int ap;
629 
635 
640  enum wps_state wps_state;
641 
647 
652  u8 uuid[16];
653 
662  u8 ssid[SSID_MAX_LEN];
663 
668  size_t ssid_len;
669 
675 
680  void *dh_ctx;
681 
687 
692  struct wpabuf *dh_pubkey;
693 
701 
707 
713 
719 
725 
743 
749 
757  u8 psk[32];
758 
763  int psk_set;
764 
773 
779 
785 
791 
797 
802  char *model_url;
803 
808  char *upc;
809 
816  int (*cred_cb)(void *ctx, const struct wps_credential *cred);
817 
824  void (*event_cb)(void *ctx, enum wps_event event,
825  union wps_event_data *data);
826 
832  int (*rf_band_cb)(void *ctx);
833 
835  void *cb_ctx;
836 
837  struct upnp_wps_device_sm *wps_upnp;
838 
839  /* Pending messages from UPnP PutWLANResponse */
840  struct upnp_pending_message *upnp_msgs;
841 
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;
846 };
847 
848 struct wps_registrar *
849 wps_registrar_init(struct wps_context *wps,
850  const struct wps_registrar_config *cfg);
851 void wps_registrar_deinit(struct wps_registrar *reg);
852 int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr,
853  const u8 *uuid, const u8 *pin, size_t pin_len,
854  int timeout);
855 int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid);
856 int wps_registrar_wps_cancel(struct wps_registrar *reg);
857 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
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);
862 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
863  const struct wpabuf *wps_data,
864  int p2p_wildcard);
865 int wps_registrar_update_ie(struct wps_registrar *reg);
866 int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr,
867  char *buf, size_t buflen);
868 int wps_registrar_config_ap(struct wps_registrar *reg,
869  struct wps_credential *cred);
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);
877 void wps_registrar_flush(struct wps_registrar *reg);
878 
879 int wps_build_credential_wrap(struct wpabuf *msg,
880  const struct wps_credential *cred);
881 
882 unsigned int wps_pin_checksum(unsigned int pin);
883 unsigned int wps_pin_valid(unsigned int pin);
884 unsigned int wps_generate_pin(void);
885 int wps_pin_str_valid(const char *pin);
886 void wps_free_pending_msgs(struct upnp_pending_message *msgs);
887 
888 struct wpabuf * wps_get_oob_cred(struct wps_context *wps, int rf_band,
889  int channel);
890 int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr);
891 int wps_attr_text(struct wpabuf *data, char *buf, char *end);
892 const char * wps_ei_str(enum wps_error_indication ei);
893 
894 struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname,
895  const char *filter);
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,
905  const struct wps_credential *cred);
906 int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
907  const u8 *pin, size_t pin_len,
908  const struct wps_credential *cred);
909 struct wpabuf * wps_er_config_token_from_cred(struct wps_context *wps,
910  struct wps_credential *cred);
911 struct wpabuf * wps_er_nfc_config_token(struct wps_er *er, const u8 *uuid,
912  const u8 *addr);
913 struct wpabuf * wps_er_nfc_handover_sel(struct wps_er *er,
914  struct wps_context *wps, const u8 *uuid,
915  const u8 *addr, struct wpabuf *pubkey);
916 
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,
919  size_t buf_len);
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,
926  struct wpabuf *dev_pw);
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,
929  struct wpabuf **privkey,
930  struct wpabuf **dev_pw);
931 struct wpabuf * wps_build_nfc_handover_req(struct wps_context *ctx,
932  struct wpabuf *nfc_dh_pubkey);
933 struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
934  struct wpabuf *nfc_dh_pubkey,
935  const u8 *bssid, int freq);
936 struct wpabuf * wps_build_nfc_handover_req_p2p(struct wps_context *ctx,
937  struct wpabuf *nfc_dh_pubkey);
938 struct wpabuf * wps_build_nfc_handover_sel_p2p(struct wps_context *ctx,
939  int nfc_dev_pw_id,
940  struct wpabuf *nfc_dh_pubkey,
941  struct wpabuf *nfc_dev_pw);
942 
943 /* ndef.c */
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);
948 
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,
952  const u8 *addr);
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);
974 #else /* CONFIG_WPS_STRICT */
975 static inline int wps_validate_beacon(const struct wpabuf *wps_ie){
976  return 0;
977 }
978 
979 static inline int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie,
980  int probe, const u8 *addr)
981 {
982  return 0;
983 }
984 
985 static inline int wps_validate_probe_req(const struct wpabuf *wps_ie,
986  const u8 *addr)
987 {
988  return 0;
989 }
990 
991 static inline int wps_validate_assoc_req(const struct wpabuf *wps_ie)
992 {
993  return 0;
994 }
995 
996 static inline int wps_validate_assoc_resp(const struct wpabuf *wps_ie)
997 {
998  return 0;
999 }
1000 
1001 static inline int wps_validate_m1(const struct wpabuf *tlvs)
1002 {
1003  return 0;
1004 }
1005 
1006 static inline int wps_validate_m2(const struct wpabuf *tlvs)
1007 {
1008  return 0;
1009 }
1010 
1011 static inline int wps_validate_m2d(const struct wpabuf *tlvs)
1012 {
1013  return 0;
1014 }
1015 
1016 static inline int wps_validate_m3(const struct wpabuf *tlvs)
1017 {
1018  return 0;
1019 }
1020 
1021 static inline int wps_validate_m4(const struct wpabuf *tlvs)
1022 {
1023  return 0;
1024 }
1025 
1026 static inline int wps_validate_m4_encr(const struct wpabuf *tlvs, int wps2)
1027 {
1028  return 0;
1029 }
1030 
1031 static inline int wps_validate_m5(const struct wpabuf *tlvs)
1032 {
1033  return 0;
1034 }
1035 
1036 static inline int wps_validate_m5_encr(const struct wpabuf *tlvs, int wps2)
1037 {
1038  return 0;
1039 }
1040 
1041 static inline int wps_validate_m6(const struct wpabuf *tlvs)
1042 {
1043  return 0;
1044 }
1045 
1046 static inline int wps_validate_m6_encr(const struct wpabuf *tlvs, int wps2)
1047 {
1048  return 0;
1049 }
1050 
1051 static inline int wps_validate_m7(const struct wpabuf *tlvs)
1052 {
1053  return 0;
1054 }
1055 
1056 static inline int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap,
1057  int wps2)
1058 {
1059  return 0;
1060 }
1061 
1062 static inline int wps_validate_m8(const struct wpabuf *tlvs)
1063 {
1064  return 0;
1065 }
1066 
1067 static inline int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap,
1068  int wps2)
1069 {
1070  return 0;
1071 }
1072 
1073 static inline int wps_validate_wsc_ack(const struct wpabuf *tlvs)
1074 {
1075  return 0;
1076 }
1077 
1078 static inline int wps_validate_wsc_nack(const struct wpabuf *tlvs)
1079 {
1080  return 0;
1081 }
1082 
1083 static inline int wps_validate_wsc_done(const struct wpabuf *tlvs)
1084 {
1085  return 0;
1086 }
1087 
1088 static inline int wps_validate_upnp_set_selected_registrar(
1089  const struct wpabuf *tlvs)
1090 {
1091  return 0;
1092 }
1093 #endif /* CONFIG_WPS_STRICT */
1094 
1095 #endif /* WPS_H */
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
Definition: wps_er.h:72
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
Definition: wps.h:554
Definition: wpabuf.h:16
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