aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2010-07-18 21:30:25 (GMT)
committerJouni Malinen <j@w1.fi>2010-09-09 14:17:17 (GMT)
commitf684e608af21bae27d7c5f384b6cd93a3e540e9e (patch)
tree6119c3da06d3c4196eb7d37b9d7d0f1dcf209494 /src
parent6e3f4b89ea43e5c1371191e645158e6a3f2de052 (diff)
downloadhostap-f684e608af21bae27d7c5f384b6cd93a3e540e9e.zip
hostap-f684e608af21bae27d7c5f384b6cd93a3e540e9e.tar.gz
hostap-f684e608af21bae27d7c5f384b6cd93a3e540e9e.tar.bz2
P2P: Use PSK format in WPS Credential
Diffstat (limited to 'src')
-rw-r--r--src/ap/ieee802_1x.c2
-rw-r--r--src/eap_server/eap.h1
-rw-r--r--src/eap_server/eap_i.h1
-rw-r--r--src/eap_server/eap_server.c3
-rw-r--r--src/eap_server/eap_server_wsc.c7
-rw-r--r--src/eapol_auth/eapol_auth_sm.c4
-rw-r--r--src/eapol_auth/eapol_auth_sm.h3
7 files changed, 16 insertions, 5 deletions
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index edafcb8..c0ece64 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -652,7 +652,7 @@ ieee802_1x_alloc_eapol_sm(struct hostapd_data *hapd, struct sta_info *sta)
flags |= EAPOL_SM_FROM_PMKSA_CACHE;
}
return eapol_auth_alloc(hapd->eapol_auth, sta->addr, flags,
- sta->wps_ie, sta);
+ sta->wps_ie, sta->p2p_ie, sta);
}
diff --git a/src/eap_server/eap.h b/src/eap_server/eap.h
index 637086b..8a34671 100644
--- a/src/eap_server/eap.h
+++ b/src/eap_server/eap.h
@@ -106,6 +106,7 @@ struct eap_config {
int tnc;
struct wps_context *wps;
const struct wpabuf *assoc_wps_ie;
+ const struct wpabuf *assoc_p2p_ie;
const u8 *peer_addr;
int fragment_size;
};
diff --git a/src/eap_server/eap_i.h b/src/eap_server/eap_i.h
index da8f848..3b3e49c 100644
--- a/src/eap_server/eap_i.h
+++ b/src/eap_server/eap_i.h
@@ -183,6 +183,7 @@ struct eap_sm {
int tnc;
struct wps_context *wps;
struct wpabuf *assoc_wps_ie;
+ struct wpabuf *assoc_p2p_ie;
Boolean start_reauth;
diff --git a/src/eap_server/eap_server.c b/src/eap_server/eap_server.c
index a2e5bde..1d19251 100644
--- a/src/eap_server/eap_server.c
+++ b/src/eap_server/eap_server.c
@@ -1255,6 +1255,8 @@ struct eap_sm * eap_server_sm_init(void *eapol_ctx,
sm->wps = conf->wps;
if (conf->assoc_wps_ie)
sm->assoc_wps_ie = wpabuf_dup(conf->assoc_wps_ie);
+ if (conf->assoc_p2p_ie)
+ sm->assoc_p2p_ie = wpabuf_dup(conf->assoc_p2p_ie);
if (conf->peer_addr)
os_memcpy(sm->peer_addr, conf->peer_addr, ETH_ALEN);
sm->fragment_size = conf->fragment_size;
@@ -1292,6 +1294,7 @@ void eap_server_sm_deinit(struct eap_sm *sm)
os_free(sm->eap_if.aaaEapKeyData);
eap_user_free(sm->user);
wpabuf_free(sm->assoc_wps_ie);
+ wpabuf_free(sm->assoc_p2p_ie);
os_free(sm);
}
diff --git a/src/eap_server/eap_server_wsc.c b/src/eap_server/eap_server_wsc.c
index e6d32f2..83e55d9 100644
--- a/src/eap_server/eap_server_wsc.c
+++ b/src/eap_server/eap_server_wsc.c
@@ -135,8 +135,11 @@ static void * eap_wsc_init(struct eap_sm *sm)
}
cfg.assoc_wps_ie = sm->assoc_wps_ie;
cfg.peer_addr = sm->peer_addr;
- if (0 /* TODO: could provide option for forcing PSK format */)
- cfg.use_psk_key = 1;
+ if (sm->assoc_p2p_ie) {
+ wpa_printf(MSG_DEBUG, "EAP-WSC: Prefer PSK format for P2P "
+ "client");
+ cfg.use_psk_key = 1;
+ }
data->wps = wps_init(&cfg);
if (data->wps == NULL) {
os_free(data);
diff --git a/src/eapol_auth/eapol_auth_sm.c b/src/eapol_auth/eapol_auth_sm.c
index 9080009..a3b1c92 100644
--- a/src/eapol_auth/eapol_auth_sm.c
+++ b/src/eapol_auth/eapol_auth_sm.c
@@ -762,7 +762,8 @@ SM_STEP(CTRL_DIR)
struct eapol_state_machine *
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
- int flags, const struct wpabuf *assoc_wps_ie, void *sta_ctx)
+ int flags, const struct wpabuf *assoc_wps_ie,
+ const struct wpabuf *assoc_p2p_ie, void *sta_ctx)
{
struct eapol_state_machine *sm;
struct eap_config eap_conf;
@@ -829,6 +830,7 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
eap_conf.tnc = eapol->conf.tnc;
eap_conf.wps = eapol->conf.wps;
eap_conf.assoc_wps_ie = assoc_wps_ie;
+ eap_conf.assoc_p2p_ie = assoc_p2p_ie;
eap_conf.peer_addr = addr;
eap_conf.fragment_size = eapol->conf.fragment_size;
sm->eap = eap_server_sm_init(sm, &eapol_cb, &eap_conf);
diff --git a/src/eapol_auth/eapol_auth_sm.h b/src/eapol_auth/eapol_auth_sm.h
index bfeef7b..51058c6 100644
--- a/src/eapol_auth/eapol_auth_sm.h
+++ b/src/eapol_auth/eapol_auth_sm.h
@@ -80,7 +80,8 @@ struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
void eapol_auth_deinit(struct eapol_authenticator *eapol);
struct eapol_state_machine *
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
- int flags, const struct wpabuf *assoc_wps_ie, void *sta_ctx);
+ int flags, const struct wpabuf *assoc_wps_ie,
+ const struct wpabuf *assoc_p2p_ie, void *sta_ctx);
void eapol_auth_free(struct eapol_state_machine *sm);
void eapol_auth_step(struct eapol_state_machine *sm);
void eapol_auth_dump_state(FILE *f, const char *prefix,