aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2005-06-25 16:19:09 (GMT)
committerJouni Malinen <j@w1.fi>2005-06-25 16:19:09 (GMT)
commit0d34391dfb3d6d9806e1f211f026c302ec01a49c (patch)
tree1eb01df83bc90791fe85d21211e4ffccd29ff79d
parente4e6a25f944eea5014c5930856847cca671d25be (diff)
downloadhostap-history-0d34391dfb3d6d9806e1f211f026c302ec01a49c.zip
hostap-history-0d34391dfb3d6d9806e1f211f026c302ec01a49c.tar.gz
hostap-history-0d34391dfb3d6d9806e1f211f026c302ec01a49c.tar.bz2
Replaced wpa_s->eapol with sm->eapol in wpa.c and preauth.c.
-rw-r--r--wpa_supplicant/preauth.c3
-rw-r--r--wpa_supplicant/wpa.c32
-rw-r--r--wpa_supplicant/wpa.h2
-rw-r--r--wpa_supplicant/wpa_i.h2
-rw-r--r--wpa_supplicant/wpa_supplicant.c2
5 files changed, 30 insertions, 11 deletions
diff --git a/wpa_supplicant/preauth.c b/wpa_supplicant/preauth.c
index bd61e0b..618ea03 100644
--- a/wpa_supplicant/preauth.c
+++ b/wpa_supplicant/preauth.c
@@ -117,9 +117,8 @@ static void pmksa_cache_expire(void *eloop_ctx, void *timeout_ctx)
static void pmksa_cache_reauth(void *eloop_ctx, void *timeout_ctx)
{
struct wpa_sm *sm = eloop_ctx;
- struct wpa_supplicant *wpa_s = sm->ctx;
sm->cur_pmksa = NULL;
- eapol_sm_request_reauth(wpa_s->eapol);
+ eapol_sm_request_reauth(sm->eapol);
}
diff --git a/wpa_supplicant/wpa.c b/wpa_supplicant/wpa.c
index 1148720..d709d17 100644
--- a/wpa_supplicant/wpa.c
+++ b/wpa_supplicant/wpa.c
@@ -737,6 +737,8 @@ static void wpa_eapol_key_mic(const u8 *key, int ver,
static void wpa_eapol_key_send(struct wpa_supplicant *wpa_s, const u8 *kck,
int ver, u8 *msg, size_t msg_len, u8 *key_mic)
{
+ struct wpa_sm *sm = wpa_s->wpa;
+
if (key_mic) {
wpa_eapol_key_mic(kck, ver, msg + sizeof(struct l2_ethhdr),
msg_len - sizeof(struct l2_ethhdr),
@@ -748,7 +750,7 @@ static void wpa_eapol_key_send(struct wpa_supplicant *wpa_s, const u8 *kck,
else {
wpa_drv_send_eapol(wpa_s, msg, msg_len);
}
- eapol_sm_notify_tx_eapol_key(wpa_s->eapol);
+ eapol_sm_notify_tx_eapol_key(sm->eapol);
free(msg);
}
@@ -939,14 +941,14 @@ static int wpa_supplicant_get_pmk(struct wpa_supplicant *wpa_s,
wpa_sm_set_pmk_from_pmksa(sm);
wpa_hexdump_key(MSG_DEBUG, "RSN: PMK from PMKSA cache",
sm->pmk, sm->pmk_len);
- eapol_sm_notify_cached(wpa_s->eapol);
- } else if (sm->key_mgmt == WPA_KEY_MGMT_IEEE8021X && wpa_s->eapol) {
+ eapol_sm_notify_cached(sm->eapol);
+ } else if (sm->key_mgmt == WPA_KEY_MGMT_IEEE8021X && sm->eapol) {
int res, pmk_len;
pmk_len = PMK_LEN;
- res = eapol_sm_get_key(wpa_s->eapol, sm->pmk, PMK_LEN);
+ res = eapol_sm_get_key(sm->eapol, sm->pmk, PMK_LEN);
#ifdef EAP_LEAP
if (res) {
- res = eapol_sm_get_key(wpa_s->eapol, sm->pmk, 16);
+ res = eapol_sm_get_key(sm->eapol, sm->pmk, 16);
pmk_len = 16;
}
#endif /* EAP_LEAP */
@@ -1140,9 +1142,9 @@ static void wpa_supplicant_key_neg_complete(struct wpa_supplicant *wpa_s,
if (secure) {
/* MLME.SETPROTECTION.request(TA, Tx_Rx) */
- eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
+ eapol_sm_notify_portValid(sm->eapol, TRUE);
if (sm->key_mgmt == WPA_KEY_MGMT_PSK)
- eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
+ eapol_sm_notify_eap_success(sm->eapol, TRUE);
/*
* Start preauthentication after a short wait to avoid a
* possible race condition between the data receive and key
@@ -1571,7 +1573,7 @@ static void wpa_supplicant_process_3_of_4(struct wpa_supplicant *wpa_s,
if (key_info & WPA_KEY_INFO_SECURE) {
/* MLME.SETPROTECTION.request(TA, Tx_Rx) */
- eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
+ eapol_sm_notify_portValid(sm->eapol, TRUE);
}
wpa_supplicant_set_state(wpa_s, WPA_GROUP_HANDSHAKE);
@@ -1922,7 +1924,7 @@ int wpa_sm_rx_eapol(struct wpa_supplicant *wpa_s, unsigned char *src_addr,
wpa_printf(MSG_DEBUG, "WPA: Cancelling PMKSA caching "
"attempt - attempt full EAP "
"authentication");
- eapol_sm_notify_pmkid_attempt(wpa_s->eapol, 0);
+ eapol_sm_notify_pmkid_attempt(sm->eapol, 0);
}
return 0;
}
@@ -2361,6 +2363,18 @@ void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname)
/**
+ * wpa_sm_set_eapol - Set EAPOL state machine pointer
+ * @sm: Pointer to WPA state machine data from wpa_sm_init()
+ * @eapol: Pointer to EAPOL state machine allocated with eapol_sm_init()
+ */
+void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol)
+{
+ if (sm)
+ sm->eapol = eapol;
+}
+
+
+/**
* wpa_sm_set_param - Set WPA state machine parameters
* @sm: Pointer to WPA state machine data from wpa_sm_init()
* @param: Parameter field
diff --git a/wpa_supplicant/wpa.h b/wpa_supplicant/wpa.h
index af31783..385add2 100644
--- a/wpa_supplicant/wpa.h
+++ b/wpa_supplicant/wpa.h
@@ -130,6 +130,7 @@ enum {
struct wpa_sm;
struct wpa_ssid;
+struct eapol_sm;
struct wpa_sm * wpa_sm_init(void *ctx);
void wpa_sm_deinit(struct wpa_sm *sm);
@@ -142,6 +143,7 @@ void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx);
void wpa_sm_set_config(struct wpa_sm *sm, struct wpa_ssid *config);
void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr);
void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname);
+void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol);
int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen);
enum wpa_sm_conf_params {
diff --git a/wpa_supplicant/wpa_i.h b/wpa_supplicant/wpa_i.h
index 3fafe48..017d7e9 100644
--- a/wpa_supplicant/wpa_i.h
+++ b/wpa_supplicant/wpa_i.h
@@ -61,6 +61,8 @@ struct wpa_sm {
int rx_replay_counter_set;
u8 request_counter[WPA_REPLAY_COUNTER_LEN];
+ struct eapol_sm *eapol; /* EAPOL state machine from upper level code */
+
struct rsn_pmksa_cache *pmksa; /* PMKSA cache */
struct rsn_pmksa_cache *cur_pmksa; /* current PMKSA entry */
int pmksa_count; /* number of entries in PMKSA cache */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c7bce60..796181f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -578,6 +578,7 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
free(wpa_s->confname);
wpa_s->confname = NULL;
+ wpa_sm_set_eapol(wpa_s->wpa, NULL);
eapol_sm_deinit(wpa_s->eapol);
wpa_s->eapol = NULL;
@@ -1749,6 +1750,7 @@ static int wpa_supplicant_init2(struct wpa_supplicant *wpa_s,
}
wpa_sm_set_ifname(wpa_s->wpa, wpa_s->ifname);
wpa_sm_set_fast_reauth(wpa_s->wpa, wpa_s->conf->fast_reauth);
+ wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
if (wpa_s->conf->dot11RSNAConfigPMKLifetime &&
wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME,