From 3cf7a59d4f4345c24f99e5422a680cec6b9356d0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 28 Jun 2012 13:25:48 +0300 Subject: WPS: Add new mechanism for generation NFC configuration token The new hostapd ctrl_iface command WPS_NFC_CONFIG_TOKEN can now be used to fetch payload for an NFC configuration token so that an external program can be used to write this on an NFC tag. Signed-hostap: Jouni Malinen --- src/ap/wps_hostapd.c | 22 ++++++++++++++++++++++ src/ap/wps_hostapd.h | 2 ++ 2 files changed, 24 insertions(+) (limited to 'src/ap') diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c index e6c158a..b95b617 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c @@ -1584,4 +1584,26 @@ int hostapd_wps_nfc_tag_read(struct hostapd_data *hapd, return ret; } + +struct wpabuf * hostapd_wps_nfc_config_token(struct hostapd_data *hapd, + int ndef) +{ + struct wpabuf *ret; + + if (hapd->wps == NULL) + return NULL; + + ret = wps_get_oob_cred(hapd->wps); + if (ndef && ret) { + struct wpabuf *tmp; + tmp = ndef_build_wifi(ret); + wpabuf_free(ret); + if (tmp == NULL) + return NULL; + ret = tmp; + } + + return ret; +} + #endif /* CONFIG_WPS_NFC */ diff --git a/src/ap/wps_hostapd.h b/src/ap/wps_hostapd.h index 75a3bcb..8256c06 100644 --- a/src/ap/wps_hostapd.h +++ b/src/ap/wps_hostapd.h @@ -35,6 +35,8 @@ int hostapd_wps_config_ap(struct hostapd_data *hapd, const char *ssid, const char *auth, const char *encr, const char *key); int hostapd_wps_nfc_tag_read(struct hostapd_data *hapd, const struct wpabuf *data); +struct wpabuf * hostapd_wps_nfc_config_token(struct hostapd_data *hapd, + int ndef); #else /* CONFIG_WPS */ -- cgit v1.1