wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Functions
pmksa_cache_auth.c File Reference

hostapd - PMKSA cache for IEEE 802.11i RSN More...

#include "utils/includes.h"
#include "utils/common.h"
#include "utils/eloop.h"
#include "eapol_auth/eapol_auth_sm.h"
#include "eapol_auth/eapol_auth_sm_i.h"
#include "radius/radius_das.h"
#include "sta_info.h"
#include "ap_config.h"
#include "pmksa_cache_auth.h"

Data Structures

struct  rsn_pmksa_cache
 

Macros

#define PMKID_HASH_SIZE   128
 
#define PMKID_HASH(pmkid)   (unsigned int) ((pmkid)[0] & 0x7f)
 

Functions

void pmksa_cache_free_entry (struct rsn_pmksa_cache *pmksa, struct rsn_pmksa_cache_entry *entry)
 
void pmksa_cache_to_eapol_data (struct rsn_pmksa_cache_entry *entry, struct eapol_state_machine *eapol)
 
struct rsn_pmksa_cache_entrypmksa_cache_auth_add (struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len, const u8 *kck, size_t kck_len, const u8 *aa, const u8 *spa, int session_timeout, struct eapol_state_machine *eapol, int akmp)
 Add a PMKSA cache entry. More...
 
struct rsn_pmksa_cache_entrypmksa_cache_add_okc (struct rsn_pmksa_cache *pmksa, const struct rsn_pmksa_cache_entry *old_entry, const u8 *aa, const u8 *pmkid)
 
void pmksa_cache_auth_deinit (struct rsn_pmksa_cache *pmksa)
 Free all entries in PMKSA cache. More...
 
struct rsn_pmksa_cache_entrypmksa_cache_auth_get (struct rsn_pmksa_cache *pmksa, const u8 *spa, const u8 *pmkid)
 Fetch a PMKSA cache entry. More...
 
struct rsn_pmksa_cache_entrypmksa_cache_get_okc (struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *spa, const u8 *pmkid)
 Fetch a PMKSA cache entry using OKC. More...
 
struct rsn_pmksa_cachepmksa_cache_auth_init (void(*free_cb)(struct rsn_pmksa_cache_entry *entry, void *ctx), void *ctx)
 Initialize PMKSA cache. More...
 
int pmksa_cache_auth_radius_das_disconnect (struct rsn_pmksa_cache *pmksa, struct radius_das_attrs *attr)
 

Detailed Description

hostapd - PMKSA cache for IEEE 802.11i RSN

Function Documentation

struct rsn_pmksa_cache_entry* pmksa_cache_auth_add ( struct rsn_pmksa_cache pmksa,
const u8 *  pmk,
size_t  pmk_len,
const u8 *  kck,
size_t  kck_len,
const u8 *  aa,
const u8 *  spa,
int  session_timeout,
struct eapol_state_machine eapol,
int  akmp 
)

Add a PMKSA cache entry.

Parameters
pmksaPointer to PMKSA cache data from pmksa_cache_auth_init()
pmkThe new pairwise master key
pmk_lenPMK length in bytes, usually PMK_LEN (32)
kckKey confirmation key or NULL if not yet derived
kck_lenKCK length in bytes
aaAuthenticator address
spaSupplicant address
session_timeoutSession timeout
eapolPointer to EAPOL state machine data
akmpWPA_KEY_MGMT_* used in key derivation
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 cache. If an old entry is already in the cache for the same Supplicant, this entry will be replaced with the new entry. PMKID will be calculated based on the PMK.

void pmksa_cache_auth_deinit ( struct rsn_pmksa_cache pmksa)

Free all entries in PMKSA cache.

Parameters
pmksaPointer to PMKSA cache data from pmksa_cache_auth_init()
struct rsn_pmksa_cache_entry* pmksa_cache_auth_get ( struct rsn_pmksa_cache pmksa,
const u8 *  spa,
const u8 *  pmkid 
)

Fetch a PMKSA cache entry.

Parameters
pmksaPointer to PMKSA cache data from pmksa_cache_auth_init()
spaSupplicant address or NULL to match any
pmkidPMKID or NULL to match any
Returns
Pointer to PMKSA cache entry or NULL if no match was found
struct rsn_pmksa_cache* pmksa_cache_auth_init ( void(*)(struct rsn_pmksa_cache_entry *entry, void *ctx)  free_cb,
void *  ctx 
)

Initialize PMKSA cache.

Parameters
free_cbCallback function to be called when a PMKSA cache entry is freed
ctxContext pointer for free_cb function
Returns
Pointer to PMKSA cache data or NULL on failure
struct rsn_pmksa_cache_entry* pmksa_cache_get_okc ( struct rsn_pmksa_cache pmksa,
const u8 *  aa,
const u8 *  spa,
const u8 *  pmkid 
)

Fetch a PMKSA cache entry using OKC.

Parameters
pmksaPointer to PMKSA cache data from pmksa_cache_auth_init()
aaAuthenticator address
spaSupplicant address
pmkidPMKID
Returns
Pointer to PMKSA cache entry or NULL if no match was found

Use opportunistic key caching (OKC) to find a PMK for a supplicant.