aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/pmksa_cache.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2005-12-17 20:51:40 (GMT)
committerJouni Malinen <j@w1.fi>2005-12-17 20:51:40 (GMT)
commit0ffeb8026399bc93b3c2cec9e50ba59f973f519e (patch)
tree9113e8d3bfe1b4f4e82263902a41642046e7aae6 /hostapd/pmksa_cache.c
parentc6dc95507d126961807e0a0273160ee145b9f662 (diff)
downloadhostap-history-0ffeb8026399bc93b3c2cec9e50ba59f973f519e.zip
hostap-history-0ffeb8026399bc93b3c2cec9e50ba59f973f519e.tar.gz
hostap-history-0ffeb8026399bc93b3c2cec9e50ba59f973f519e.tar.bz2
Moved PMKSA cache from struct hostapd_data into struct wpa_authenticator.
Diffstat (limited to 'hostapd/pmksa_cache.c')
-rw-r--r--hostapd/pmksa_cache.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/hostapd/pmksa_cache.c b/hostapd/pmksa_cache.c
index 65fbfb0..514c9aa 100644
--- a/hostapd/pmksa_cache.c
+++ b/hostapd/pmksa_cache.c
@@ -200,9 +200,10 @@ void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
/**
* pmksa_cache_add - Add a PMKSA cache entry
* @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
- * @sta: Pointer to the station data
+ * @spa: Supplicant address
* @pmk: The new pairwise master key
* @session_timeout: Session timeout
+ * @eapol: Pointer to EAPOL state machine data
* Returns: Pointer to the added PMKSA cache entry or %NULL on error
*
* This function create a PMKSA entry for a new PMK and adds it to the PMKSA
@@ -211,21 +212,18 @@ void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
* based on the PMK.
*/
struct rsn_pmksa_cache_entry *
-pmksa_cache_add(struct rsn_pmksa_cache *pmksa, struct sta_info *sta,
- const u8 *pmk, int session_timeout)
+pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *spa, const u8 *pmk,
+ int session_timeout, struct eapol_state_machine *eapol)
{
struct rsn_pmksa_cache_entry *entry, *pos, *prev;
struct os_time now;
- if (wpa_auth_sta_wpa_version(sta->wpa_sm) != 2)
- return NULL;
-
entry = malloc(sizeof(*entry));
if (entry == NULL)
return NULL;
memset(entry, 0, sizeof(*entry));
memcpy(entry->pmk, pmk, PMK_LEN);
- rsn_pmkid(pmk, pmksa->own_addr, sta->addr, entry->pmkid);
+ rsn_pmkid(pmk, pmksa->own_addr, spa, entry->pmkid);
os_get_time(&now);
entry->expiration = now.sec;
if (session_timeout > 0)
@@ -233,12 +231,12 @@ pmksa_cache_add(struct rsn_pmksa_cache *pmksa, struct sta_info *sta,
else
entry->expiration += dot11RSNAConfigPMKLifetime;
entry->akmp = WPA_KEY_MGMT_IEEE8021X;
- memcpy(entry->spa, sta->addr, ETH_ALEN);
- pmksa_cache_from_eapol_data(entry, sta->eapol_sm);
+ memcpy(entry->spa, spa, ETH_ALEN);
+ pmksa_cache_from_eapol_data(entry, eapol);
/* Replace an old entry for the same STA (if found) with the new entry
*/
- pos = pmksa_cache_get(pmksa, sta->addr, NULL);
+ pos = pmksa_cache_get(pmksa, spa, NULL);
if (pos)
pmksa_cache_free_entry(pmksa, pos);