wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pmksa_cache.h
Go to the documentation of this file.
1 
5 #ifndef PMKSA_CACHE_H
6 #define PMKSA_CACHE_H
7 
12 struct rsn_pmksa_cache_entry {
13  struct rsn_pmksa_cache_entry *next;
14  u8 pmkid[PMKID_LEN];
15  u8 pmk[PMK_LEN];
16  size_t pmk_len;
17  os_time_t expiration;
18  int akmp; /* WPA_KEY_MGMT_* */
19  u8 aa[ETH_ALEN];
20 
21  os_time_t reauth_time;
22 
33  void *network_ctx;
34  int opportunistic;
35 };
36 
37 struct rsn_pmksa_cache;
38 
39 enum pmksa_free_reason {
40  PMKSA_FREE,
41  PMKSA_REPLACE,
42  PMKSA_EXPIRE,
43 };
44 
45 #ifdef IEEE8021X_EAPOL
46 
47 struct rsn_pmksa_cache *
48 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
49  void *ctx, enum pmksa_free_reason reason),
50  void *ctx, struct wpa_sm *sm);
51 void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa);
53  const u8 *aa, const u8 *pmkid,
54  const void *network_ctx);
55 int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len);
56 struct rsn_pmksa_cache_entry *
57 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
58  const u8 *kck, size_t kck_len,
59  const u8 *aa, const u8 *spa, void *network_ctx, int akmp);
61 void pmksa_cache_clear_current(struct wpa_sm *sm);
62 int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
63  const u8 *bssid, void *network_ctx,
64  int try_opportunistic);
65 struct rsn_pmksa_cache_entry *
67  void *network_ctx, const u8 *aa);
68 void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx,
69  const u8 *pmk, size_t pmk_len);
70 
71 #else /* IEEE8021X_EAPOL */
72 
73 static inline struct rsn_pmksa_cache *
74 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
75  void *ctx, enum pmksa_free_reason reason),
76  void *ctx, struct wpa_sm *sm)
77 {
78  return (void *) -1;
79 }
80 
81 static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
82 {
83 }
84 
85 static inline struct rsn_pmksa_cache_entry *
86 pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid,
87  const void *network_ctx)
88 {
89  return NULL;
90 }
91 
92 static inline struct rsn_pmksa_cache_entry *
94 {
95  return NULL;
96 }
97 
98 static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf,
99  size_t len)
100 {
101  return -1;
102 }
103 
104 static inline struct rsn_pmksa_cache_entry *
105 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
106  const u8 *kck, size_t kck_len,
107  const u8 *aa, const u8 *spa, void *network_ctx, int akmp)
108 {
109  return NULL;
110 }
111 
112 static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
113 {
114 }
115 
116 static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
117  const u8 *bssid,
118  void *network_ctx,
119  int try_opportunistic)
120 {
121  return -1;
122 }
123 
124 static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
125  void *network_ctx,
126  const u8 *pmk, size_t pmk_len)
127 {
128 }
129 
130 #endif /* IEEE8021X_EAPOL */
131 
132 #endif /* PMKSA_CACHE_H */
void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx, const u8 *pmk, size_t pmk_len)
Flush PMKSA cache entries for a specific network.
Definition: pmksa_cache.c:254
struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid, const void *network_ctx)
Fetch a PMKSA cache entry.
Definition: pmksa_cache.c:318
int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len)
Dump text list of entries in PMKSA cache.
Definition: pmksa_cache.c:472
struct rsn_pmksa_cache * pmksa_cache_init(void(*free_cb)(struct rsn_pmksa_cache_entry *entry, void *ctx, enum pmksa_free_reason reason), void *ctx, struct wpa_sm *sm)
Initialize PMKSA cache.
Definition: pmksa_cache.c:517
int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, const u8 *bssid, void *network_ctx, int try_opportunistic)
Set the current PMKSA entry selection.
Definition: pmksa_cache.c:427
void pmksa_cache_clear_current(struct wpa_sm *sm)
Clear the current PMKSA entry selection.
Definition: pmksa_cache.c:410
Definition: pmksa_cache_auth.c:20
struct rsn_pmksa_cache_entry * pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa, void *network_ctx, const u8 *aa)
Try to get an opportunistic PMKSA entry.
Definition: pmksa_cache.c:369
void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
Free all entries in PMKSA cache.
Definition: pmksa_cache.c:291
struct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm)
Get the current used PMKSA entry.
Definition: pmksa_cache.c:398
void * network_ctx
Network configuration context.
Definition: pmksa_cache.h:33
struct rsn_pmksa_cache_entry * pmksa_cache_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, void *network_ctx, int akmp)
Add a PMKSA cache entry.
Definition: pmksa_cache.c:122
PMKSA cache entry.
Definition: pmksa_cache_auth.h:14
Internal WPA state machine data.
Definition: wpa_i.h:18