2008-11-23 18:34:26 +01:00
|
|
|
/*
|
|
|
|
* Wi-Fi Protected Setup
|
2016-01-01 10:59:20 +01:00
|
|
|
* Copyright (c) 2007-2016, Jouni Malinen <j@w1.fi>
|
2008-11-23 18:34:26 +01:00
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-11-23 18:34:26 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WPS_H
|
|
|
|
#define WPS_H
|
|
|
|
|
2015-04-07 11:00:13 +02:00
|
|
|
#include "common/ieee802_11_defs.h"
|
2009-01-03 18:50:49 +01:00
|
|
|
#include "wps_defs.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enum wsc_op_code - EAP-WSC OP-Code values
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
enum wsc_op_code {
|
2009-01-29 17:47:02 +01:00
|
|
|
WSC_UPnP = 0 /* No OP Code in UPnP transport */,
|
2008-11-23 18:34:26 +01:00
|
|
|
WSC_Start = 0x01,
|
|
|
|
WSC_ACK = 0x02,
|
|
|
|
WSC_NACK = 0x03,
|
|
|
|
WSC_MSG = 0x04,
|
|
|
|
WSC_Done = 0x05,
|
|
|
|
WSC_FRAG_ACK = 0x06
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wps_registrar;
|
2009-01-29 17:47:02 +01:00
|
|
|
struct upnp_wps_device_sm;
|
2009-11-07 11:41:01 +01:00
|
|
|
struct wps_er;
|
2012-06-28 12:59:29 +02:00
|
|
|
struct wps_parse_attr;
|
2008-11-23 18:34:26 +01:00
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* struct wps_credential - WPS Credential
|
|
|
|
* @ssid: SSID
|
|
|
|
* @ssid_len: Length of SSID
|
|
|
|
* @auth_type: Authentication Type (WPS_AUTH_OPEN, .. flags)
|
|
|
|
* @encr_type: Encryption Type (WPS_ENCR_NONE, .. flags)
|
|
|
|
* @key_idx: Key index
|
|
|
|
* @key: Key
|
|
|
|
* @key_len: Key length in octets
|
2009-11-18 23:31:57 +01:00
|
|
|
* @mac_addr: MAC address of the Credential receiver
|
2009-01-17 21:17:12 +01:00
|
|
|
* @cred_attr: Unparsed Credential attribute data (used only in cred_cb());
|
|
|
|
* this may be %NULL, if not used
|
|
|
|
* @cred_attr_len: Length of cred_attr in octets
|
2009-01-03 18:50:49 +01:00
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_credential {
|
2015-04-07 11:00:13 +02:00
|
|
|
u8 ssid[SSID_MAX_LEN];
|
2008-11-23 18:34:26 +01:00
|
|
|
size_t ssid_len;
|
|
|
|
u16 auth_type;
|
|
|
|
u16 encr_type;
|
|
|
|
u8 key_idx;
|
|
|
|
u8 key[64];
|
|
|
|
size_t key_len;
|
|
|
|
u8 mac_addr[ETH_ALEN];
|
2009-01-17 21:17:12 +01:00
|
|
|
const u8 *cred_attr;
|
|
|
|
size_t cred_attr_len;
|
2008-11-23 18:34:26 +01:00
|
|
|
};
|
|
|
|
|
2009-11-26 10:39:29 +01:00
|
|
|
#define WPS_DEV_TYPE_LEN 8
|
|
|
|
#define WPS_DEV_TYPE_BUFSIZE 21
|
2011-03-17 10:45:46 +01:00
|
|
|
#define WPS_SEC_DEV_TYPE_MAX_LEN 128
|
2011-03-19 10:44:42 +01:00
|
|
|
/* maximum number of advertised WPS vendor extension attributes */
|
|
|
|
#define MAX_WPS_VENDOR_EXTENSIONS 10
|
2011-03-19 11:16:20 +01:00
|
|
|
/* maximum size of WPS Vendor extension attribute */
|
|
|
|
#define WPS_MAX_VENDOR_EXT_LEN 1024
|
|
|
|
/* maximum number of parsed WPS vendor extension attributes */
|
|
|
|
#define MAX_WPS_PARSE_VENDOR_EXT 10
|
2009-11-26 10:39:29 +01:00
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* struct wps_device_data - WPS Device Data
|
|
|
|
* @mac_addr: Device MAC address
|
|
|
|
* @device_name: Device Name (0..32 octets encoded in UTF-8)
|
|
|
|
* @manufacturer: Manufacturer (0..64 octets encoded in UTF-8)
|
|
|
|
* @model_name: Model Name (0..32 octets encoded in UTF-8)
|
|
|
|
* @model_number: Model Number (0..32 octets encoded in UTF-8)
|
|
|
|
* @serial_number: Serial Number (0..32 octets encoded in UTF-8)
|
2009-11-26 10:39:29 +01:00
|
|
|
* @pri_dev_type: Primary Device Type
|
2011-03-17 10:09:49 +01:00
|
|
|
* @sec_dev_type: Array of secondary device types
|
|
|
|
* @num_sec_dev_type: Number of secondary device types
|
2009-01-03 18:50:49 +01:00
|
|
|
* @os_version: OS Version
|
2015-04-27 19:42:08 +02:00
|
|
|
* @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ, WPS_RF_60GHZ flags)
|
2010-07-18 23:30:24 +02:00
|
|
|
* @p2p: Whether the device is a P2P device
|
2009-01-03 18:50:49 +01:00
|
|
|
*/
|
2008-11-29 12:21:28 +01:00
|
|
|
struct wps_device_data {
|
|
|
|
u8 mac_addr[ETH_ALEN];
|
|
|
|
char *device_name;
|
|
|
|
char *manufacturer;
|
|
|
|
char *model_name;
|
|
|
|
char *model_number;
|
|
|
|
char *serial_number;
|
2009-11-26 10:39:29 +01:00
|
|
|
u8 pri_dev_type[WPS_DEV_TYPE_LEN];
|
2011-03-17 10:09:49 +01:00
|
|
|
#define WPS_SEC_DEVICE_TYPES 5
|
|
|
|
u8 sec_dev_type[WPS_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
|
|
|
|
u8 num_sec_dev_types;
|
2008-11-29 12:21:28 +01:00
|
|
|
u32 os_version;
|
2009-01-03 18:50:49 +01:00
|
|
|
u8 rf_bands;
|
2011-09-01 14:24:45 +02:00
|
|
|
u16 config_methods;
|
2012-04-03 23:08:57 +02:00
|
|
|
struct wpabuf *vendor_ext_m1;
|
2011-03-19 10:44:42 +01:00
|
|
|
struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
|
2010-07-18 23:30:24 +02:00
|
|
|
|
|
|
|
int p2p;
|
2008-11-29 12:21:28 +01:00
|
|
|
};
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* struct wps_config - WPS configuration for a single registration protocol run
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_config {
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* wps - Pointer to long term WPS context
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_context *wps;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
2009-01-03 19:09:35 +01:00
|
|
|
* registrar - Whether this end is a Registrar
|
2009-01-03 18:50:49 +01:00
|
|
|
*/
|
2009-01-03 19:09:35 +01:00
|
|
|
int registrar;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pin - Enrollee Device Password (%NULL for Registrar or PBC)
|
|
|
|
*/
|
|
|
|
const u8 *pin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pin_len - Length on pin in octets
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
size_t pin_len;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pbc - Whether this is protocol run uses PBC
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
int pbc;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* assoc_wps_ie: (Re)AssocReq WPS IE (in AP; %NULL if not AP)
|
|
|
|
*/
|
|
|
|
const struct wpabuf *assoc_wps_ie;
|
2009-09-06 12:58:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* new_ap_settings - New AP settings (%NULL if not used)
|
|
|
|
*
|
|
|
|
* This parameter provides new AP settings when using a wireless
|
|
|
|
* stations as a Registrar to configure the AP. %NULL means that AP
|
|
|
|
* will not be reconfigured, i.e., the station will only learn the
|
|
|
|
* current AP settings by using AP PIN.
|
|
|
|
*/
|
|
|
|
const struct wps_credential *new_ap_settings;
|
2009-09-07 21:09:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* peer_addr: MAC address of the peer in AP; %NULL if not AP
|
|
|
|
*/
|
|
|
|
const u8 *peer_addr;
|
2009-12-21 11:46:19 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* use_psk_key - Use PSK format key in Credential
|
|
|
|
*
|
|
|
|
* Force PSK format to be used instead of ASCII passphrase when
|
|
|
|
* building Credential for an Enrollee. The PSK value is set in
|
|
|
|
* struct wpa_context::psk.
|
|
|
|
*/
|
|
|
|
int use_psk_key;
|
2010-06-27 07:49:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* dev_pw_id - Device Password ID for Enrollee when PIN is used
|
|
|
|
*/
|
|
|
|
u16 dev_pw_id;
|
2011-02-07 17:28:36 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* p2p_dev_addr - P2P Device Address from (Re)Association Request
|
|
|
|
*
|
|
|
|
* On AP/GO, this is set to the P2P Device Address of the associating
|
|
|
|
* P2P client if a P2P IE is included in the (Re)Association Request
|
|
|
|
* frame and the P2P Device Address is included. Otherwise, this is set
|
|
|
|
* to %NULL to indicate the station does not have a P2P Device Address.
|
|
|
|
*/
|
|
|
|
const u8 *p2p_dev_addr;
|
2011-05-17 18:53:02 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pbc_in_m1 - Do not remove PushButton config method in M1 (AP)
|
|
|
|
*
|
|
|
|
* This can be used to enable a workaround to allow Windows 7 to use
|
|
|
|
* PBC with the AP.
|
|
|
|
*/
|
|
|
|
int pbc_in_m1;
|
2013-02-15 20:29:22 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* peer_pubkey_hash - Peer public key hash or %NULL if not known
|
|
|
|
*/
|
|
|
|
const u8 *peer_pubkey_hash;
|
2008-11-23 18:34:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wps_data * wps_init(const struct wps_config *cfg);
|
|
|
|
|
|
|
|
void wps_deinit(struct wps_data *data);
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* enum wps_process_res - WPS message processing result
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
enum wps_process_res {
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* WPS_DONE - Processing done
|
|
|
|
*/
|
|
|
|
WPS_DONE,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_CONTINUE - Processing continues
|
|
|
|
*/
|
|
|
|
WPS_CONTINUE,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_FAILURE - Processing failed
|
|
|
|
*/
|
2009-01-29 17:47:02 +01:00
|
|
|
WPS_FAILURE,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_PENDING - Processing continues, but waiting for an external
|
|
|
|
* event (e.g., UPnP message from an external Registrar)
|
|
|
|
*/
|
|
|
|
WPS_PENDING
|
2008-11-23 18:34:26 +01:00
|
|
|
};
|
2009-01-03 18:50:49 +01:00
|
|
|
enum wps_process_res wps_process_msg(struct wps_data *wps,
|
|
|
|
enum wsc_op_code op_code,
|
2008-11-23 18:34:26 +01:00
|
|
|
const struct wpabuf *msg);
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code);
|
2008-11-23 18:34:26 +01:00
|
|
|
|
2008-11-29 21:06:34 +01:00
|
|
|
int wps_is_selected_pbc_registrar(const struct wpabuf *msg);
|
|
|
|
int wps_is_selected_pin_registrar(const struct wpabuf *msg);
|
2010-06-11 22:50:13 +02:00
|
|
|
int wps_ap_priority_compar(const struct wpabuf *wps_a,
|
|
|
|
const struct wpabuf *wps_b);
|
2009-12-12 15:40:10 +01:00
|
|
|
int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
|
|
|
|
int ver1_compat);
|
2008-11-29 21:06:34 +01:00
|
|
|
const u8 * wps_get_uuid_e(const struct wpabuf *msg);
|
2011-08-28 18:16:59 +02:00
|
|
|
int wps_is_20(const struct wpabuf *msg);
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type);
|
2010-05-26 17:46:08 +02:00
|
|
|
struct wpabuf * wps_build_assoc_resp_ie(void);
|
2012-02-27 22:14:35 +01:00
|
|
|
struct wpabuf * wps_build_probe_req_ie(u16 pw_id, struct wps_device_data *dev,
|
2009-01-03 18:50:49 +01:00
|
|
|
const u8 *uuid,
|
2011-03-19 11:57:46 +01:00
|
|
|
enum wps_request_type req_type,
|
|
|
|
unsigned int num_req_dev_types,
|
|
|
|
const u8 *req_dev_types);
|
2008-11-23 18:34:26 +01:00
|
|
|
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* struct wps_registrar_config - WPS Registrar configuration
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_registrar_config {
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* new_psk_cb - Callback for new PSK
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @mac_addr: MAC address of the Enrollee
|
2013-09-01 09:47:34 +02:00
|
|
|
* @p2p_dev_addr: P2P Device Address of the Enrollee or all zeros if not
|
2009-01-03 18:50:49 +01:00
|
|
|
* @psk: The new PSK
|
|
|
|
* @psk_len: The length of psk in octets
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This callback is called when a new per-device PSK is provisioned.
|
|
|
|
*/
|
2013-09-01 09:47:34 +02:00
|
|
|
int (*new_psk_cb)(void *ctx, const u8 *mac_addr, const u8 *p2p_dev_addr,
|
|
|
|
const u8 *psk, size_t psk_len);
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* set_ie_cb - Callback for WPS IE changes
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @beacon_ie: WPS IE for Beacon
|
|
|
|
* @probe_resp_ie: WPS IE for Probe Response
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This callback is called whenever the WPS IE in Beacon or Probe
|
2009-12-24 18:46:06 +01:00
|
|
|
* Response frames needs to be changed (AP only). Callee is responsible
|
|
|
|
* for freeing the buffers.
|
2009-01-03 18:50:49 +01:00
|
|
|
*/
|
2009-12-24 18:46:06 +01:00
|
|
|
int (*set_ie_cb)(void *ctx, struct wpabuf *beacon_ie,
|
|
|
|
struct wpabuf *probe_resp_ie);
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pin_needed_cb - Callback for requesting a PIN
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @uuid_e: UUID-E of the unknown Enrollee
|
|
|
|
* @dev: Device Data from the unknown Enrollee
|
|
|
|
*
|
|
|
|
* This callback is called whenever an unknown Enrollee requests to use
|
|
|
|
* PIN method and a matching PIN (Device Password) is not found in
|
|
|
|
* Registrar data.
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
void (*pin_needed_cb)(void *ctx, const u8 *uuid_e,
|
|
|
|
const struct wps_device_data *dev);
|
2009-01-03 18:50:49 +01:00
|
|
|
|
2009-01-21 12:48:10 +01:00
|
|
|
/**
|
|
|
|
* reg_success_cb - Callback for reporting successful registration
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @mac_addr: MAC address of the Enrollee
|
|
|
|
* @uuid_e: UUID-E of the Enrollee
|
2012-02-29 19:42:48 +01:00
|
|
|
* @dev_pw: Device Password (PIN) used during registration
|
|
|
|
* @dev_pw_len: Length of dev_pw in octets
|
2009-01-21 12:48:10 +01:00
|
|
|
*
|
|
|
|
* This callback is called whenever an Enrollee completes registration
|
|
|
|
* successfully.
|
|
|
|
*/
|
|
|
|
void (*reg_success_cb)(void *ctx, const u8 *mac_addr,
|
2012-02-29 19:42:48 +01:00
|
|
|
const u8 *uuid_e, const u8 *dev_pw,
|
|
|
|
size_t dev_pw_len);
|
2009-01-21 12:48:10 +01:00
|
|
|
|
2009-11-13 21:07:11 +01:00
|
|
|
/**
|
|
|
|
* set_sel_reg_cb - Callback for reporting selected registrar changes
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @sel_reg: Whether the Registrar is selected
|
|
|
|
* @dev_passwd_id: Device Password ID to indicate with method or
|
|
|
|
* specific password the Registrar intends to use
|
|
|
|
* @sel_reg_config_methods: Bit field of active config methods
|
|
|
|
*
|
|
|
|
* This callback is called whenever the Selected Registrar state
|
|
|
|
* changes (e.g., a new PIN becomes available or PBC is invoked). This
|
|
|
|
* callback is only used by External Registrar implementation;
|
|
|
|
* set_ie_cb() is used by AP implementation in similar caes, but it
|
|
|
|
* provides the full WPS IE data instead of just the minimal Registrar
|
|
|
|
* state information.
|
|
|
|
*/
|
|
|
|
void (*set_sel_reg_cb)(void *ctx, int sel_reg, u16 dev_passwd_id,
|
|
|
|
u16 sel_reg_config_methods);
|
|
|
|
|
2009-12-28 15:24:04 +01:00
|
|
|
/**
|
|
|
|
* enrollee_seen_cb - Callback for reporting Enrollee based on ProbeReq
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @addr: MAC address of the Enrollee
|
|
|
|
* @uuid_e: UUID of the Enrollee
|
|
|
|
* @pri_dev_type: Primary device type
|
|
|
|
* @config_methods: Config Methods
|
|
|
|
* @dev_password_id: Device Password ID
|
|
|
|
* @request_type: Request Type
|
|
|
|
* @dev_name: Device Name (if available)
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* cb_ctx: Higher layer context data for Registrar callbacks
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
void *cb_ctx;
|
2009-01-16 21:50:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* skip_cred_build: Do not build credential
|
|
|
|
*
|
|
|
|
* This option can be used to disable internal code that builds
|
|
|
|
* Credential attribute into M8 based on the current network
|
|
|
|
* configuration and Enrollee capabilities. The extra_cred data will
|
|
|
|
* then be used as the Credential(s).
|
|
|
|
*/
|
|
|
|
int skip_cred_build;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* extra_cred: Additional Credential attribute(s)
|
|
|
|
*
|
|
|
|
* This optional data (set to %NULL to disable) can be used to add
|
|
|
|
* Credential attribute(s) for other networks into M8. If
|
|
|
|
* skip_cred_build is set, this will also override the automatically
|
|
|
|
* generated Credential attribute.
|
|
|
|
*/
|
|
|
|
const u8 *extra_cred;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* extra_cred_len: Length of extra_cred in octets
|
|
|
|
*/
|
|
|
|
size_t extra_cred_len;
|
2009-01-21 12:48:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* disable_auto_conf - Disable auto-configuration on first registration
|
|
|
|
*
|
|
|
|
* By default, the AP that is started in not configured state will
|
|
|
|
* generate a random PSK and move to configured state when the first
|
|
|
|
* registration protocol run is completed successfully. This option can
|
|
|
|
* be used to disable this functionality and leave it up to an external
|
|
|
|
* program to take care of configuration. This requires the extra_cred
|
|
|
|
* to be set with a suitable Credential and skip_cred_build being used.
|
|
|
|
*/
|
|
|
|
int disable_auto_conf;
|
2009-03-08 18:36:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* static_wep_only - Whether the BSS supports only static WEP
|
|
|
|
*/
|
|
|
|
int static_wep_only;
|
2010-09-21 00:32:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* dualband - Whether this is a concurrent dualband AP
|
|
|
|
*/
|
|
|
|
int dualband;
|
2013-09-01 09:08:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* force_per_enrollee_psk - Force per-Enrollee random PSK
|
|
|
|
*
|
|
|
|
* This forces per-Enrollee random PSK to be generated even if a default
|
|
|
|
* PSK is set for a network.
|
|
|
|
*/
|
|
|
|
int force_per_enrollee_psk;
|
2008-11-23 18:34:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* enum wps_event - WPS event types
|
|
|
|
*/
|
2008-12-18 20:58:42 +01:00
|
|
|
enum wps_event {
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* WPS_EV_M2D - M2D received (Registrar did not know us)
|
|
|
|
*/
|
2008-12-19 21:19:41 +01:00
|
|
|
WPS_EV_M2D,
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_FAIL - Registration failed
|
|
|
|
*/
|
2008-12-19 21:34:18 +01:00
|
|
|
WPS_EV_FAIL,
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_SUCCESS - Registration succeeded
|
|
|
|
*/
|
2009-01-23 20:57:43 +01:00
|
|
|
WPS_EV_SUCCESS,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_PWD_AUTH_FAIL - Password authentication failed
|
|
|
|
*/
|
2009-11-01 20:26:13 +01:00
|
|
|
WPS_EV_PWD_AUTH_FAIL,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_PBC_OVERLAP - PBC session overlap detected
|
|
|
|
*/
|
|
|
|
WPS_EV_PBC_OVERLAP,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_PBC_TIMEOUT - PBC walktime expired before protocol run start
|
|
|
|
*/
|
2009-11-15 11:07:27 +01:00
|
|
|
WPS_EV_PBC_TIMEOUT,
|
|
|
|
|
2013-08-23 15:01:30 +02:00
|
|
|
/**
|
|
|
|
* WPS_EV_PBC_ACTIVE - PBC mode was activated
|
|
|
|
*/
|
|
|
|
WPS_EV_PBC_ACTIVE,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_PBC_DISABLE - PBC mode was disabled
|
|
|
|
*/
|
|
|
|
WPS_EV_PBC_DISABLE,
|
|
|
|
|
2009-11-15 11:07:27 +01:00
|
|
|
/**
|
|
|
|
* WPS_EV_ER_AP_ADD - ER: AP added
|
|
|
|
*/
|
|
|
|
WPS_EV_ER_AP_ADD,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_ER_AP_REMOVE - ER: AP removed
|
|
|
|
*/
|
|
|
|
WPS_EV_ER_AP_REMOVE,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_ER_ENROLLEE_ADD - ER: Enrollee added
|
|
|
|
*/
|
|
|
|
WPS_EV_ER_ENROLLEE_ADD,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_ER_ENROLLEE_REMOVE - ER: Enrollee removed
|
|
|
|
*/
|
2010-05-27 14:24:45 +02:00
|
|
|
WPS_EV_ER_ENROLLEE_REMOVE,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_ER_AP_SETTINGS - ER: AP Settings learned
|
|
|
|
*/
|
2010-10-25 20:29:22 +02:00
|
|
|
WPS_EV_ER_AP_SETTINGS,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_ER_SET_SELECTED_REGISTRAR - ER: SetSelectedRegistrar event
|
|
|
|
*/
|
2012-01-30 16:31:06 +01:00
|
|
|
WPS_EV_ER_SET_SELECTED_REGISTRAR,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WPS_EV_AP_PIN_SUCCESS - External Registrar used correct AP PIN
|
|
|
|
*/
|
|
|
|
WPS_EV_AP_PIN_SUCCESS
|
2008-12-18 20:58:42 +01:00
|
|
|
};
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* union wps_event_data - WPS event data
|
|
|
|
*/
|
2008-12-18 20:58:42 +01:00
|
|
|
union wps_event_data {
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* struct wps_event_m2d - M2D event data
|
|
|
|
*/
|
2008-12-18 20:58:42 +01:00
|
|
|
struct wps_event_m2d {
|
|
|
|
u16 config_methods;
|
|
|
|
const u8 *manufacturer;
|
|
|
|
size_t manufacturer_len;
|
|
|
|
const u8 *model_name;
|
|
|
|
size_t model_name_len;
|
|
|
|
const u8 *model_number;
|
|
|
|
size_t model_number_len;
|
|
|
|
const u8 *serial_number;
|
|
|
|
size_t serial_number_len;
|
|
|
|
const u8 *dev_name;
|
|
|
|
size_t dev_name_len;
|
|
|
|
const u8 *primary_dev_type; /* 8 octets */
|
|
|
|
u16 config_error;
|
|
|
|
u16 dev_password_id;
|
|
|
|
} m2d;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct wps_event_fail - Registration failure information
|
|
|
|
* @msg: enum wps_msg_type
|
|
|
|
*/
|
2008-12-19 21:19:41 +01:00
|
|
|
struct wps_event_fail {
|
2009-01-03 18:50:49 +01:00
|
|
|
int msg;
|
2010-10-14 19:49:54 +02:00
|
|
|
u16 config_error;
|
2011-01-13 16:50:59 +01:00
|
|
|
u16 error_indication;
|
2013-08-23 15:01:55 +02:00
|
|
|
u8 peer_macaddr[ETH_ALEN];
|
2008-12-19 21:19:41 +01:00
|
|
|
} fail;
|
2009-01-23 20:57:43 +01:00
|
|
|
|
2013-08-23 15:01:55 +02:00
|
|
|
struct wps_event_success {
|
|
|
|
u8 peer_macaddr[ETH_ALEN];
|
|
|
|
} success;
|
|
|
|
|
2009-01-23 20:57:43 +01:00
|
|
|
struct wps_event_pwd_auth_fail {
|
|
|
|
int enrollee;
|
|
|
|
int part;
|
2013-08-23 15:01:55 +02:00
|
|
|
u8 peer_macaddr[ETH_ALEN];
|
2009-01-23 20:57:43 +01:00
|
|
|
} pwd_auth_fail;
|
2009-11-15 11:07:27 +01:00
|
|
|
|
|
|
|
struct wps_event_er_ap {
|
|
|
|
const u8 *uuid;
|
2009-11-21 12:34:23 +01:00
|
|
|
const u8 *mac_addr;
|
2009-11-15 11:07:27 +01:00
|
|
|
const char *friendly_name;
|
|
|
|
const char *manufacturer;
|
|
|
|
const char *manufacturer_url;
|
|
|
|
const char *model_description;
|
|
|
|
const char *model_name;
|
|
|
|
const char *model_number;
|
|
|
|
const char *model_url;
|
|
|
|
const char *serial_number;
|
|
|
|
const char *upc;
|
2009-11-21 12:34:23 +01:00
|
|
|
const u8 *pri_dev_type;
|
|
|
|
u8 wps_state;
|
2009-11-15 11:07:27 +01:00
|
|
|
} ap;
|
|
|
|
|
|
|
|
struct wps_event_er_enrollee {
|
|
|
|
const u8 *uuid;
|
|
|
|
const u8 *mac_addr;
|
|
|
|
int m1_received;
|
|
|
|
u16 config_methods;
|
|
|
|
u16 dev_passwd_id;
|
|
|
|
const u8 *pri_dev_type;
|
|
|
|
const char *dev_name;
|
|
|
|
const char *manufacturer;
|
|
|
|
const char *model_name;
|
|
|
|
const char *model_number;
|
|
|
|
const char *serial_number;
|
|
|
|
} enrollee;
|
2010-05-27 14:24:45 +02:00
|
|
|
|
|
|
|
struct wps_event_er_ap_settings {
|
|
|
|
const u8 *uuid;
|
|
|
|
const struct wps_credential *cred;
|
|
|
|
} ap_settings;
|
2010-10-25 20:29:22 +02:00
|
|
|
|
|
|
|
struct wps_event_er_set_selected_registrar {
|
|
|
|
const u8 *uuid;
|
|
|
|
int sel_reg;
|
|
|
|
u16 dev_passwd_id;
|
|
|
|
u16 sel_reg_config_methods;
|
|
|
|
enum {
|
|
|
|
WPS_ER_SET_SEL_REG_START,
|
|
|
|
WPS_ER_SET_SEL_REG_DONE,
|
|
|
|
WPS_ER_SET_SEL_REG_FAILED
|
|
|
|
} state;
|
|
|
|
} set_sel_reg;
|
2008-12-18 20:58:42 +01:00
|
|
|
};
|
|
|
|
|
2009-02-06 20:39:32 +01:00
|
|
|
/**
|
|
|
|
* struct upnp_pending_message - Pending PutWLANResponse messages
|
|
|
|
* @next: Pointer to next pending message or %NULL
|
|
|
|
* @addr: NewWLANEventMAC
|
|
|
|
* @msg: NewMessage
|
|
|
|
* @type: Message Type
|
|
|
|
*/
|
|
|
|
struct upnp_pending_message {
|
|
|
|
struct upnp_pending_message *next;
|
|
|
|
u8 addr[ETH_ALEN];
|
|
|
|
struct wpabuf *msg;
|
|
|
|
enum wps_msg_type type;
|
|
|
|
};
|
|
|
|
|
2008-11-28 19:50:08 +01:00
|
|
|
/**
|
|
|
|
* struct wps_context - Long term WPS context data
|
|
|
|
*
|
|
|
|
* This data is stored at the higher layer Authenticator or Supplicant data
|
|
|
|
* structures and it is maintained over multiple registration protocol runs.
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_context {
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* ap - Whether the local end is an access point
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
int ap;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* registrar - Pointer to WPS registrar data from wps_registrar_init()
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_registrar *registrar;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wps_state - Current WPS state
|
|
|
|
*/
|
|
|
|
enum wps_state wps_state;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ap_setup_locked - Whether AP setup is locked (only used at AP)
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
int ap_setup_locked;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* uuid - Own UUID
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
u8 uuid[16];
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ssid - SSID
|
|
|
|
*
|
|
|
|
* This SSID is used by the Registrar to fill in information for
|
|
|
|
* Credentials. In addition, AP uses it when acting as an Enrollee to
|
|
|
|
* notify Registrar of the current configuration.
|
|
|
|
*/
|
2015-04-07 11:00:13 +02:00
|
|
|
u8 ssid[SSID_MAX_LEN];
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ssid_len - Length of ssid in octets
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
size_t ssid_len;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* dev - Own WPS device data
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_device_data dev;
|
2009-01-03 18:50:49 +01:00
|
|
|
|
2009-10-11 18:17:22 +02:00
|
|
|
/**
|
|
|
|
* dh_ctx - Context data for Diffie-Hellman operation
|
|
|
|
*/
|
|
|
|
void *dh_ctx;
|
|
|
|
|
2009-02-26 20:57:38 +01:00
|
|
|
/**
|
|
|
|
* dh_privkey - Diffie-Hellman private key
|
|
|
|
*/
|
|
|
|
struct wpabuf *dh_privkey;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* dh_pubkey_oob - Diffie-Hellman public key
|
|
|
|
*/
|
|
|
|
struct wpabuf *dh_pubkey;
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* config_methods - Enabled configuration methods
|
|
|
|
*
|
|
|
|
* Bit field of WPS_CONFIG_*
|
|
|
|
*/
|
|
|
|
u16 config_methods;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* encr_types - Enabled encryption types (bit field of WPS_ENCR_*)
|
|
|
|
*/
|
|
|
|
u16 encr_types;
|
|
|
|
|
2016-01-01 10:59:20 +01:00
|
|
|
/**
|
|
|
|
* encr_types_rsn - Enabled encryption types for RSN (WPS_ENCR_*)
|
|
|
|
*/
|
|
|
|
u16 encr_types_rsn;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* encr_types_wpa - Enabled encryption types for WPA (WPS_ENCR_*)
|
|
|
|
*/
|
|
|
|
u16 encr_types_wpa;
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* auth_types - Authentication types (bit field of WPS_AUTH_*)
|
|
|
|
*/
|
|
|
|
u16 auth_types;
|
|
|
|
|
2014-01-16 16:35:45 +01:00
|
|
|
/**
|
|
|
|
* encr_types - Current AP encryption type (WPS_ENCR_*)
|
|
|
|
*/
|
|
|
|
u16 ap_encr_type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ap_auth_type - Current AP authentication types (WPS_AUTH_*)
|
|
|
|
*/
|
|
|
|
u16 ap_auth_type;
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* network_key - The current Network Key (PSK) or %NULL to generate new
|
|
|
|
*
|
|
|
|
* If %NULL, Registrar will generate per-device PSK. In addition, AP
|
|
|
|
* uses this when acting as an Enrollee to notify Registrar of the
|
|
|
|
* current configuration.
|
2009-12-21 11:46:19 +01:00
|
|
|
*
|
|
|
|
* When using WPA/WPA2-Person, this key can be either the ASCII
|
|
|
|
* passphrase (8..63 characters) or the 32-octet PSK (64 hex
|
|
|
|
* characters). When this is set to the ASCII passphrase, the PSK can
|
|
|
|
* be provided in the psk buffer and used per-Enrollee to control which
|
|
|
|
* key type is included in the Credential (e.g., to reduce calculation
|
|
|
|
* need on low-powered devices by provisioning PSK while still allowing
|
|
|
|
* other devices to get the passphrase).
|
2009-01-03 18:50:49 +01:00
|
|
|
*/
|
|
|
|
u8 *network_key;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* network_key_len - Length of network_key in octets
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
size_t network_key_len;
|
|
|
|
|
2009-12-21 11:46:19 +01:00
|
|
|
/**
|
|
|
|
* psk - The current network PSK
|
|
|
|
*
|
|
|
|
* This optional value can be used to provide the current PSK if
|
|
|
|
* network_key is set to the ASCII passphrase.
|
|
|
|
*/
|
|
|
|
u8 psk[32];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* psk_set - Whether psk value is set
|
|
|
|
*/
|
|
|
|
int psk_set;
|
|
|
|
|
2009-01-23 20:08:55 +01:00
|
|
|
/**
|
|
|
|
* ap_settings - AP Settings override for M7 (only used at AP)
|
|
|
|
*
|
|
|
|
* If %NULL, AP Settings attributes will be generated based on the
|
|
|
|
* current network configuration.
|
|
|
|
*/
|
|
|
|
u8 *ap_settings;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ap_settings_len - Length of ap_settings in octets
|
|
|
|
*/
|
|
|
|
size_t ap_settings_len;
|
|
|
|
|
2009-01-29 17:47:02 +01:00
|
|
|
/**
|
|
|
|
* friendly_name - Friendly Name (required for UPnP)
|
|
|
|
*/
|
|
|
|
char *friendly_name;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* manufacturer_url - Manufacturer URL (optional for UPnP)
|
|
|
|
*/
|
|
|
|
char *manufacturer_url;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* model_description - Model Description (recommended for UPnP)
|
|
|
|
*/
|
|
|
|
char *model_description;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* model_url - Model URL (optional for UPnP)
|
|
|
|
*/
|
|
|
|
char *model_url;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* upc - Universal Product Code (optional for UPnP)
|
|
|
|
*/
|
|
|
|
char *upc;
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* cred_cb - Callback to notify that new Credentials were received
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @cred: The received Credential
|
|
|
|
* Return: 0 on success, -1 on failure
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
int (*cred_cb)(void *ctx, const struct wps_credential *cred);
|
2009-01-03 18:50:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* event_cb - Event callback (state information about progress)
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* @event: Event type
|
|
|
|
* @data: Event data
|
|
|
|
*/
|
2008-12-18 20:58:42 +01:00
|
|
|
void (*event_cb)(void *ctx, enum wps_event event,
|
|
|
|
union wps_event_data *data);
|
2009-01-03 18:50:49 +01:00
|
|
|
|
2013-08-25 09:55:53 +02:00
|
|
|
/**
|
|
|
|
* rf_band_cb - Fetch currently used RF band
|
|
|
|
* @ctx: Higher layer context data (cb_ctx)
|
|
|
|
* Return: Current used RF band or 0 if not known
|
|
|
|
*/
|
|
|
|
int (*rf_band_cb)(void *ctx);
|
|
|
|
|
2009-01-03 18:50:49 +01:00
|
|
|
/**
|
|
|
|
* cb_ctx: Higher layer context data for callbacks
|
|
|
|
*/
|
2008-11-23 18:34:26 +01:00
|
|
|
void *cb_ctx;
|
2009-01-29 17:47:02 +01:00
|
|
|
|
|
|
|
struct upnp_wps_device_sm *wps_upnp;
|
|
|
|
|
2009-02-06 20:39:32 +01:00
|
|
|
/* Pending messages from UPnP PutWLANResponse */
|
|
|
|
struct upnp_pending_message *upnp_msgs;
|
2012-06-28 18:43:29 +02:00
|
|
|
|
|
|
|
u16 ap_nfc_dev_pw_id;
|
|
|
|
struct wpabuf *ap_nfc_dh_pubkey;
|
|
|
|
struct wpabuf *ap_nfc_dh_privkey;
|
|
|
|
struct wpabuf *ap_nfc_dev_pw;
|
2008-11-23 18:34:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wps_registrar *
|
|
|
|
wps_registrar_init(struct wps_context *wps,
|
|
|
|
const struct wps_registrar_config *cfg);
|
|
|
|
void wps_registrar_deinit(struct wps_registrar *reg);
|
2009-12-12 15:40:10 +01:00
|
|
|
int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr,
|
|
|
|
const u8 *uuid, const u8 *pin, size_t pin_len,
|
|
|
|
int timeout);
|
2008-11-23 18:34:26 +01:00
|
|
|
int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid);
|
2010-09-06 19:51:06 +02:00
|
|
|
int wps_registrar_wps_cancel(struct wps_registrar *reg);
|
2008-11-23 18:34:26 +01:00
|
|
|
int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
|
2011-02-07 17:28:36 +01:00
|
|
|
int wps_registrar_button_pushed(struct wps_registrar *reg,
|
|
|
|
const u8 *p2p_dev_addr);
|
2012-02-29 19:42:48 +01:00
|
|
|
void wps_registrar_complete(struct wps_registrar *registrar, const u8 *uuid_e,
|
|
|
|
const u8 *dev_pw, size_t dev_pw_len);
|
2008-11-23 18:34:26 +01:00
|
|
|
void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
|
2010-07-18 23:30:24 +02:00
|
|
|
const struct wpabuf *wps_data,
|
|
|
|
int p2p_wildcard);
|
2009-01-23 20:57:43 +01:00
|
|
|
int wps_registrar_update_ie(struct wps_registrar *reg);
|
2009-09-07 21:09:13 +02:00
|
|
|
int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr,
|
|
|
|
char *buf, size_t buflen);
|
2010-10-21 15:49:41 +02:00
|
|
|
int wps_registrar_config_ap(struct wps_registrar *reg,
|
|
|
|
struct wps_credential *cred);
|
2012-06-27 21:15:55 +02:00
|
|
|
int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg,
|
|
|
|
const u8 *pubkey_hash, u16 pw_id,
|
2013-02-24 16:30:18 +01:00
|
|
|
const u8 *dev_pw, size_t dev_pw_len,
|
|
|
|
int pk_hash_provided_oob);
|
2012-06-27 19:54:56 +02:00
|
|
|
int wps_registrar_add_nfc_password_token(struct wps_registrar *reg,
|
|
|
|
const u8 *oob_dev_pw,
|
|
|
|
size_t oob_dev_pw_len);
|
2014-12-21 16:32:35 +01:00
|
|
|
void wps_registrar_flush(struct wps_registrar *reg);
|
2008-11-23 18:34:26 +01:00
|
|
|
|
2011-09-30 21:26:37 +02:00
|
|
|
int wps_build_credential_wrap(struct wpabuf *msg,
|
|
|
|
const struct wps_credential *cred);
|
|
|
|
|
2008-11-29 13:02:09 +01:00
|
|
|
unsigned int wps_pin_checksum(unsigned int pin);
|
|
|
|
unsigned int wps_pin_valid(unsigned int pin);
|
|
|
|
unsigned int wps_generate_pin(void);
|
2012-06-30 20:27:32 +02:00
|
|
|
int wps_pin_str_valid(const char *pin);
|
2009-02-06 20:39:32 +01:00
|
|
|
void wps_free_pending_msgs(struct upnp_pending_message *msgs);
|
2008-11-29 13:02:09 +01:00
|
|
|
|
2013-11-28 11:31:32 +01:00
|
|
|
struct wpabuf * wps_get_oob_cred(struct wps_context *wps, int rf_band,
|
|
|
|
int channel);
|
2012-06-28 12:59:29 +02:00
|
|
|
int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr);
|
2009-09-11 16:14:49 +02:00
|
|
|
int wps_attr_text(struct wpabuf *data, char *buf, char *end);
|
2013-07-31 16:30:45 +02:00
|
|
|
const char * wps_ei_str(enum wps_error_indication ei);
|
2009-02-26 20:57:38 +01:00
|
|
|
|
2010-05-27 14:23:55 +02:00
|
|
|
struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname,
|
|
|
|
const char *filter);
|
2009-11-20 20:57:30 +01:00
|
|
|
void wps_er_refresh(struct wps_er *er);
|
2009-12-19 22:47:54 +01:00
|
|
|
void wps_er_deinit(struct wps_er *er, void (*cb)(void *ctx), void *ctx);
|
2009-11-13 21:07:11 +01:00
|
|
|
void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
|
|
|
|
u16 sel_reg_config_methods);
|
2013-04-01 19:52:44 +02:00
|
|
|
int wps_er_pbc(struct wps_er *er, const u8 *uuid, const u8 *addr);
|
|
|
|
const u8 * wps_er_get_sta_uuid(struct wps_er *er, const u8 *addr);
|
2013-04-01 19:32:09 +02:00
|
|
|
int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *addr,
|
|
|
|
const u8 *pin, size_t pin_len);
|
|
|
|
int wps_er_set_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
|
2010-10-20 12:37:01 +02:00
|
|
|
const struct wps_credential *cred);
|
2013-04-01 19:32:09 +02:00
|
|
|
int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
|
|
|
|
const u8 *pin, size_t pin_len,
|
|
|
|
const struct wps_credential *cred);
|
2013-04-01 20:28:57 +02:00
|
|
|
struct wpabuf * wps_er_config_token_from_cred(struct wps_context *wps,
|
|
|
|
struct wps_credential *cred);
|
2013-04-01 19:32:09 +02:00
|
|
|
struct wpabuf * wps_er_nfc_config_token(struct wps_er *er, const u8 *uuid,
|
|
|
|
const u8 *addr);
|
2013-04-12 06:37:41 +02:00
|
|
|
struct wpabuf * wps_er_nfc_handover_sel(struct wps_er *er,
|
|
|
|
struct wps_context *wps, const u8 *uuid,
|
|
|
|
const u8 *addr, struct wpabuf *pubkey);
|
2009-11-07 11:41:01 +01:00
|
|
|
|
2009-11-26 10:39:29 +01:00
|
|
|
int wps_dev_type_str2bin(const char *str, u8 dev_type[WPS_DEV_TYPE_LEN]);
|
|
|
|
char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf,
|
|
|
|
size_t buf_len);
|
2009-11-29 12:15:32 +01:00
|
|
|
void uuid_gen_mac_addr(const u8 *mac_addr, u8 *uuid);
|
2009-12-21 14:59:25 +01:00
|
|
|
u16 wps_config_methods_str2bin(const char *str);
|
2012-06-27 17:56:41 +02:00
|
|
|
struct wpabuf * wps_build_nfc_pw_token(u16 dev_pw_id,
|
|
|
|
const struct wpabuf *pubkey,
|
|
|
|
const struct wpabuf *dev_pw);
|
2013-02-15 10:24:29 +01:00
|
|
|
struct wpabuf * wps_nfc_token_build(int ndef, int id, struct wpabuf *pubkey,
|
|
|
|
struct wpabuf *dev_pw);
|
2013-04-30 17:17:23 +02:00
|
|
|
int wps_nfc_gen_dh(struct wpabuf **pubkey, struct wpabuf **privkey);
|
2012-06-28 19:54:53 +02:00
|
|
|
struct wpabuf * wps_nfc_token_gen(int ndef, int *id, struct wpabuf **pubkey,
|
|
|
|
struct wpabuf **privkey,
|
|
|
|
struct wpabuf **dev_pw);
|
2013-04-02 17:30:58 +02:00
|
|
|
struct wpabuf * wps_build_nfc_handover_req(struct wps_context *ctx,
|
|
|
|
struct wpabuf *nfc_dh_pubkey);
|
|
|
|
struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
|
2013-04-27 19:31:28 +02:00
|
|
|
struct wpabuf *nfc_dh_pubkey,
|
|
|
|
const u8 *bssid, int freq);
|
2013-02-15 16:07:28 +01:00
|
|
|
struct wpabuf * wps_build_nfc_handover_req_p2p(struct wps_context *ctx,
|
|
|
|
struct wpabuf *nfc_dh_pubkey);
|
|
|
|
struct wpabuf * wps_build_nfc_handover_sel_p2p(struct wps_context *ctx,
|
|
|
|
int nfc_dev_pw_id,
|
|
|
|
struct wpabuf *nfc_dh_pubkey,
|
|
|
|
struct wpabuf *nfc_dev_pw);
|
2009-11-26 10:39:29 +01:00
|
|
|
|
2012-06-27 17:16:47 +02:00
|
|
|
/* ndef.c */
|
2012-06-27 18:51:11 +02:00
|
|
|
struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf);
|
|
|
|
struct wpabuf * ndef_build_wifi(const struct wpabuf *buf);
|
2013-04-27 16:55:20 +02:00
|
|
|
struct wpabuf * ndef_parse_p2p(const struct wpabuf *buf);
|
|
|
|
struct wpabuf * ndef_build_p2p(const struct wpabuf *buf);
|
2012-06-27 17:16:47 +02:00
|
|
|
|
2010-05-26 16:16:14 +02:00
|
|
|
#ifdef CONFIG_WPS_STRICT
|
|
|
|
int wps_validate_beacon(const struct wpabuf *wps_ie);
|
2010-09-20 23:54:22 +02:00
|
|
|
int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, int probe,
|
|
|
|
const u8 *addr);
|
2010-09-22 19:07:20 +02:00
|
|
|
int wps_validate_probe_req(const struct wpabuf *wps_ie, const u8 *addr);
|
2010-05-26 16:16:14 +02:00
|
|
|
int wps_validate_assoc_req(const struct wpabuf *wps_ie);
|
|
|
|
int wps_validate_assoc_resp(const struct wpabuf *wps_ie);
|
|
|
|
int wps_validate_m1(const struct wpabuf *tlvs);
|
|
|
|
int wps_validate_m2(const struct wpabuf *tlvs);
|
|
|
|
int wps_validate_m2d(const struct wpabuf *tlvs);
|
|
|
|
int wps_validate_m3(const struct wpabuf *tlvs);
|
|
|
|
int wps_validate_m4(const struct wpabuf *tlvs);
|
2010-09-23 04:17:13 +02:00
|
|
|
int wps_validate_m4_encr(const struct wpabuf *tlvs, int wps2);
|
2010-05-26 16:16:14 +02:00
|
|
|
int wps_validate_m5(const struct wpabuf *tlvs);
|
2010-09-23 04:17:13 +02:00
|
|
|
int wps_validate_m5_encr(const struct wpabuf *tlvs, int wps2);
|
2010-05-26 16:16:14 +02:00
|
|
|
int wps_validate_m6(const struct wpabuf *tlvs);
|
2010-09-23 04:17:13 +02:00
|
|
|
int wps_validate_m6_encr(const struct wpabuf *tlvs, int wps2);
|
2010-05-26 16:16:14 +02:00
|
|
|
int wps_validate_m7(const struct wpabuf *tlvs);
|
2010-09-23 04:17:13 +02:00
|
|
|
int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap, int wps2);
|
2010-05-26 16:16:14 +02:00
|
|
|
int wps_validate_m8(const struct wpabuf *tlvs);
|
2010-09-23 04:17:13 +02:00
|
|
|
int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap, int wps2);
|
2010-05-26 16:16:14 +02:00
|
|
|
int wps_validate_wsc_ack(const struct wpabuf *tlvs);
|
|
|
|
int wps_validate_wsc_nack(const struct wpabuf *tlvs);
|
|
|
|
int wps_validate_wsc_done(const struct wpabuf *tlvs);
|
2010-07-19 03:54:58 +02:00
|
|
|
int wps_validate_upnp_set_selected_registrar(const struct wpabuf *tlvs);
|
2010-05-26 16:16:14 +02:00
|
|
|
#else /* CONFIG_WPS_STRICT */
|
|
|
|
static inline int wps_validate_beacon(const struct wpabuf *wps_ie){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie,
|
2010-09-20 23:54:22 +02:00
|
|
|
int probe, const u8 *addr)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-22 19:07:20 +02:00
|
|
|
static inline int wps_validate_probe_req(const struct wpabuf *wps_ie,
|
|
|
|
const u8 *addr)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_assoc_req(const struct wpabuf *wps_ie)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_assoc_resp(const struct wpabuf *wps_ie)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m1(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m2(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m2d(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m3(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m4(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-23 04:17:13 +02:00
|
|
|
static inline int wps_validate_m4_encr(const struct wpabuf *tlvs, int wps2)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m5(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-23 04:17:13 +02:00
|
|
|
static inline int wps_validate_m5_encr(const struct wpabuf *tlvs, int wps2)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m6(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-23 04:17:13 +02:00
|
|
|
static inline int wps_validate_m6_encr(const struct wpabuf *tlvs, int wps2)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m7(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-23 04:17:13 +02:00
|
|
|
static inline int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap,
|
|
|
|
int wps2)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_m8(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-23 04:17:13 +02:00
|
|
|
static inline int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap,
|
|
|
|
int wps2)
|
2010-05-26 16:16:14 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_wsc_ack(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_wsc_nack(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wps_validate_wsc_done(const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2010-07-19 03:54:58 +02:00
|
|
|
|
|
|
|
static inline int wps_validate_upnp_set_selected_registrar(
|
|
|
|
const struct wpabuf *tlvs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2010-05-26 16:16:14 +02:00
|
|
|
#endif /* CONFIG_WPS_STRICT */
|
|
|
|
|
2008-11-23 18:34:26 +01:00
|
|
|
#endif /* WPS_H */
|