aboutsummaryrefslogtreecommitdiffstats
path: root/src/wps
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-06-27 18:56:41 +0300
committerJouni Malinen <j@w1.fi>2012-06-27 21:22:12 +0300
commit3f2c8ba6d39d5c5184a8fdd121998dd0d7629f1f (patch)
treee63a9ec4c9a7a18b0de561fb48befbc5975e67a1 /src/wps
parent6b5a0c9466e42847d19d812a6f2854c099d78d27 (diff)
downloadexternal_wpa_supplicant_8_ti-3f2c8ba6d39d5c5184a8fdd121998dd0d7629f1f.zip
external_wpa_supplicant_8_ti-3f2c8ba6d39d5c5184a8fdd121998dd0d7629f1f.tar.gz
external_wpa_supplicant_8_ti-3f2c8ba6d39d5c5184a8fdd121998dd0d7629f1f.tar.bz2
WPS: Add new mechanism for NFC config method using password token
Instead of requiring low-level access to an NFC device and synchronous operations, the new WPS_NFC_TOKEN and WPS_NFC ctrl_iface commands can be used to build a NFC password token and initiate WPS protocol run using that token (or pre-configured values) as separate commands. The WPS_NFC_TOKEN output can be written to a NFC tag using an external program, i.e., wpa_supplicant does not need to have low-level code for NFC operations for this. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps')
-rw-r--r--src/wps/wps.h3
-rw-r--r--src/wps/wps_common.c24
2 files changed, 27 insertions, 0 deletions
diff --git a/src/wps/wps.h b/src/wps/wps.h
index b49bb91..48ba76f 100644
--- a/src/wps/wps.h
+++ b/src/wps/wps.h
@@ -832,6 +832,9 @@ char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf,
size_t buf_len);
void uuid_gen_mac_addr(const u8 *mac_addr, u8 *uuid);
u16 wps_config_methods_str2bin(const char *str);
+struct wpabuf * wps_build_nfc_pw_token(u16 dev_pw_id,
+ const struct wpabuf *pubkey,
+ const struct wpabuf *dev_pw);
/* ndef.c */
struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf);
diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c
index c7c0c29..63857e0 100644
--- a/src/wps/wps_common.c
+++ b/src/wps/wps_common.c
@@ -335,6 +335,30 @@ static struct wpabuf * wps_get_oob_cred(struct wps_context *wps)
}
+struct wpabuf * wps_build_nfc_pw_token(u16 dev_pw_id,
+ const struct wpabuf *pubkey,
+ const struct wpabuf *dev_pw)
+{
+ struct wpabuf *data;
+
+ data = wpabuf_alloc(200);
+ if (data == NULL)
+ return NULL;
+
+ if (wps_build_version(data) ||
+ wps_build_oob_dev_pw(data, dev_pw_id, pubkey,
+ wpabuf_head(dev_pw), wpabuf_len(dev_pw)) ||
+ wps_build_wfa_ext(data, 0, NULL, 0)) {
+ wpa_printf(MSG_ERROR, "WPS: Failed to build NFC password "
+ "token");
+ wpabuf_free(data);
+ return NULL;
+ }
+
+ return data;
+}
+
+
static struct wpabuf * wps_get_oob_dev_pwd(struct wps_context *wps)
{
struct wpabuf *data;