aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-11-28 18:32:13 (GMT)
committerJouni Malinen <j@w1.fi>2008-11-28 18:32:13 (GMT)
commit116654ce24fea104bd0eeb66499948df4d4df3ce (patch)
tree1662391971bc8a900bdfb216a4e10baece082f73 /src/eap_peer
parentbcbbc7af45cc4b84a5c10e65f4283fdf68cd785a (diff)
downloadhostap-06-116654ce24fea104bd0eeb66499948df4d4df3ce.zip
hostap-06-116654ce24fea104bd0eeb66499948df4d4df3ce.tar.gz
hostap-06-116654ce24fea104bd0eeb66499948df4d4df3ce.tar.bz2
WPS: Moved wps_context initialization into wps_supplicant.c
The wps_context data is now managed at wpa_supplicant, not EAP-WSC. This makes wpa_supplicant design for WPS match with hostapd one and also makes it easier configure whatever parameters and callbacks are needed for WPS.
Diffstat (limited to 'src/eap_peer')
-rw-r--r--src/eap_peer/eap.c1
-rw-r--r--src/eap_peer/eap.h18
-rw-r--r--src/eap_peer/eap_i.h1
-rw-r--r--src/eap_peer/eap_wsc.c38
4 files changed, 19 insertions, 39 deletions
diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index 7ec6d1a..8f84434 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -1182,6 +1182,7 @@ struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
os_memcpy(sm->mac_addr, conf->mac_addr, ETH_ALEN);
if (conf->uuid)
os_memcpy(sm->uuid, conf->uuid, 16);
+ sm->wps = conf->wps;
os_memset(&tlsconf, 0, sizeof(tlsconf));
tlsconf.opensc_engine_path = conf->opensc_engine_path;
diff --git a/src/eap_peer/eap.h b/src/eap_peer/eap.h
index 00a8f76..c434498 100644
--- a/src/eap_peer/eap.h
+++ b/src/eap_peer/eap.h
@@ -22,7 +22,6 @@
struct eap_sm;
struct wpa_config_blob;
struct wpabuf;
-struct wps_credential;
struct eap_method_type {
int vendor;
@@ -215,17 +214,6 @@ struct eapol_callbacks {
void (*notify_pending)(void *ctx);
/**
- * wps_cred - Notify that new credential was received from WPS
- * @ctx: eapol_ctx from eap_peer_sm_init() call
- * 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, const struct wps_credential *cred);
-
- /**
* eap_param_needed - Notify that EAP parameter is needed
* @ctx: eapol_ctx from eap_peer_sm_init() call
* @field: Field name (e.g., "IDENTITY")
@@ -269,6 +257,12 @@ struct eap_config {
* This is only used by EAP-WSC and can be left %NULL if not available.
*/
const u8 *uuid;
+ /**
+ * wps - WPS context data
+ *
+ * This is only used by EAP-WSC and can be left %NULL if not available.
+ */
+ struct wps_context *wps;
};
struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
diff --git a/src/eap_peer/eap_i.h b/src/eap_peer/eap_i.h
index 6f425d2..9947276 100644
--- a/src/eap_peer/eap_i.h
+++ b/src/eap_peer/eap_i.h
@@ -335,6 +335,7 @@ struct eap_sm {
u8 mac_addr[ETH_ALEN];
u8 uuid[16];
+ struct wps_context *wps;
};
const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c
index 13bd768..d4b0dc3 100644
--- a/src/eap_peer/eap_wsc.c
+++ b/src/eap_peer/eap_wsc.c
@@ -106,7 +106,13 @@ static void * eap_wsc_init(struct eap_sm *sm)
struct wps_config cfg;
const char *pos;
const char *phase1;
- struct wps_context *wps = NULL;
+ struct wps_context *wps;
+
+ wps = sm->wps;
+ if (wps == NULL) {
+ wpa_printf(MSG_ERROR, "EAP-WSC: WPS context not available");
+ return NULL;
+ }
identity = eap_get_config_identity(sm, &identity_len);
@@ -127,27 +133,7 @@ static void * eap_wsc_init(struct eap_sm *sm)
return NULL;
data->state = registrar ? MSG : WAIT_START;
data->registrar = registrar;
-
- wps = os_zalloc(sizeof(*wps));
- if (wps == NULL) {
- os_free(data);
- return NULL;
- }
-
data->wps_ctx = wps;
- wps->cb_ctx = sm->eapol_ctx;
- wps->cred_cb = sm->eapol_cb->wps_cred;
-
- /* TODO: store wps_context at higher layer and make the device data
- * configurable */
- wps->dev.device_name = "dev name";
- wps->dev.manufacturer = "manuf";
- wps->dev.model_name = "model name";
- wps->dev.model_number = "model number";
- wps->dev.serial_number = "12345";
- wps->dev.categ = WPS_DEV_COMPUTER;
- wps->dev.oui = WPS_DEV_OUI_WFA;
- wps->dev.sub_categ = WPS_DEV_COMPUTER_PC;
if (registrar) {
struct wps_registrar_config rcfg;
@@ -175,7 +161,7 @@ static void * eap_wsc_init(struct eap_sm *sm)
os_memset(&cfg, 0, sizeof(cfg));
cfg.authenticator = 0;
cfg.wps = wps;
- cfg.registrar = data->wps_ctx ? data->wps_ctx->registrar : NULL;
+ cfg.registrar = registrar ? data->wps_ctx->registrar : NULL;
cfg.enrollee_mac_addr = sm->mac_addr;
phase1 = eap_get_config_phase1(sm);
@@ -238,11 +224,9 @@ static void eap_wsc_deinit(struct eap_sm *sm, void *priv)
wpabuf_free(data->in_buf);
wpabuf_free(data->out_buf);
wps_deinit(data->wps);
- if (data->wps_ctx) {
- wps_registrar_deinit(data->wps_ctx->registrar);
- os_free(data->wps_ctx->network_key);
- os_free(data->wps_ctx);
- }
+ wps_registrar_deinit(data->wps_ctx->registrar);
+ os_free(data->wps_ctx->network_key);
+ data->wps_ctx->network_key = NULL;
os_free(data);
}