blob: fad5536f740e93ef369d3488e52e45c2ce547902 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * hostapd - IEEE 802.11i-2004 / WPA Authenticator
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07003 * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef WPA_AUTH_H
10#define WPA_AUTH_H
11
12#include "common/defs.h"
13#include "common/eapol_common.h"
14#include "common/wpa_common.h"
Dmitry Shmidt9d9e6022015-04-23 10:34:55 -070015#include "common/ieee802_11_defs.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070016
Roshan Pius3a1667e2018-07-03 15:17:14 -070017struct vlan_description;
18
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080019#define MAX_OWN_IE_OVERRIDE 256
20
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070021#ifdef _MSC_VER
22#pragma pack(push, 1)
23#endif /* _MSC_VER */
24
25/* IEEE Std 802.11r-2008, 11A.10.3 - Remote request/response frame definition
26 */
27struct ft_rrb_frame {
28 u8 frame_type; /* RSN_REMOTE_FRAME_TYPE_FT_RRB */
29 u8 packet_type; /* FT_PACKET_REQUEST/FT_PACKET_RESPONSE */
30 le16 action_length; /* little endian length of action_frame */
31 u8 ap_address[ETH_ALEN];
32 /*
33 * Followed by action_length bytes of FT Action frame (from Category
34 * field to the end of Action Frame body.
35 */
36} STRUCT_PACKED;
37
38#define RSN_REMOTE_FRAME_TYPE_FT_RRB 1
39
40#define FT_PACKET_REQUEST 0
41#define FT_PACKET_RESPONSE 1
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070042
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070043/* Vendor-specific types for R0KH-R1KH protocol; not defined in 802.11r. These
44 * use OUI Extended EtherType as the encapsulating format. */
45#define FT_PACKET_R0KH_R1KH_PULL 0x01
46#define FT_PACKET_R0KH_R1KH_RESP 0x02
47#define FT_PACKET_R0KH_R1KH_PUSH 0x03
48#define FT_PACKET_R0KH_R1KH_SEQ_REQ 0x04
49#define FT_PACKET_R0KH_R1KH_SEQ_RESP 0x05
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070050
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070051/* packet layout
52 * IEEE 802 extended OUI ethertype frame header
53 * u16 authlen (little endian)
54 * multiple of struct ft_rrb_tlv (authenticated only, length = authlen)
55 * multiple of struct ft_rrb_tlv (AES-SIV encrypted, AES-SIV needs an extra
56 * blocksize length)
57 *
58 * AES-SIV AAD;
59 * source MAC address (6)
60 * authenticated-only TLVs (authlen)
61 * subtype (1; FT_PACKET_*)
62 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070063
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070064#define FT_RRB_NONCE_LEN 16
65
66#define FT_RRB_LAST_EMPTY 0 /* placeholder or padding */
67
68#define FT_RRB_SEQ 1 /* struct ft_rrb_seq */
69#define FT_RRB_NONCE 2 /* size FT_RRB_NONCE_LEN */
70#define FT_RRB_TIMESTAMP 3 /* le32 unix seconds */
71
72#define FT_RRB_R0KH_ID 4 /* FT_R0KH_ID_MAX_LEN */
73#define FT_RRB_R1KH_ID 5 /* FT_R1KH_ID_LEN */
74#define FT_RRB_S1KH_ID 6 /* ETH_ALEN */
75
76#define FT_RRB_PMK_R0_NAME 7 /* WPA_PMK_NAME_LEN */
77#define FT_RRB_PMK_R0 8 /* PMK_LEN */
78#define FT_RRB_PMK_R1_NAME 9 /* WPA_PMK_NAME_LEN */
79#define FT_RRB_PMK_R1 10 /* PMK_LEN */
80
81#define FT_RRB_PAIRWISE 11 /* le16 */
Roshan Pius3a1667e2018-07-03 15:17:14 -070082#define FT_RRB_EXPIRES_IN 12 /* le16 seconds */
83
84#define FT_RRB_VLAN_UNTAGGED 13 /* le16 */
85#define FT_RRB_VLAN_TAGGED 14 /* n times le16 */
86
87#define FT_RRB_IDENTITY 15
88#define FT_RRB_RADIUS_CUI 16
89#define FT_RRB_SESSION_TIMEOUT 17 /* le32 seconds */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070090
91struct ft_rrb_tlv {
92 le16 type;
93 le16 len;
94 /* followed by data of length len */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070095} STRUCT_PACKED;
96
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070097struct ft_rrb_seq {
98 le32 dom;
99 le32 seq;
100 le32 ts;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700101} STRUCT_PACKED;
102
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700103/* session TLVs:
104 * required: PMK_R1, PMK_R1_NAME, PAIRWISE
Roshan Pius3a1667e2018-07-03 15:17:14 -0700105 * optional: VLAN_UNTAGGED, VLAN_TAGGED, EXPIRES_IN, IDENTITY, RADIUS_CUI,
106 * SESSION_TIMEOUT
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700107 *
108 * pull frame TLVs:
109 * auth:
110 * required: SEQ, NONCE, R0KH_ID, R1KH_ID
111 * encrypted:
112 * required: PMK_R0_NAME, S1KH_ID
113 *
114 * response frame TLVs:
115 * auth:
116 * required: SEQ, NONCE, R0KH_ID, R1KH_ID
117 * encrypted:
118 * required: S1KH_ID
119 * optional: session TLVs
120 *
121 * push frame TLVs:
122 * auth:
123 * required: SEQ, R0KH_ID, R1KH_ID
124 * encrypted:
125 * required: S1KH_ID, PMK_R0_NAME, session TLVs
126 *
127 * sequence number request frame TLVs:
128 * auth:
129 * required: R0KH_ID, R1KH_ID, NONCE
130 *
131 * sequence number response frame TLVs:
132 * auth:
133 * required: SEQ, NONCE, R0KH_ID, R1KH_ID
134 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700135
136#ifdef _MSC_VER
137#pragma pack(pop)
138#endif /* _MSC_VER */
139
140
141/* per STA state machine data */
142
143struct wpa_authenticator;
144struct wpa_state_machine;
145struct rsn_pmksa_cache_entry;
146struct eapol_state_machine;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700147struct ft_remote_seq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700148
149
150struct ft_remote_r0kh {
151 struct ft_remote_r0kh *next;
152 u8 addr[ETH_ALEN];
153 u8 id[FT_R0KH_ID_MAX_LEN];
154 size_t id_len;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700155 u8 key[32];
156 struct ft_remote_seq *seq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700157};
158
159
160struct ft_remote_r1kh {
161 struct ft_remote_r1kh *next;
162 u8 addr[ETH_ALEN];
163 u8 id[FT_R1KH_ID_LEN];
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700164 u8 key[32];
165 struct ft_remote_seq *seq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700166};
167
168
169struct wpa_auth_config {
170 int wpa;
171 int wpa_key_mgmt;
172 int wpa_pairwise;
173 int wpa_group;
174 int wpa_group_rekey;
175 int wpa_strict_rekey;
176 int wpa_gmk_rekey;
177 int wpa_ptk_rekey;
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800178 u32 wpa_group_update_count;
179 u32 wpa_pairwise_update_count;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700180 int wpa_disable_eapol_key_retries;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700181 int rsn_pairwise;
182 int rsn_preauth;
183 int eapol_version;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700184 int wmm_enabled;
185 int wmm_uapsd;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700186 int disable_pmksa_caching;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700187 int okc;
188 int tx_status;
189#ifdef CONFIG_IEEE80211W
190 enum mfp_options ieee80211w;
Dmitry Shmidtb36ed7c2014-03-17 10:57:26 -0700191 int group_mgmt_cipher;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700192 int sae_require_mfp;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700193#endif /* CONFIG_IEEE80211W */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800194#ifdef CONFIG_IEEE80211R_AP
Dmitry Shmidt9d9e6022015-04-23 10:34:55 -0700195 u8 ssid[SSID_MAX_LEN];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700196 size_t ssid_len;
197 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
198 u8 r0_key_holder[FT_R0KH_ID_MAX_LEN];
199 size_t r0_key_holder_len;
200 u8 r1_key_holder[FT_R1KH_ID_LEN];
Roshan Pius3a1667e2018-07-03 15:17:14 -0700201 u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700202 int rkh_pos_timeout;
203 int rkh_neg_timeout;
204 int rkh_pull_timeout; /* ms */
205 int rkh_pull_retries;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700206 int r1_max_key_lifetime;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700207 u32 reassociation_deadline;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700208 struct ft_remote_r0kh **r0kh_list;
209 struct ft_remote_r1kh **r1kh_list;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700210 int pmk_r1_push;
211 int ft_over_ds;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800212 int ft_psk_generate_local;
213#endif /* CONFIG_IEEE80211R_AP */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700214 int disable_gtk;
215 int ap_mlme;
Dmitry Shmidt51b6ea82013-05-08 10:42:09 -0700216#ifdef CONFIG_TESTING_OPTIONS
217 double corrupt_gtk_rekey_mic_probability;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800218 u8 own_ie_override[MAX_OWN_IE_OVERRIDE];
219 size_t own_ie_override_len;
Dmitry Shmidt51b6ea82013-05-08 10:42:09 -0700220#endif /* CONFIG_TESTING_OPTIONS */
Dmitry Shmidtcf32e602014-01-28 10:57:39 -0800221#ifdef CONFIG_P2P
222 u8 ip_addr_go[4];
223 u8 ip_addr_mask[4];
224 u8 ip_addr_start[4];
225 u8 ip_addr_end[4];
226#endif /* CONFIG_P2P */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700227#ifdef CONFIG_FILS
228 unsigned int fils_cache_id_set:1;
229 u8 fils_cache_id[FILS_CACHE_ID_LEN];
230#endif /* CONFIG_FILS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700231};
232
233typedef enum {
234 LOGGER_DEBUG, LOGGER_INFO, LOGGER_WARNING
235} logger_level;
236
237typedef enum {
238 WPA_EAPOL_portEnabled, WPA_EAPOL_portValid, WPA_EAPOL_authorized,
239 WPA_EAPOL_portControl_Auto, WPA_EAPOL_keyRun, WPA_EAPOL_keyAvailable,
240 WPA_EAPOL_keyDone, WPA_EAPOL_inc_EapolFramesTx
241} wpa_eapol_variable;
242
243struct wpa_auth_callbacks {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700244 void (*logger)(void *ctx, const u8 *addr, logger_level level,
245 const char *txt);
246 void (*disconnect)(void *ctx, const u8 *addr, u16 reason);
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800247 int (*mic_failure_report)(void *ctx, const u8 *addr);
Dmitry Shmidtdda10c22015-03-24 16:05:01 -0700248 void (*psk_failure_report)(void *ctx, const u8 *addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700249 void (*set_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var,
250 int value);
251 int (*get_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var);
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700252 const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *p2p_dev_addr,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700253 const u8 *prev_psk, size_t *psk_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700254 int (*get_msk)(void *ctx, const u8 *addr, u8 *msk, size_t *len);
255 int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg,
256 const u8 *addr, int idx, u8 *key, size_t key_len);
257 int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq);
258 int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data,
259 size_t data_len, int encrypt);
260 int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm,
261 void *ctx), void *cb_ctx);
262 int (*for_each_auth)(void *ctx, int (*cb)(struct wpa_authenticator *a,
263 void *ctx), void *cb_ctx);
264 int (*send_ether)(void *ctx, const u8 *dst, u16 proto, const u8 *data,
265 size_t data_len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700266 int (*send_oui)(void *ctx, const u8 *dst, u8 oui_suffix, const u8 *data,
267 size_t data_len);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800268#ifdef CONFIG_IEEE80211R_AP
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700269 struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700270 int (*set_vlan)(void *ctx, const u8 *sta_addr,
271 struct vlan_description *vlan);
272 int (*get_vlan)(void *ctx, const u8 *sta_addr,
273 struct vlan_description *vlan);
274 int (*set_identity)(void *ctx, const u8 *sta_addr,
275 const u8 *identity, size_t identity_len);
276 size_t (*get_identity)(void *ctx, const u8 *sta_addr, const u8 **buf);
277 int (*set_radius_cui)(void *ctx, const u8 *sta_addr,
278 const u8 *radius_cui, size_t radius_cui_len);
279 size_t (*get_radius_cui)(void *ctx, const u8 *sta_addr, const u8 **buf);
280 void (*set_session_timeout)(void *ctx, const u8 *sta_addr,
281 int session_timeout);
282 int (*get_session_timeout)(void *ctx, const u8 *sta_addr);
283
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700284 int (*send_ft_action)(void *ctx, const u8 *dst,
285 const u8 *data, size_t data_len);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700286 int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie,
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800287 size_t tspec_ielen);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800288#endif /* CONFIG_IEEE80211R_AP */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800289#ifdef CONFIG_MESH
290 int (*start_ampe)(void *ctx, const u8 *sta_addr);
291#endif /* CONFIG_MESH */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700292};
293
294struct wpa_authenticator * wpa_init(const u8 *addr,
295 struct wpa_auth_config *conf,
Paul Stewart092955c2017-02-06 09:13:09 -0800296 const struct wpa_auth_callbacks *cb,
297 void *cb_ctx);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800298int wpa_init_keys(struct wpa_authenticator *wpa_auth);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700299void wpa_deinit(struct wpa_authenticator *wpa_auth);
300int wpa_reconfig(struct wpa_authenticator *wpa_auth,
301 struct wpa_auth_config *conf);
302
303enum {
304 WPA_IE_OK, WPA_INVALID_IE, WPA_INVALID_GROUP, WPA_INVALID_PAIRWISE,
305 WPA_INVALID_AKMP, WPA_NOT_ENABLED, WPA_ALLOC_FAIL,
306 WPA_MGMT_FRAME_PROTECTION_VIOLATION, WPA_INVALID_MGMT_GROUP_CIPHER,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700307 WPA_INVALID_MDIE, WPA_INVALID_PROTO, WPA_INVALID_PMKID
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700308};
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800309
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700310int wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
311 struct wpa_state_machine *sm,
312 const u8 *wpa_ie, size_t wpa_ie_len,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700313 const u8 *mdie, size_t mdie_len,
314 const u8 *owe_dh, size_t owe_dh_len);
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800315int wpa_validate_osen(struct wpa_authenticator *wpa_auth,
316 struct wpa_state_machine *sm,
317 const u8 *osen_ie, size_t osen_ie_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700318int wpa_auth_uses_mfp(struct wpa_state_machine *sm);
319struct wpa_state_machine *
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700320wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr,
321 const u8 *p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700322int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
323 struct wpa_state_machine *sm);
324void wpa_auth_sta_no_wpa(struct wpa_state_machine *sm);
325void wpa_auth_sta_deinit(struct wpa_state_machine *sm);
326void wpa_receive(struct wpa_authenticator *wpa_auth,
327 struct wpa_state_machine *sm,
328 u8 *data, size_t data_len);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800329enum wpa_event {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700330 WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700331 WPA_REAUTH_EAPOL, WPA_ASSOC_FT, WPA_ASSOC_FILS, WPA_DRV_STA_REMOVED
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800332};
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700333void wpa_remove_ptk(struct wpa_state_machine *sm);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800334int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700335void wpa_auth_sm_notify(struct wpa_state_machine *sm);
336void wpa_gtk_rekey(struct wpa_authenticator *wpa_auth);
337int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen);
338int wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen);
339void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth);
340int wpa_auth_pairwise_set(struct wpa_state_machine *sm);
341int wpa_auth_get_pairwise(struct wpa_state_machine *sm);
342int wpa_auth_sta_key_mgmt(struct wpa_state_machine *sm);
343int wpa_auth_sta_wpa_version(struct wpa_state_machine *sm);
Mathy Vanhoeff6e1f662017-07-14 15:15:35 +0200344int wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700345int wpa_auth_sta_fils_tk_already_set(struct wpa_state_machine *sm);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700346int wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm,
347 struct rsn_pmksa_cache_entry *entry);
348struct rsn_pmksa_cache_entry *
349wpa_auth_sta_get_pmksa(struct wpa_state_machine *sm);
350void wpa_auth_sta_local_mic_failure_report(struct wpa_state_machine *sm);
351const u8 * wpa_auth_get_wpa_ie(struct wpa_authenticator *wpa_auth,
352 size_t *len);
353int wpa_auth_pmksa_add(struct wpa_state_machine *sm, const u8 *pmk,
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800354 unsigned int pmk_len,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700355 int session_timeout, struct eapol_state_machine *eapol);
356int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth,
357 const u8 *pmk, size_t len, const u8 *sta_addr,
358 int session_timeout,
359 struct eapol_state_machine *eapol);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800360int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr,
Dmitry Shmidt57c2d392016-02-23 13:40:19 -0800361 const u8 *pmk, const u8 *pmkid);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700362void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700363int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr,
364 const u8 *pmk, size_t pmk_len, const u8 *pmkid,
365 int session_timeout, int akmp);
Dmitry Shmidtf7e0a992013-05-23 11:03:10 -0700366void wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth,
367 const u8 *sta_addr);
Dmitry Shmidte4663042016-04-04 10:07:49 -0700368int wpa_auth_pmksa_list(struct wpa_authenticator *wpa_auth, char *buf,
369 size_t len);
370void wpa_auth_pmksa_flush(struct wpa_authenticator *wpa_auth);
Paul Stewart092955c2017-02-06 09:13:09 -0800371int wpa_auth_pmksa_list_mesh(struct wpa_authenticator *wpa_auth, const u8 *addr,
372 char *buf, size_t len);
373struct rsn_pmksa_cache_entry *
374wpa_auth_pmksa_create_entry(const u8 *aa, const u8 *spa, const u8 *pmk,
375 const u8 *pmkid, int expiration);
376int wpa_auth_pmksa_add_entry(struct wpa_authenticator *wpa_auth,
377 struct rsn_pmksa_cache_entry *entry);
Dmitry Shmidte4663042016-04-04 10:07:49 -0700378struct rsn_pmksa_cache_entry *
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800379wpa_auth_pmksa_get(struct wpa_authenticator *wpa_auth, const u8 *sta_addr,
380 const u8 *pmkid);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700381struct rsn_pmksa_cache_entry *
382wpa_auth_pmksa_get_fils_cache_id(struct wpa_authenticator *wpa_auth,
383 const u8 *sta_addr, const u8 *pmkid);
Dmitry Shmidte4663042016-04-04 10:07:49 -0700384void wpa_auth_pmksa_set_to_sm(struct rsn_pmksa_cache_entry *pmksa,
385 struct wpa_state_machine *sm,
386 struct wpa_authenticator *wpa_auth,
387 u8 *pmkid, u8 *pmk);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700388int wpa_auth_sta_set_vlan(struct wpa_state_machine *sm, int vlan_id);
389void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
390 struct wpa_state_machine *sm, int ack);
391
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800392#ifdef CONFIG_IEEE80211R_AP
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700393u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
394 size_t max_len, int auth_alg,
395 const u8 *req_ies, size_t req_ies_len);
396void wpa_ft_process_auth(struct wpa_state_machine *sm, const u8 *bssid,
397 u16 auth_transaction, const u8 *ies, size_t ies_len,
398 void (*cb)(void *ctx, const u8 *dst, const u8 *bssid,
399 u16 auth_transaction, u16 resp,
400 const u8 *ies, size_t ies_len),
401 void *ctx);
402u16 wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies,
403 size_t ies_len);
404int wpa_ft_action_rx(struct wpa_state_machine *sm, const u8 *data, size_t len);
405int wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
406 const u8 *data, size_t data_len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700407void wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
408 const u8 *dst_addr, u8 oui_suffix, const u8 *data,
409 size_t data_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700410void wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700411void wpa_ft_deinit(struct wpa_authenticator *wpa_auth);
412void wpa_ft_sta_deinit(struct wpa_state_machine *sm);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800413#endif /* CONFIG_IEEE80211R_AP */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700414
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700415void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm);
416void wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag);
417int wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700418int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700419
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800420int wpa_auth_uses_sae(struct wpa_state_machine *sm);
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800421int wpa_auth_uses_ft_sae(struct wpa_state_machine *sm);
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800422
Dmitry Shmidtcf32e602014-01-28 10:57:39 -0800423int wpa_auth_get_ip_addr(struct wpa_state_machine *sm, u8 *addr);
424
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800425struct radius_das_attrs;
426int wpa_auth_radius_das_disconnect_pmksa(struct wpa_authenticator *wpa_auth,
427 struct radius_das_attrs *attr);
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800428void wpa_auth_reconfig_group_keys(struct wpa_authenticator *wpa_auth);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800429
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800430int wpa_auth_ensure_group(struct wpa_authenticator *wpa_auth, int vlan_id);
431int wpa_auth_release_group(struct wpa_authenticator *wpa_auth, int vlan_id);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800432int fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700433 size_t pmk_len, const u8 *snonce, const u8 *anonce,
434 const u8 *dhss, size_t dhss_len,
435 struct wpabuf *g_sta, struct wpabuf *g_ap);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800436int fils_decrypt_assoc(struct wpa_state_machine *sm, const u8 *fils_session,
437 const struct ieee80211_mgmt *mgmt, size_t frame_len,
438 u8 *pos, size_t left);
439int fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf,
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800440 size_t current_len, size_t max_len,
441 const struct wpabuf *hlp);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800442int fils_set_tk(struct wpa_state_machine *sm);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700443u8 * hostapd_eid_assoc_fils_session(struct wpa_state_machine *sm, u8 *eid,
444 const u8 *fils_session,
445 struct wpabuf *fils_hlp_resp);
446const u8 * wpa_fils_validate_fils_session(struct wpa_state_machine *sm,
447 const u8 *ies, size_t ies_len,
448 const u8 *fils_session);
449int wpa_fils_validate_key_confirm(struct wpa_state_machine *sm, const u8 *ies,
450 size_t ies_len);
451
Roshan Pius3a1667e2018-07-03 15:17:14 -0700452int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth, int use_sha384,
453 u8 *buf, size_t len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700454void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm,
455 u8 *fils_anonce, u8 *fils_snonce,
456 u8 *fils_kek, size_t *fils_kek_len);
457u8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm,
458 u8 *pos, size_t max_len,
459 const u8 *req_ies, size_t req_ies_len);
460
461int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce,
462 void (*cb)(void *ctx1, void *ctx2),
463 void *ctx1, void *ctx2);
464int wpa_auth_resend_m3(struct wpa_state_machine *sm,
465 void (*cb)(void *ctx1, void *ctx2),
466 void *ctx1, void *ctx2);
467int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
468 void (*cb)(void *ctx1, void *ctx2),
469 void *ctx1, void *ctx2);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700470int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800471
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700472#endif /* WPA_AUTH_H */