pmksa_cache_auth.h revision 214501
1/*
2 * hostapd - PMKSA cache for IEEE 802.11i RSN
3 * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef PMKSA_CACHE_H
16#define PMKSA_CACHE_H
17
18#include "radius/radius.h"
19
20/**
21 * struct rsn_pmksa_cache_entry - PMKSA cache entry
22 */
23struct rsn_pmksa_cache_entry {
24	struct rsn_pmksa_cache_entry *next, *hnext;
25	u8 pmkid[PMKID_LEN];
26	u8 pmk[PMK_LEN];
27	size_t pmk_len;
28	os_time_t expiration;
29	int akmp; /* WPA_KEY_MGMT_* */
30	u8 spa[ETH_ALEN];
31
32	u8 *identity;
33	size_t identity_len;
34	struct radius_class_data radius_class;
35	u8 eap_type_authsrv;
36	int vlan_id;
37	int opportunistic;
38};
39
40struct rsn_pmksa_cache;
41
42struct rsn_pmksa_cache *
43pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
44				      void *ctx), void *ctx);
45void pmksa_cache_auth_deinit(struct rsn_pmksa_cache *pmksa);
46struct rsn_pmksa_cache_entry *
47pmksa_cache_auth_get(struct rsn_pmksa_cache *pmksa,
48		     const u8 *spa, const u8 *pmkid);
49struct rsn_pmksa_cache_entry * pmksa_cache_get_okc(
50	struct rsn_pmksa_cache *pmksa, const u8 *spa, const u8 *aa,
51	const u8 *pmkid);
52struct rsn_pmksa_cache_entry *
53pmksa_cache_auth_add(struct rsn_pmksa_cache *pmksa,
54		     const u8 *pmk, size_t pmk_len,
55		     const u8 *aa, const u8 *spa, int session_timeout,
56		     struct eapol_state_machine *eapol, int akmp);
57struct rsn_pmksa_cache_entry *
58pmksa_cache_add_okc(struct rsn_pmksa_cache *pmksa,
59		    const struct rsn_pmksa_cache_entry *old_entry,
60		    const u8 *aa, const u8 *pmkid);
61void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
62			       struct eapol_state_machine *eapol);
63
64#endif /* PMKSA_CACHE_H */
65