]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Use PSK format in WPS Credential
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 18 Jul 2010 21:30:25 +0000 (14:30 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:17 +0000 (07:17 -0700)
src/ap/ieee802_1x.c
src/eap_server/eap.h
src/eap_server/eap_i.h
src/eap_server/eap_server.c
src/eap_server/eap_server_wsc.c
src/eapol_auth/eapol_auth_sm.c
src/eapol_auth/eapol_auth_sm.h

index edafcb86efd3c1ceb8cd9c57e6bb2aab289d7767..c0ece64e1b2dc155eac8cf7593b8a2e8bb30b20d 100644 (file)
@@ -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);
 }
 
 
index 637086ba0bb8fb2757d3bb1962b5147dc39e5a6e..8a346716b1f8b415cd84f9aa28f864d7c7bf69b2 100644 (file)
@@ -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;
 };
index da8f8489f54aedc51f7b438ac0702f46b3f14812..3b3e49c64306d484d6bd5472064d1321d6874949 100644 (file)
@@ -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;
 
index a2e5bde827131841fd57b8b0c0b6ef3e178a578f..1d19251d0b4ac38941d809116520af4c453cf110 100644 (file)
@@ -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);
 }
 
index e6d32f29a039d385cfb7da84e88227502ac9a008..83e55d9f191e71c52aa8e7df5b98ab705f8975a2 100644 (file)
@@ -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);
index 90800092e6bfda1bf1ded98d8900834f9f40ad13..a3b1c9270456368e8690ee9f4bc911368a34cc7b 100644 (file)
@@ -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);
index bfeef7b9b66c60a99120aaaa3c9d29e65fa5c268..51058c653827e2e49c614d83ec1628cbd90bfaee 100644 (file)
@@ -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,