WPS: Cleanup UUID and MAC address configuration
authorJouni Malinen <j@w1.fi>
Thu, 1 Jan 2009 20:56:02 +0000 (22:56 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 1 Jan 2009 20:56:02 +0000 (22:56 +0200)
No need to configure these separately for each Enrollee in wps_config
since wps_context is now used both for Registrar and Enrollee.

src/eap_peer/eap_wsc.c
src/wps/wps.c
src/wps/wps.h
src/wps/wps_registrar.c

index 5521371..680d747 100644 (file)
@@ -162,7 +162,6 @@ static void * eap_wsc_init(struct eap_sm *sm)
        cfg.authenticator = 0;
        cfg.wps = wps;
        cfg.registrar = registrar ? data->wps_ctx->registrar : NULL;
-       cfg.enrollee_mac_addr = registrar ? NULL : wps->dev.mac_addr;
 
        phase1 = eap_get_config_phase1(sm);
        if (phase1 == NULL) {
@@ -192,7 +191,6 @@ static void * eap_wsc_init(struct eap_sm *sm)
                return NULL;
        }
 
-       cfg.uuid = registrar ? NULL : wps->uuid;
        data->wps = wps_init(&cfg);
        if (data->wps == NULL) {
                os_free(data);
index c042fca..d1148ac 100644 (file)
@@ -28,11 +28,11 @@ struct wps_data * wps_init(const struct wps_config *cfg)
        data->authenticator = cfg->authenticator;
        data->wps = cfg->wps;
        data->registrar = cfg->registrar;
-       if (cfg->enrollee_mac_addr)
-               os_memcpy(data->mac_addr_e, cfg->enrollee_mac_addr, ETH_ALEN);
-       if (cfg->uuid) {
-               os_memcpy(cfg->registrar ? data->uuid_r : data->uuid_e,
-                         cfg->uuid, WPS_UUID_LEN);
+       if (cfg->registrar) {
+               os_memcpy(data->uuid_r, cfg->wps->uuid, WPS_UUID_LEN);
+       } else {
+               os_memcpy(data->mac_addr_e, cfg->wps->dev.mac_addr, ETH_ALEN);
+               os_memcpy(data->uuid_e, cfg->wps->uuid, WPS_UUID_LEN);
        }
        if (cfg->pin) {
                data->dev_pw_id = DEV_PW_DEFAULT;
index 7d78a53..0e69814 100644 (file)
@@ -55,11 +55,9 @@ struct wps_config {
        int authenticator;
        struct wps_context *wps;
        struct wps_registrar *registrar; /* NULL for Enrollee */
-       const u8 *enrollee_mac_addr; /* NULL for Registrar */
        const u8 *pin; /* Enrollee Device Password (NULL for Registrar or PBC)
                        */
        size_t pin_len;
-       const u8 *uuid; /* 128-bit Enrollee UUID (NULL for Registrar) */
        int pbc;
        const struct wpabuf *assoc_wps_ie; /* (Re)AssocReq WPS IE (in AP) */
 };
index 4d5e0c3..21d914c 100644 (file)
@@ -980,7 +980,6 @@ static struct wpabuf * wps_build_m2(struct wps_data *wps)
                return NULL;
        wpa_hexdump(MSG_DEBUG, "WPS: Registrar Nonce",
                    wps->nonce_r, WPS_NONCE_LEN);
-       os_memcpy(wps->uuid_r, wps->wps->uuid, WPS_UUID_LEN);
        wpa_hexdump(MSG_DEBUG, "WPS: UUID-R", wps->uuid_r, WPS_UUID_LEN);
 
        wpa_printf(MSG_DEBUG, "WPS: Building Message M2");