Add own MAC address used for key derivation to PTKSA cache
On successful PASN handshake or 4-way handshake with a peer, PTK is derived using the local and peer MAC addresses as input. Store the own MAC address that is used for key derivation in PTKSA cache to maintain that state over potential MAC addresses changes. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
d0d585c481
commit
580bd04cf3
6 changed files with 16 additions and 8 deletions
|
@ -3502,8 +3502,8 @@ static void handle_auth_pasn_3(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
wpa_printf(MSG_INFO,
|
||||
"PASN: Success handling transaction == 3. Store PTK");
|
||||
|
||||
ptksa_cache_add(hapd->ptksa, sta->addr, sta->pasn->cipher, 43200,
|
||||
&sta->pasn->ptk);
|
||||
ptksa_cache_add(hapd->ptksa, hapd->own_addr, sta->addr,
|
||||
sta->pasn->cipher, 43200, &sta->pasn->ptk);
|
||||
fail:
|
||||
ap_free_sta(hapd, sta);
|
||||
}
|
||||
|
|
|
@ -934,7 +934,8 @@ static void hostapd_store_ptksa(void *ctx, const u8 *addr,int cipher,
|
|||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
|
||||
ptksa_cache_add(hapd->ptksa, addr, cipher, life_time, ptk);
|
||||
ptksa_cache_add(hapd->ptksa, hapd->own_addr, addr, cipher, life_time,
|
||||
ptk);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -254,6 +254,7 @@ void ptksa_cache_flush(struct ptksa_cache *ptksa, const u8 *addr, u32 cipher)
|
|||
/*
|
||||
* ptksa_cache_add - Add a PTKSA cache entry
|
||||
* @ptksa: Pointer to PTKSA cache data from ptksa_cache_init()
|
||||
* @own_addr: Own MAC address
|
||||
* @addr: Peer address
|
||||
* @cipher: The cipher used
|
||||
* @life_time: The PTK life time in seconds
|
||||
|
@ -265,6 +266,7 @@ void ptksa_cache_flush(struct ptksa_cache *ptksa, const u8 *addr, u32 cipher)
|
|||
* this entry will be replaced with the new entry.
|
||||
*/
|
||||
struct ptksa_cache_entry * ptksa_cache_add(struct ptksa_cache *ptksa,
|
||||
const u8 *own_addr,
|
||||
const u8 *addr, u32 cipher,
|
||||
u32 life_time,
|
||||
const struct wpa_ptk *ptk)
|
||||
|
@ -289,6 +291,8 @@ struct ptksa_cache_entry * ptksa_cache_add(struct ptksa_cache *ptksa,
|
|||
dl_list_init(&entry->list);
|
||||
os_memcpy(entry->addr, addr, ETH_ALEN);
|
||||
entry->cipher = cipher;
|
||||
if (own_addr)
|
||||
os_memcpy(entry->own_addr, own_addr, ETH_ALEN);
|
||||
|
||||
os_memcpy(&entry->ptk, ptk, sizeof(entry->ptk));
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ struct ptksa_cache_entry {
|
|||
os_time_t expiration;
|
||||
u32 cipher;
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 own_addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PTKSA_CACHE
|
||||
|
@ -35,6 +36,7 @@ struct ptksa_cache_entry * ptksa_cache_get(struct ptksa_cache *ptksa,
|
|||
const u8 *addr, u32 cipher);
|
||||
int ptksa_cache_list(struct ptksa_cache *ptksa, char *buf, size_t len);
|
||||
struct ptksa_cache_entry * ptksa_cache_add(struct ptksa_cache *ptksa,
|
||||
const u8 *own_addr,
|
||||
const u8 *addr, u32 cipher,
|
||||
u32 life_time,
|
||||
const struct wpa_ptk *ptk);
|
||||
|
@ -64,8 +66,8 @@ static inline int ptksa_cache_list(struct ptksa_cache *ptksa,
|
|||
}
|
||||
|
||||
static inline struct ptksa_cache_entry *
|
||||
ptksa_cache_add(struct ptksa_cache *ptksa, const u8 *addr, u32 cipher,
|
||||
u32 life_time, const struct wpa_ptk *ptk)
|
||||
ptksa_cache_add(struct ptksa_cache *ptksa, const u8 *own_addr, const u8 *addr,
|
||||
u32 cipher, u32 life_time, const struct wpa_ptk *ptk)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1567,8 +1567,8 @@ int wpas_pasn_auth_rx(struct wpa_supplicant *wpa_s,
|
|||
|
||||
wpa_printf(MSG_DEBUG, "PASN: Success sending last frame. Store PTK");
|
||||
|
||||
ptksa_cache_add(wpa_s->ptksa, pasn->bssid, pasn->cipher,
|
||||
dot11RSNAConfigPMKLifetime, &pasn->ptk);
|
||||
ptksa_cache_add(wpa_s->ptksa, wpa_s->own_addr, pasn->bssid,
|
||||
pasn->cipher, dot11RSNAConfigPMKLifetime, &pasn->ptk);
|
||||
|
||||
forced_memzero(&pasn->ptk, sizeof(pasn->ptk));
|
||||
|
||||
|
|
|
@ -1378,7 +1378,8 @@ static void wpa_supplicant_store_ptk(void *ctx, u8 *addr, int cipher,
|
|||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
|
||||
ptksa_cache_add(wpa_s->ptksa, addr, cipher, life_time, ptk);
|
||||
ptksa_cache_add(wpa_s->ptksa, wpa_s->own_addr, addr, cipher, life_time,
|
||||
ptk);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NO_WPA */
|
||||
|
|
Loading…
Reference in a new issue