diff options
author | Jouni Malinen <j@w1.fi> | 2012-06-28 13:59:29 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-06-28 13:59:29 +0300 |
commit | d7645d239de0fbdd88e89b1cd849e993ab4d3464 (patch) | |
tree | 006f2c531c07f1d41cbac07a7bc1a265f631c3b2 /src/wps | |
parent | 3cf7a59d4f4345c24f99e5422a680cec6b9356d0 (diff) | |
download | external_wpa_supplicant_8_ti-d7645d239de0fbdd88e89b1cd849e993ab4d3464.zip external_wpa_supplicant_8_ti-d7645d239de0fbdd88e89b1cd849e993ab4d3464.tar.gz external_wpa_supplicant_8_ti-d7645d239de0fbdd88e89b1cd849e993ab4d3464.tar.bz2 |
WPS: Add support for NFC configuration token from external program
The new wpa_supplicant ctrl_iface command WPS_NFC_TAG_READ can now be
used to process NFC tags read by external programs to initiate
wpa_supplicant to use NFC Configuration Token to create a new network.
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps')
-rw-r--r-- | src/wps/wps.h | 2 | ||||
-rw-r--r-- | src/wps/wps_common.c | 25 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/wps/wps.h b/src/wps/wps.h index ca2f55c..dd84f1b 100644 --- a/src/wps/wps.h +++ b/src/wps/wps.h @@ -27,6 +27,7 @@ enum wsc_op_code { struct wps_registrar; struct upnp_wps_device_sm; struct wps_er; +struct wps_parse_attr; /** * struct wps_credential - WPS Credential @@ -818,6 +819,7 @@ int wps_get_oob_method(char *method); int wps_process_oob(struct wps_context *wps, struct oob_device_data *oob_dev, int registrar); struct wpabuf * wps_get_oob_cred(struct wps_context *wps); +int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr); int wps_attr_text(struct wpabuf *data, char *buf, char *end); struct wps_er * wps_er_init(struct wps_context *wps, const char *ifname, diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c index 35ebec0..16412ca 100644 --- a/src/wps/wps_common.c +++ b/src/wps/wps_common.c @@ -437,23 +437,17 @@ static int wps_parse_oob_dev_pwd(struct wps_context *wps, } -static int wps_parse_oob_cred(struct wps_context *wps, struct wpabuf *data) +int wps_oob_use_cred(struct wps_context *wps, struct wps_parse_attr *attr) { struct wpabuf msg; - struct wps_parse_attr attr; size_t i; - if (wps_parse_msg(data, &attr) < 0 || attr.num_cred <= 0) { - wpa_printf(MSG_ERROR, "WPS: OOB credential not found"); - return -1; - } - - for (i = 0; i < attr.num_cred; i++) { + for (i = 0; i < attr->num_cred; i++) { struct wps_credential local_cred; struct wps_parse_attr cattr; os_memset(&local_cred, 0, sizeof(local_cred)); - wpabuf_set(&msg, attr.cred[i], attr.cred_len[i]); + wpabuf_set(&msg, attr->cred[i], attr->cred_len[i]); if (wps_parse_msg(&msg, &cattr) < 0 || wps_process_cred(&cattr, &local_cred)) { wpa_printf(MSG_ERROR, "WPS: Failed to parse OOB " @@ -467,6 +461,19 @@ static int wps_parse_oob_cred(struct wps_context *wps, struct wpabuf *data) } +static int wps_parse_oob_cred(struct wps_context *wps, struct wpabuf *data) +{ + struct wps_parse_attr attr; + + if (wps_parse_msg(data, &attr) < 0 || attr.num_cred <= 0) { + wpa_printf(MSG_ERROR, "WPS: OOB credential not found"); + return -1; + } + + return wps_oob_use_cred(wps, &attr); +} + + int wps_process_oob(struct wps_context *wps, struct oob_device_data *oob_dev, int registrar) { |