2008-02-28 02:34:43 +01:00
|
|
|
/*
|
|
|
|
* wpa_supplicant - WPA2/RSN PMKSA cache functions
|
2012-02-04 11:32:35 +01:00
|
|
|
* Copyright (c) 2003-2009, 2011-2012, Jouni Malinen <j@w1.fi>
|
2008-02-28 02:34:43 +01:00
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-02-28 02:34:43 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PMKSA_CACHE_H
|
|
|
|
#define PMKSA_CACHE_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct rsn_pmksa_cache_entry - PMKSA cache entry
|
|
|
|
*/
|
|
|
|
struct rsn_pmksa_cache_entry {
|
|
|
|
struct rsn_pmksa_cache_entry *next;
|
|
|
|
u8 pmkid[PMKID_LEN];
|
2015-10-14 00:18:11 +02:00
|
|
|
u8 pmk[PMK_LEN_MAX];
|
2008-02-28 02:34:43 +01:00
|
|
|
size_t pmk_len;
|
|
|
|
os_time_t expiration;
|
|
|
|
int akmp; /* WPA_KEY_MGMT_* */
|
|
|
|
u8 aa[ETH_ALEN];
|
|
|
|
|
2017-02-21 11:22:19 +01:00
|
|
|
/*
|
|
|
|
* If FILS Cache Identifier is included (fils_cache_id_set), this PMKSA
|
|
|
|
* cache entry is applicable to all BSSs (any BSSID/aa[]) that
|
|
|
|
* advertise the same FILS Cache Identifier within the same ESS.
|
|
|
|
*/
|
|
|
|
u8 fils_cache_id[2];
|
|
|
|
unsigned int fils_cache_id_set:1;
|
|
|
|
|
2008-02-28 02:34:43 +01:00
|
|
|
os_time_t reauth_time;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* network_ctx - Network configuration context
|
|
|
|
*
|
|
|
|
* This field is only used to match PMKSA cache entries to a specific
|
|
|
|
* network configuration (e.g., a specific SSID and security policy).
|
|
|
|
* This can be a pointer to the configuration entry, but PMKSA caching
|
|
|
|
* code does not dereference the value and this could be any kind of
|
|
|
|
* identifier.
|
|
|
|
*/
|
|
|
|
void *network_ctx;
|
|
|
|
int opportunistic;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rsn_pmksa_cache;
|
|
|
|
|
2012-11-25 20:27:18 +01:00
|
|
|
enum pmksa_free_reason {
|
|
|
|
PMKSA_FREE,
|
|
|
|
PMKSA_REPLACE,
|
|
|
|
PMKSA_EXPIRE,
|
|
|
|
};
|
|
|
|
|
2016-01-15 19:04:41 +01:00
|
|
|
#if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
struct rsn_pmksa_cache *
|
|
|
|
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
|
2012-11-25 20:27:18 +01:00
|
|
|
void *ctx, enum pmksa_free_reason reason),
|
2008-02-28 02:34:43 +01:00
|
|
|
void *ctx, struct wpa_sm *sm);
|
|
|
|
void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa);
|
|
|
|
struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa,
|
2012-02-04 11:32:35 +01:00
|
|
|
const u8 *aa, const u8 *pmkid,
|
|
|
|
const void *network_ctx);
|
2009-01-13 19:22:42 +01:00
|
|
|
int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len);
|
2016-12-12 22:47:04 +01:00
|
|
|
struct rsn_pmksa_cache_entry * pmksa_cache_head(struct rsn_pmksa_cache *pmksa);
|
2008-02-28 02:34:43 +01:00
|
|
|
struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
|
2016-02-15 03:23:37 +01:00
|
|
|
const u8 *pmkid, const u8 *kck, size_t kck_len,
|
2017-02-21 11:22:19 +01:00
|
|
|
const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
|
|
|
|
const u8 *cache_id);
|
2016-12-12 22:47:04 +01:00
|
|
|
struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
|
|
|
|
struct rsn_pmksa_cache_entry *entry);
|
2008-02-28 02:34:43 +01:00
|
|
|
struct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm);
|
|
|
|
void pmksa_cache_clear_current(struct wpa_sm *sm);
|
|
|
|
int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
|
|
|
|
const u8 *bssid, void *network_ctx,
|
2017-02-21 11:22:19 +01:00
|
|
|
int try_opportunistic, const u8 *fils_cache_id);
|
2008-02-28 02:34:43 +01:00
|
|
|
struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa,
|
|
|
|
void *network_ctx, const u8 *aa);
|
2013-05-22 12:24:30 +02:00
|
|
|
void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx,
|
|
|
|
const u8 *pmk, size_t pmk_len);
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2013-06-07 19:13:25 +02:00
|
|
|
#else /* IEEE8021X_EAPOL */
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
static inline struct rsn_pmksa_cache *
|
|
|
|
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
|
2013-02-03 15:23:13 +01:00
|
|
|
void *ctx, enum pmksa_free_reason reason),
|
2008-02-28 02:34:43 +01:00
|
|
|
void *ctx, struct wpa_sm *sm)
|
|
|
|
{
|
|
|
|
return (void *) -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct rsn_pmksa_cache_entry *
|
2012-02-11 09:45:24 +01:00
|
|
|
pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid,
|
|
|
|
const void *network_ctx)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_get_current(struct wpa_sm *sm)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-13 19:22:42 +01:00
|
|
|
static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf,
|
|
|
|
size_t len)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-12-14 12:33:33 +01:00
|
|
|
static inline struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_head(struct rsn_pmksa_cache *pmksa)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
|
|
|
|
struct rsn_pmksa_cache_entry *entry)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-02-28 02:34:43 +01:00
|
|
|
static inline struct rsn_pmksa_cache_entry *
|
|
|
|
pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
|
2016-02-15 03:23:37 +01:00
|
|
|
const u8 *pmkid, const u8 *kck, size_t kck_len,
|
2017-02-21 11:22:19 +01:00
|
|
|
const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
|
|
|
|
const u8 *cache_id)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
|
|
|
|
const u8 *bssid,
|
|
|
|
void *network_ctx,
|
2017-02-21 11:22:19 +01:00
|
|
|
int try_opportunistic,
|
|
|
|
const u8 *fils_cache_id)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-09-07 16:46:00 +02:00
|
|
|
static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
|
2013-06-07 19:01:10 +02:00
|
|
|
void *network_ctx,
|
|
|
|
const u8 *pmk, size_t pmk_len)
|
2011-09-07 16:46:00 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-07 19:13:25 +02:00
|
|
|
#endif /* IEEE8021X_EAPOL */
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
#endif /* PMKSA_CACHE_H */
|