2 * wpa_supplicant - WPA2/RSN PMKSA cache functions
3 * Copyright (c) 2003-2009, 2011-2012, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
13 * struct rsn_pmksa_cache_entry - PMKSA cache entry
15 struct rsn_pmksa_cache_entry {
16 struct rsn_pmksa_cache_entry *next;
21 int akmp; /* WPA_KEY_MGMT_* */
24 os_time_t reauth_time;
27 * network_ctx - Network configuration context
29 * This field is only used to match PMKSA cache entries to a specific
30 * network configuration (e.g., a specific SSID and security policy).
31 * This can be a pointer to the configuration entry, but PMKSA caching
32 * code does not dereference the value and this could be any kind of
39 struct rsn_pmksa_cache;
41 enum pmksa_free_reason {
47 #ifdef IEEE8021X_EAPOL
49 struct rsn_pmksa_cache *
50 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
51 void *ctx, enum pmksa_free_reason reason),
52 void *ctx, struct wpa_sm *sm);
53 void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa);
54 struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa,
55 const u8 *aa, const u8 *pmkid,
56 const void *network_ctx);
57 int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len);
58 struct rsn_pmksa_cache_entry *
59 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
60 const u8 *kck, size_t kck_len,
61 const u8 *aa, const u8 *spa, void *network_ctx, int akmp);
62 struct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm);
63 void pmksa_cache_clear_current(struct wpa_sm *sm);
64 int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
65 const u8 *bssid, void *network_ctx,
66 int try_opportunistic);
67 struct rsn_pmksa_cache_entry *
68 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa,
69 void *network_ctx, const u8 *aa);
70 void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx,
71 const u8 *pmk, size_t pmk_len);
73 #else /* IEEE8021X_EAPOL */
75 static inline struct rsn_pmksa_cache *
76 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
77 void *ctx, enum pmksa_free_reason reason),
78 void *ctx, struct wpa_sm *sm)
83 static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
87 static inline struct rsn_pmksa_cache_entry *
88 pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid,
89 const void *network_ctx)
94 static inline struct rsn_pmksa_cache_entry *
95 pmksa_cache_get_current(struct wpa_sm *sm)
100 static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf,
106 static inline struct rsn_pmksa_cache_entry *
107 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
108 const u8 *kck, size_t kck_len,
109 const u8 *aa, const u8 *spa, void *network_ctx, int akmp)
114 static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
118 static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
121 int try_opportunistic)
126 static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
128 const u8 *pmk, size_t pmk_len)
132 #endif /* IEEE8021X_EAPOL */
134 #endif /* PMKSA_CACHE_H */