From 5a8c6d33535fed249b6b67774843b52e619a4f64 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 3 Jan 2009 19:57:22 +0200 Subject: [PATCH] Removed duplicated authenticator yes/no from wps_config and wps_data wps_context::ap is available for this purpose and there is no need to change between AP and not AP between protocol runs. --- src/eap_peer/eap_wsc.c | 1 - src/eap_server/eap_wsc.c | 1 - src/wps/wps.c | 1 - src/wps/wps.h | 6 ------ src/wps/wps_enrollee.c | 14 +++++++------- src/wps/wps_i.h | 6 ------ src/wps/wps_registrar.c | 2 +- 7 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c index 4b2260dcb..42ff46374 100644 --- a/src/eap_peer/eap_wsc.c +++ b/src/eap_peer/eap_wsc.c @@ -159,7 +159,6 @@ static void * eap_wsc_init(struct eap_sm *sm) } os_memset(&cfg, 0, sizeof(cfg)); - cfg.authenticator = 0; cfg.wps = wps; cfg.registrar = registrar ? data->wps_ctx->registrar : NULL; diff --git a/src/eap_server/eap_wsc.c b/src/eap_server/eap_wsc.c index e6c197f8c..451cb1fe8 100644 --- a/src/eap_server/eap_wsc.c +++ b/src/eap_server/eap_wsc.c @@ -89,7 +89,6 @@ static void * eap_wsc_init(struct eap_sm *sm) data->registrar = registrar; os_memset(&cfg, 0, sizeof(cfg)); - cfg.authenticator = 1; cfg.wps = sm->wps; if (registrar) { if (sm->wps == NULL || sm->wps->registrar == NULL) { diff --git a/src/wps/wps.c b/src/wps/wps.c index 2369a30b3..3a1606f5f 100644 --- a/src/wps/wps.c +++ b/src/wps/wps.c @@ -35,7 +35,6 @@ struct wps_data * wps_init(const struct wps_config *cfg) struct wps_data *data = os_zalloc(sizeof(*data)); if (data == NULL) return NULL; - data->authenticator = cfg->authenticator; data->wps = cfg->wps; data->registrar = cfg->registrar; if (cfg->registrar) { diff --git a/src/wps/wps.h b/src/wps/wps.h index 8c6223492..9d723fe33 100644 --- a/src/wps/wps.h +++ b/src/wps/wps.h @@ -85,12 +85,6 @@ struct wps_device_data { * struct wps_config - WPS configuration for a single registration protocol run */ struct wps_config { - /** - * authenticator - Whether the local end is Authenticator - * 1 = Authenticator, 0 = Supplicant - */ - int authenticator; - /** * wps - Pointer to long term WPS context */ diff --git a/src/wps/wps_enrollee.c b/src/wps/wps_enrollee.c index 4f9826219..f6a828d0f 100644 --- a/src/wps/wps_enrollee.c +++ b/src/wps/wps_enrollee.c @@ -288,7 +288,7 @@ static struct wpabuf * wps_build_m7(struct wps_data *wps) wps_build_msg_type(msg, WPS_M7) || wps_build_registrar_nonce(wps, msg) || wps_build_e_snonce2(wps, plain) || - (wps->authenticator && + (wps->wps->ap && (wps_build_cred_ssid(wps, plain) || wps_build_cred_mac_addr(wps, plain) || wps_build_cred_auth_type(wps, plain) || @@ -326,7 +326,7 @@ static struct wpabuf * wps_build_wsc_done(struct wps_data *wps) return NULL; } - if (wps->authenticator) + if (wps->wps->ap) wps->state = RECV_ACK; else { wps_success_event(wps->wps); @@ -404,7 +404,7 @@ struct wpabuf * wps_enrollee_get_msg(struct wps_data *wps, *op_code = WSC_MSG; break; case RECEIVED_M2D: - if (wps->authenticator) { + if (wps->wps->ap) { msg = wps_build_wsc_nack(wps); *op_code = WSC_NACK; break; @@ -642,7 +642,7 @@ static int wps_process_creds(struct wps_data *wps, const u8 *cred[], { size_t i; - if (wps->authenticator) + if (wps->wps->ap) return 0; if (num_cred == 0) { @@ -665,7 +665,7 @@ static int wps_process_ap_settings_e(struct wps_data *wps, { struct wps_credential cred; - if (!wps->authenticator) + if (!wps->wps->ap) return 0; if (wps_process_ap_settings(attr, &cred) < 0) @@ -703,7 +703,7 @@ static enum wps_process_res wps_process_m2(struct wps_data *wps, return WPS_CONTINUE; } - if (wps->authenticator && wps->wps->ap_setup_locked) { + if (wps->wps->ap && wps->wps->ap_setup_locked) { wpa_printf(MSG_DEBUG, "WPS: AP Setup is locked - refuse " "registration of a new Registrar"); wps->config_error = WPS_CFG_SETUP_LOCKED; @@ -1023,7 +1023,7 @@ static enum wps_process_res wps_process_wsc_ack(struct wps_data *wps, return WPS_FAILURE; } - if (wps->state == RECV_ACK && wps->authenticator) { + if (wps->state == RECV_ACK && wps->wps->ap) { wpa_printf(MSG_DEBUG, "WPS: External Registrar registration " "completed successfully"); wps_success_event(wps->wps); diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h index 4b7ad253b..b67a42a4e 100644 --- a/src/wps/wps_i.h +++ b/src/wps/wps_i.h @@ -24,12 +24,6 @@ * single registration protocol run. */ struct wps_data { - /** - * authenticator - Whether the local end is Authenticator - * 1 = Authenticator, 0 = Supplicant - */ - int authenticator; - /** * wps - Pointer to long term WPS context */ diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index e3b1f2c62..a364a68fe 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -1040,7 +1040,7 @@ static struct wpabuf * wps_build_m2d(struct wps_data *wps) if (msg == NULL) return NULL; - if (wps->authenticator && wps->wps->ap_setup_locked) + if (wps->wps->ap && wps->wps->ap_setup_locked) err = WPS_CFG_SETUP_LOCKED; if (wps_build_version(msg) ||