aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
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 /wpa_supplicant
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 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wpa_supplicant.c6
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h2
-rw-r--r--wpa_supplicant/wpas_glue.c2
-rw-r--r--wpa_supplicant/wps_supplicant.c38
-rw-r--r--wpa_supplicant/wps_supplicant.h11
5 files changed, 58 insertions, 1 deletions
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index e9c9228..4a26aae 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -39,6 +39,7 @@
#include "blacklist.h"
#include "wpas_glue.h"
#include "wps/wps.h"
+#include "wps_supplicant.h"
const char *wpa_supplicant_version =
"wpa_supplicant v" VERSION_STR "\n"
@@ -386,6 +387,8 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
wpa_supplicant_cancel_auth_timeout(wpa_s);
ieee80211_sta_deinit(wpa_s);
+
+ wpas_wps_deinit(wpa_s);
}
@@ -1789,6 +1792,9 @@ static int wpa_supplicant_init_iface2(struct wpa_supplicant *wpa_s)
wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
+ if (wpas_wps_init(wpa_s))
+ return -1;
+
if (wpa_supplicant_init_eapol(wpa_s) < 0)
return -1;
wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index a8fb6d2..ab7aa94 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -338,6 +338,8 @@ struct wpa_supplicant {
int pending_mic_error_report;
int pending_mic_error_pairwise;
int mic_errors_seen; /* Michael MIC errors with the current PTK */
+
+ struct wps_context *wps;
};
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index ddcc0ec..70b4416 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -560,7 +560,7 @@ int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s)
#endif /* EAP_TLS_OPENSSL */
ctx->mac_addr = wpa_s->own_addr;
ctx->uuid = wpa_s->conf->uuid;
- ctx->wps_cred = wpas_wps_get_cred_cb();
+ ctx->wps = wpa_s->wps;
ctx->eap_param_needed = wpa_supplicant_eap_param_needed;
ctx->cb = wpa_supplicant_eapol_cb;
ctx->cb_ctx = wpa_s;
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index be7cafc..4d1c078 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -175,3 +175,41 @@ void * wpas_wps_get_cred_cb(void)
{
return wpa_supplicant_wps_cred;
}
+
+
+int wpas_wps_init(struct wpa_supplicant *wpa_s)
+{
+ struct wps_context *wps;
+
+ wps = os_zalloc(sizeof(*wps));
+ if (wps == NULL)
+ return -1;
+
+ wps->cred_cb = wpa_supplicant_wps_cred;
+ wps->cb_ctx = wpa_s;
+
+ /* TODO: 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;
+
+ wpa_s->wps = wps;
+
+ return 0;
+}
+
+
+void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
+{
+ if (wpa_s->wps == NULL)
+ return;
+
+ os_free(wpa_s->wps->network_key);
+ os_free(wpa_s->wps);
+ wpa_s->wps = NULL;
+}
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index 3173624..caacc36 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -17,11 +17,22 @@
#ifdef CONFIG_WPS
+int wpas_wps_init(struct wpa_supplicant *wpa_s);
+void wpas_wps_deinit(struct wpa_supplicant *wpa_s);
int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s);
void * wpas_wps_get_cred_cb(void);
#else /* CONFIG_WPS */
+static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
+{
+ return 0;
+}
+
+static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
+{
+}
+
static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
{
return 0;