From 8492cc79c046b55782194d0e8f0b4a3bdb7b1253 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 12 Feb 2017 11:15:49 +0200 Subject: [PATCH] PeerKey: Remove dead code related to STSL negotiation state The struct wpa_stsl_negotiation seemed to have been for some kind of tracking of state of PeerKey negotiations within hostapd. However, nothing is actually adding any entries to wpa_auth->stsl_negotiations or using this state. Since PeerKey does not look like something that would be deployed in practice, there is no justification to spend time on making this any more complete. Remove the dead code now instead of trying to figure out what it might be used for. Signed-off-by: Jouni Malinen --- src/ap/peerkey_auth.c | 41 ----------------------------------------- src/ap/wpa_auth.c | 5 ----- src/ap/wpa_auth_i.h | 11 ----------- 3 files changed, 57 deletions(-) diff --git a/src/ap/peerkey_auth.c b/src/ap/peerkey_auth.c index efc1d7e4c..93e775b29 100644 --- a/src/ap/peerkey_auth.c +++ b/src/ap/peerkey_auth.c @@ -19,17 +19,6 @@ #ifdef CONFIG_PEERKEY -static void wpa_stsl_step(void *eloop_ctx, void *timeout_ctx) -{ -#if 0 - struct wpa_authenticator *wpa_auth = eloop_ctx; - struct wpa_stsl_negotiation *neg = timeout_ctx; -#endif - - /* TODO: ? */ -} - - struct wpa_stsl_search { const u8 *addr; struct wpa_state_machine *sm; @@ -110,7 +99,6 @@ void wpa_smk_m1(struct wpa_authenticator *wpa_auth, MAC2STR(kde.mac_addr)); wpa_smk_send_error(wpa_auth, sm, kde.mac_addr, STK_MUI_SMK, STK_ERR_STA_NR); - /* FIX: wpa_stsl_remove(wpa_auth, neg); */ return; } @@ -285,7 +273,6 @@ void wpa_smk_m3(struct wpa_authenticator *wpa_auth, MAC2STR(kde.mac_addr)); wpa_smk_send_error(wpa_auth, sm, kde.mac_addr, STK_MUI_SMK, STK_ERR_STA_NR); - /* FIX: wpa_stsl_remove(wpa_auth, neg); */ return; } @@ -365,32 +352,4 @@ void wpa_smk_error(struct wpa_authenticator *wpa_auth, wpa_smk_send_error(wpa_auth, search.sm, sm->addr, mui, error_type); } - -int wpa_stsl_remove(struct wpa_authenticator *wpa_auth, - struct wpa_stsl_negotiation *neg) -{ - struct wpa_stsl_negotiation *pos, *prev; - - if (wpa_auth == NULL) - return -1; - pos = wpa_auth->stsl_negotiations; - prev = NULL; - while (pos) { - if (pos == neg) { - if (prev) - prev->next = pos->next; - else - wpa_auth->stsl_negotiations = pos->next; - - eloop_cancel_timeout(wpa_stsl_step, wpa_auth, pos); - os_free(pos); - return 0; - } - prev = pos; - pos = pos->next; - } - - return -1; -} - #endif /* CONFIG_PEERKEY */ diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index a62ff7b3e..be734d1c3 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -513,11 +513,6 @@ void wpa_deinit(struct wpa_authenticator *wpa_auth) eloop_cancel_timeout(wpa_rekey_gmk, wpa_auth, NULL); eloop_cancel_timeout(wpa_rekey_gtk, wpa_auth, NULL); -#ifdef CONFIG_PEERKEY - while (wpa_auth->stsl_negotiations) - wpa_stsl_remove(wpa_auth, wpa_auth->stsl_negotiations); -#endif /* CONFIG_PEERKEY */ - pmksa_cache_auth_deinit(wpa_auth->pmksa); #ifdef CONFIG_IEEE80211R_AP diff --git a/src/ap/wpa_auth_i.h b/src/ap/wpa_auth_i.h index cda2c5065..90318d81e 100644 --- a/src/ap/wpa_auth_i.h +++ b/src/ap/wpa_auth_i.h @@ -14,13 +14,6 @@ struct wpa_group; -struct wpa_stsl_negotiation { - struct wpa_stsl_negotiation *next; - u8 initiator[ETH_ALEN]; - u8 peer[ETH_ALEN]; -}; - - struct wpa_state_machine { struct wpa_authenticator *wpa_auth; struct wpa_group *group; @@ -200,8 +193,6 @@ struct wpa_authenticator { unsigned int dot11RSNATKIPCounterMeasuresInvoked; unsigned int dot11RSNA4WayHandshakeFailures; - struct wpa_stsl_negotiation *stsl_negotiations; - struct wpa_auth_config conf; const struct wpa_auth_callbacks *cb; void *cb_ctx; @@ -239,8 +230,6 @@ int wpa_auth_for_each_auth(struct wpa_authenticator *wpa_auth, void *cb_ctx); #ifdef CONFIG_PEERKEY -int wpa_stsl_remove(struct wpa_authenticator *wpa_auth, - struct wpa_stsl_negotiation *neg); void wpa_smk_error(struct wpa_authenticator *wpa_auth, struct wpa_state_machine *sm, const u8 *key_data, size_t key_data_len);