aboutsummaryrefslogtreecommitdiffstats
path: root/src/eapol_supp
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-11-23 17:34:26 (GMT)
committerJouni Malinen <j@w1.fi>2008-11-23 17:34:26 (GMT)
commitad08c3633cc2858d28b30a3545341e1e4dda4a90 (patch)
tree90b8f0ed5762d876df61013e851acc539f29f320 /src/eapol_supp
parent6e89cc438e1af4b9b23341faee40bbe271b3de8d (diff)
downloadhostap-ad08c3633cc2858d28b30a3545341e1e4dda4a90.zip
hostap-ad08c3633cc2858d28b30a3545341e1e4dda4a90.tar.gz
hostap-ad08c3633cc2858d28b30a3545341e1e4dda4a90.tar.bz2
Added preliminary Wi-Fi Protected Setup (WPS) implementation
This adds WPS support for both hostapd and wpa_supplicant. Both programs can be configured to act as WPS Enrollee and Registrar. Both PBC and PIN methods are supported. Currently, hostapd has more complete configuration option for WPS parameters and wpa_supplicant configuration style will likely change in the future. External Registrars are not yet supported in hostapd or wpa_supplicant. While wpa_supplicant has initial support for acting as an Registrar to configure an AP, this is still using number of hardcoded parameters which will need to be made configurable for proper operation.
Diffstat (limited to 'src/eapol_supp')
-rw-r--r--src/eapol_supp/eapol_supp_sm.c16
-rw-r--r--src/eapol_supp/eapol_supp_sm.h18
2 files changed, 34 insertions, 0 deletions
diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c
index ea65d27..9af1d6d 100644
--- a/src/eapol_supp/eapol_supp_sm.c
+++ b/src/eapol_supp/eapol_supp_sm.c
@@ -1742,6 +1742,20 @@ static void eapol_sm_notify_pending(void *ctx)
}
+#ifdef CONFIG_WPS
+static int eapol_sm_wps_cred(void *ctx, struct wps_credential *cred)
+{
+ struct eapol_sm *sm = ctx;
+ wpa_printf(MSG_DEBUG, "EAPOL: received new WPS credential");
+ if (sm->ctx->wps_cred)
+ return sm->ctx->wps_cred(sm->ctx->ctx, cred);
+ return 0;
+}
+#else /* CONFIG_WPS */
+#define eapol_sm_wps_cred NULL
+#endif /* CONFIG_WPS */
+
+
#if defined(CONFIG_CTRL_IFACE) || !defined(CONFIG_NO_STDOUT_DEBUG)
static void eapol_sm_eap_param_needed(void *ctx, const char *field,
const char *txt)
@@ -1767,6 +1781,7 @@ static struct eapol_callbacks eapol_cb =
eapol_sm_set_config_blob,
eapol_sm_get_config_blob,
eapol_sm_notify_pending,
+ eapol_sm_wps_cred,
eapol_sm_eap_param_needed
};
@@ -1804,6 +1819,7 @@ struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
conf.pkcs11_engine_path = ctx->pkcs11_engine_path;
conf.pkcs11_module_path = ctx->pkcs11_module_path;
#endif /* EAP_TLS_OPENSSL */
+ conf.mac_addr = ctx->mac_addr;
sm->eap = eap_peer_sm_init(sm, &eapol_cb, sm->ctx->msg_ctx, &conf);
if (sm->eap == NULL) {
diff --git a/src/eapol_supp/eapol_supp_sm.h b/src/eapol_supp/eapol_supp_sm.h
index 719fbd3..f297d23 100644
--- a/src/eapol_supp/eapol_supp_sm.h
+++ b/src/eapol_supp/eapol_supp_sm.h
@@ -63,6 +63,7 @@ struct eapol_config {
struct eapol_sm;
struct wpa_config_blob;
+struct wps_credential;
/**
* struct eapol_ctx - Global (for all networks) EAPOL state machine context
@@ -199,6 +200,23 @@ struct eapol_ctx {
*/
const char *pkcs11_module_path;
#endif /* EAP_TLS_OPENSSL */
+ /**
+ * mac_addr - MAC address of the peer
+ *
+ * This is only used by EAP-WSC and can be left %NULL if not available.
+ */
+ const u8 *mac_addr;
+
+ /**
+ * wps_cred - Notify that new credential was received from WPS
+ * @ctx: Callback context (ctx)
+ * Returns: 0 on success (credential stored), -1 on failure
+ *
+ * This callback is only needed when using WPS Enrollee to configure
+ * new credentials. This can be left %NULL if no WPS functionality is
+ * enabled.
+ */
+ int (*wps_cred)(void *ctx, struct wps_credential *cred);
/**
* eap_param_needed - Notify that EAP parameter is needed