1214501Srpaulo/* 2214501Srpaulo * hostapd - IEEE 802.11i-2004 / WPA Authenticator 3346981Scy * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi> 4214501Srpaulo * 5252726Srpaulo * This software may be distributed under the terms of the BSD license. 6252726Srpaulo * See README for more details. 7214501Srpaulo */ 8214501Srpaulo 9214501Srpaulo#ifndef WPA_AUTH_H 10214501Srpaulo#define WPA_AUTH_H 11214501Srpaulo 12214501Srpaulo#include "common/defs.h" 13214501Srpaulo#include "common/eapol_common.h" 14214501Srpaulo#include "common/wpa_common.h" 15289549Srpaulo#include "common/ieee802_11_defs.h" 16214501Srpaulo 17346981Scystruct vlan_description; 18346981Scy 19289549Srpaulo#define MAX_OWN_IE_OVERRIDE 256 20289549Srpaulo 21214501Srpaulo#ifdef _MSC_VER 22214501Srpaulo#pragma pack(push, 1) 23214501Srpaulo#endif /* _MSC_VER */ 24214501Srpaulo 25214501Srpaulo/* IEEE Std 802.11r-2008, 11A.10.3 - Remote request/response frame definition 26214501Srpaulo */ 27214501Srpaulostruct ft_rrb_frame { 28214501Srpaulo u8 frame_type; /* RSN_REMOTE_FRAME_TYPE_FT_RRB */ 29214501Srpaulo u8 packet_type; /* FT_PACKET_REQUEST/FT_PACKET_RESPONSE */ 30214501Srpaulo le16 action_length; /* little endian length of action_frame */ 31214501Srpaulo u8 ap_address[ETH_ALEN]; 32214501Srpaulo /* 33214501Srpaulo * Followed by action_length bytes of FT Action frame (from Category 34214501Srpaulo * field to the end of Action Frame body. 35214501Srpaulo */ 36214501Srpaulo} STRUCT_PACKED; 37214501Srpaulo 38214501Srpaulo#define RSN_REMOTE_FRAME_TYPE_FT_RRB 1 39214501Srpaulo 40214501Srpaulo#define FT_PACKET_REQUEST 0 41214501Srpaulo#define FT_PACKET_RESPONSE 1 42214501Srpaulo 43346981Scy/* Vendor-specific types for R0KH-R1KH protocol; not defined in 802.11r. These 44346981Scy * use OUI Extended EtherType as the encapsulating format. */ 45346981Scy#define FT_PACKET_R0KH_R1KH_PULL 0x01 46346981Scy#define FT_PACKET_R0KH_R1KH_RESP 0x02 47346981Scy#define FT_PACKET_R0KH_R1KH_PUSH 0x03 48346981Scy#define FT_PACKET_R0KH_R1KH_SEQ_REQ 0x04 49346981Scy#define FT_PACKET_R0KH_R1KH_SEQ_RESP 0x05 50214501Srpaulo 51346981Scy/* packet layout 52346981Scy * IEEE 802 extended OUI ethertype frame header 53346981Scy * u16 authlen (little endian) 54346981Scy * multiple of struct ft_rrb_tlv (authenticated only, length = authlen) 55346981Scy * multiple of struct ft_rrb_tlv (AES-SIV encrypted, AES-SIV needs an extra 56346981Scy * blocksize length) 57346981Scy * 58346981Scy * AES-SIV AAD; 59346981Scy * source MAC address (6) 60346981Scy * authenticated-only TLVs (authlen) 61346981Scy * subtype (1; FT_PACKET_*) 62346981Scy */ 63214501Srpaulo 64346981Scy#define FT_RRB_NONCE_LEN 16 65214501Srpaulo 66346981Scy#define FT_RRB_LAST_EMPTY 0 /* placeholder or padding */ 67214501Srpaulo 68346981Scy#define FT_RRB_SEQ 1 /* struct ft_rrb_seq */ 69346981Scy#define FT_RRB_NONCE 2 /* size FT_RRB_NONCE_LEN */ 70346981Scy#define FT_RRB_TIMESTAMP 3 /* le32 unix seconds */ 71214501Srpaulo 72346981Scy#define FT_RRB_R0KH_ID 4 /* FT_R0KH_ID_MAX_LEN */ 73346981Scy#define FT_RRB_R1KH_ID 5 /* FT_R1KH_ID_LEN */ 74346981Scy#define FT_RRB_S1KH_ID 6 /* ETH_ALEN */ 75214501Srpaulo 76346981Scy#define FT_RRB_PMK_R0_NAME 7 /* WPA_PMK_NAME_LEN */ 77346981Scy#define FT_RRB_PMK_R0 8 /* PMK_LEN */ 78346981Scy#define FT_RRB_PMK_R1_NAME 9 /* WPA_PMK_NAME_LEN */ 79346981Scy#define FT_RRB_PMK_R1 10 /* PMK_LEN */ 80346981Scy 81346981Scy#define FT_RRB_PAIRWISE 11 /* le16 */ 82346981Scy#define FT_RRB_EXPIRES_IN 12 /* le16 seconds */ 83346981Scy 84346981Scy#define FT_RRB_VLAN_UNTAGGED 13 /* le16 */ 85346981Scy#define FT_RRB_VLAN_TAGGED 14 /* n times le16 */ 86346981Scy 87346981Scy#define FT_RRB_IDENTITY 15 88346981Scy#define FT_RRB_RADIUS_CUI 16 89346981Scy#define FT_RRB_SESSION_TIMEOUT 17 /* le32 seconds */ 90346981Scy 91346981Scystruct ft_rrb_tlv { 92346981Scy le16 type; 93346981Scy le16 len; 94346981Scy /* followed by data of length len */ 95214501Srpaulo} STRUCT_PACKED; 96214501Srpaulo 97346981Scystruct ft_rrb_seq { 98346981Scy le32 dom; 99346981Scy le32 seq; 100346981Scy le32 ts; 101346981Scy} STRUCT_PACKED; 102346981Scy 103346981Scy/* session TLVs: 104346981Scy * required: PMK_R1, PMK_R1_NAME, PAIRWISE 105346981Scy * optional: VLAN_UNTAGGED, VLAN_TAGGED, EXPIRES_IN, IDENTITY, RADIUS_CUI, 106346981Scy * SESSION_TIMEOUT 107346981Scy * 108346981Scy * pull frame TLVs: 109346981Scy * auth: 110346981Scy * required: SEQ, NONCE, R0KH_ID, R1KH_ID 111346981Scy * encrypted: 112346981Scy * required: PMK_R0_NAME, S1KH_ID 113346981Scy * 114346981Scy * response frame TLVs: 115346981Scy * auth: 116346981Scy * required: SEQ, NONCE, R0KH_ID, R1KH_ID 117346981Scy * encrypted: 118346981Scy * required: S1KH_ID 119346981Scy * optional: session TLVs 120346981Scy * 121346981Scy * push frame TLVs: 122346981Scy * auth: 123346981Scy * required: SEQ, R0KH_ID, R1KH_ID 124346981Scy * encrypted: 125346981Scy * required: S1KH_ID, PMK_R0_NAME, session TLVs 126346981Scy * 127346981Scy * sequence number request frame TLVs: 128346981Scy * auth: 129346981Scy * required: R0KH_ID, R1KH_ID, NONCE 130346981Scy * 131346981Scy * sequence number response frame TLVs: 132346981Scy * auth: 133346981Scy * required: SEQ, NONCE, R0KH_ID, R1KH_ID 134346981Scy */ 135346981Scy 136214501Srpaulo#ifdef _MSC_VER 137214501Srpaulo#pragma pack(pop) 138214501Srpaulo#endif /* _MSC_VER */ 139214501Srpaulo 140214501Srpaulo 141214501Srpaulo/* per STA state machine data */ 142214501Srpaulo 143214501Srpaulostruct wpa_authenticator; 144214501Srpaulostruct wpa_state_machine; 145214501Srpaulostruct rsn_pmksa_cache_entry; 146214501Srpaulostruct eapol_state_machine; 147346981Scystruct ft_remote_seq; 148346981Scystruct wpa_channel_info; 149214501Srpaulo 150214501Srpaulo 151214501Srpaulostruct ft_remote_r0kh { 152214501Srpaulo struct ft_remote_r0kh *next; 153214501Srpaulo u8 addr[ETH_ALEN]; 154214501Srpaulo u8 id[FT_R0KH_ID_MAX_LEN]; 155214501Srpaulo size_t id_len; 156346981Scy u8 key[32]; 157346981Scy struct ft_remote_seq *seq; 158214501Srpaulo}; 159214501Srpaulo 160214501Srpaulo 161214501Srpaulostruct ft_remote_r1kh { 162214501Srpaulo struct ft_remote_r1kh *next; 163214501Srpaulo u8 addr[ETH_ALEN]; 164214501Srpaulo u8 id[FT_R1KH_ID_LEN]; 165346981Scy u8 key[32]; 166346981Scy struct ft_remote_seq *seq; 167214501Srpaulo}; 168214501Srpaulo 169214501Srpaulo 170214501Srpaulostruct wpa_auth_config { 171214501Srpaulo int wpa; 172214501Srpaulo int wpa_key_mgmt; 173214501Srpaulo int wpa_pairwise; 174214501Srpaulo int wpa_group; 175214501Srpaulo int wpa_group_rekey; 176214501Srpaulo int wpa_strict_rekey; 177214501Srpaulo int wpa_gmk_rekey; 178214501Srpaulo int wpa_ptk_rekey; 179346981Scy u32 wpa_group_update_count; 180346981Scy u32 wpa_pairwise_update_count; 181346981Scy int wpa_disable_eapol_key_retries; 182214501Srpaulo int rsn_pairwise; 183214501Srpaulo int rsn_preauth; 184214501Srpaulo int eapol_version; 185214501Srpaulo int wmm_enabled; 186214501Srpaulo int wmm_uapsd; 187252726Srpaulo int disable_pmksa_caching; 188214501Srpaulo int okc; 189252726Srpaulo int tx_status; 190214501Srpaulo#ifdef CONFIG_IEEE80211W 191214501Srpaulo enum mfp_options ieee80211w; 192281806Srpaulo int group_mgmt_cipher; 193346981Scy int sae_require_mfp; 194214501Srpaulo#endif /* CONFIG_IEEE80211W */ 195346981Scy#ifdef CONFIG_OCV 196346981Scy int ocv; /* Operating Channel Validation */ 197346981Scy#endif /* CONFIG_OCV */ 198346981Scy#ifdef CONFIG_IEEE80211R_AP 199289549Srpaulo u8 ssid[SSID_MAX_LEN]; 200214501Srpaulo size_t ssid_len; 201214501Srpaulo u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN]; 202214501Srpaulo u8 r0_key_holder[FT_R0KH_ID_MAX_LEN]; 203214501Srpaulo size_t r0_key_holder_len; 204214501Srpaulo u8 r1_key_holder[FT_R1KH_ID_LEN]; 205346981Scy u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */ 206346981Scy int rkh_pos_timeout; 207346981Scy int rkh_neg_timeout; 208346981Scy int rkh_pull_timeout; /* ms */ 209346981Scy int rkh_pull_retries; 210346981Scy int r1_max_key_lifetime; 211214501Srpaulo u32 reassociation_deadline; 212346981Scy struct ft_remote_r0kh **r0kh_list; 213346981Scy struct ft_remote_r1kh **r1kh_list; 214214501Srpaulo int pmk_r1_push; 215252726Srpaulo int ft_over_ds; 216346981Scy int ft_psk_generate_local; 217346981Scy#endif /* CONFIG_IEEE80211R_AP */ 218252726Srpaulo int disable_gtk; 219252726Srpaulo int ap_mlme; 220281806Srpaulo#ifdef CONFIG_TESTING_OPTIONS 221281806Srpaulo double corrupt_gtk_rekey_mic_probability; 222289549Srpaulo u8 own_ie_override[MAX_OWN_IE_OVERRIDE]; 223289549Srpaulo size_t own_ie_override_len; 224281806Srpaulo#endif /* CONFIG_TESTING_OPTIONS */ 225281806Srpaulo#ifdef CONFIG_P2P 226281806Srpaulo u8 ip_addr_go[4]; 227281806Srpaulo u8 ip_addr_mask[4]; 228281806Srpaulo u8 ip_addr_start[4]; 229281806Srpaulo u8 ip_addr_end[4]; 230281806Srpaulo#endif /* CONFIG_P2P */ 231346981Scy#ifdef CONFIG_FILS 232346981Scy unsigned int fils_cache_id_set:1; 233346981Scy u8 fils_cache_id[FILS_CACHE_ID_LEN]; 234346981Scy#endif /* CONFIG_FILS */ 235214501Srpaulo}; 236214501Srpaulo 237214501Srpaulotypedef enum { 238214501Srpaulo LOGGER_DEBUG, LOGGER_INFO, LOGGER_WARNING 239214501Srpaulo} logger_level; 240214501Srpaulo 241214501Srpaulotypedef enum { 242214501Srpaulo WPA_EAPOL_portEnabled, WPA_EAPOL_portValid, WPA_EAPOL_authorized, 243214501Srpaulo WPA_EAPOL_portControl_Auto, WPA_EAPOL_keyRun, WPA_EAPOL_keyAvailable, 244214501Srpaulo WPA_EAPOL_keyDone, WPA_EAPOL_inc_EapolFramesTx 245214501Srpaulo} wpa_eapol_variable; 246214501Srpaulo 247214501Srpaulostruct wpa_auth_callbacks { 248214501Srpaulo void (*logger)(void *ctx, const u8 *addr, logger_level level, 249214501Srpaulo const char *txt); 250214501Srpaulo void (*disconnect)(void *ctx, const u8 *addr, u16 reason); 251252726Srpaulo int (*mic_failure_report)(void *ctx, const u8 *addr); 252289549Srpaulo void (*psk_failure_report)(void *ctx, const u8 *addr); 253214501Srpaulo void (*set_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var, 254214501Srpaulo int value); 255214501Srpaulo int (*get_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var); 256281806Srpaulo const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *p2p_dev_addr, 257346981Scy const u8 *prev_psk, size_t *psk_len, 258346981Scy int *vlan_id); 259214501Srpaulo int (*get_msk)(void *ctx, const u8 *addr, u8 *msk, size_t *len); 260214501Srpaulo int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg, 261214501Srpaulo const u8 *addr, int idx, u8 *key, size_t key_len); 262214501Srpaulo int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq); 263214501Srpaulo int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data, 264214501Srpaulo size_t data_len, int encrypt); 265214501Srpaulo int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm, 266214501Srpaulo void *ctx), void *cb_ctx); 267214501Srpaulo int (*for_each_auth)(void *ctx, int (*cb)(struct wpa_authenticator *a, 268214501Srpaulo void *ctx), void *cb_ctx); 269214501Srpaulo int (*send_ether)(void *ctx, const u8 *dst, u16 proto, const u8 *data, 270214501Srpaulo size_t data_len); 271346981Scy int (*send_oui)(void *ctx, const u8 *dst, u8 oui_suffix, const u8 *data, 272346981Scy size_t data_len); 273346981Scy int (*channel_info)(void *ctx, struct wpa_channel_info *ci); 274346981Scy int (*update_vlan)(void *ctx, const u8 *addr, int vlan_id); 275346981Scy int (*get_sta_tx_params)(void *ctx, const u8 *addr, 276346981Scy int ap_max_chanwidth, int ap_seg1_idx, 277346981Scy int *bandwidth, int *seg1_idx); 278346981Scy#ifdef CONFIG_IEEE80211R_AP 279214501Srpaulo struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr); 280346981Scy int (*set_vlan)(void *ctx, const u8 *sta_addr, 281346981Scy struct vlan_description *vlan); 282346981Scy int (*get_vlan)(void *ctx, const u8 *sta_addr, 283346981Scy struct vlan_description *vlan); 284346981Scy int (*set_identity)(void *ctx, const u8 *sta_addr, 285346981Scy const u8 *identity, size_t identity_len); 286346981Scy size_t (*get_identity)(void *ctx, const u8 *sta_addr, const u8 **buf); 287346981Scy int (*set_radius_cui)(void *ctx, const u8 *sta_addr, 288346981Scy const u8 *radius_cui, size_t radius_cui_len); 289346981Scy size_t (*get_radius_cui)(void *ctx, const u8 *sta_addr, const u8 **buf); 290346981Scy void (*set_session_timeout)(void *ctx, const u8 *sta_addr, 291346981Scy int session_timeout); 292346981Scy int (*get_session_timeout)(void *ctx, const u8 *sta_addr); 293346981Scy 294214501Srpaulo int (*send_ft_action)(void *ctx, const u8 *dst, 295214501Srpaulo const u8 *data, size_t data_len); 296252726Srpaulo int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie, 297281806Srpaulo size_t tspec_ielen); 298346981Scy#endif /* CONFIG_IEEE80211R_AP */ 299281806Srpaulo#ifdef CONFIG_MESH 300281806Srpaulo int (*start_ampe)(void *ctx, const u8 *sta_addr); 301281806Srpaulo#endif /* CONFIG_MESH */ 302214501Srpaulo}; 303214501Srpaulo 304214501Srpaulostruct wpa_authenticator * wpa_init(const u8 *addr, 305214501Srpaulo struct wpa_auth_config *conf, 306346981Scy const struct wpa_auth_callbacks *cb, 307346981Scy void *cb_ctx); 308252726Srpauloint wpa_init_keys(struct wpa_authenticator *wpa_auth); 309214501Srpaulovoid wpa_deinit(struct wpa_authenticator *wpa_auth); 310214501Srpauloint wpa_reconfig(struct wpa_authenticator *wpa_auth, 311214501Srpaulo struct wpa_auth_config *conf); 312214501Srpaulo 313214501Srpauloenum { 314214501Srpaulo WPA_IE_OK, WPA_INVALID_IE, WPA_INVALID_GROUP, WPA_INVALID_PAIRWISE, 315214501Srpaulo WPA_INVALID_AKMP, WPA_NOT_ENABLED, WPA_ALLOC_FAIL, 316214501Srpaulo WPA_MGMT_FRAME_PROTECTION_VIOLATION, WPA_INVALID_MGMT_GROUP_CIPHER, 317346981Scy WPA_INVALID_MDIE, WPA_INVALID_PROTO, WPA_INVALID_PMKID 318214501Srpaulo}; 319346981Scy 320214501Srpauloint wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth, 321346981Scy struct wpa_state_machine *sm, int freq, 322214501Srpaulo const u8 *wpa_ie, size_t wpa_ie_len, 323346981Scy const u8 *mdie, size_t mdie_len, 324346981Scy const u8 *owe_dh, size_t owe_dh_len); 325281806Srpauloint wpa_validate_osen(struct wpa_authenticator *wpa_auth, 326281806Srpaulo struct wpa_state_machine *sm, 327281806Srpaulo const u8 *osen_ie, size_t osen_ie_len); 328214501Srpauloint wpa_auth_uses_mfp(struct wpa_state_machine *sm); 329346981Scyvoid wpa_auth_set_ocv(struct wpa_state_machine *sm, int ocv); 330346981Scyint wpa_auth_uses_ocv(struct wpa_state_machine *sm); 331214501Srpaulostruct wpa_state_machine * 332281806Srpaulowpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr, 333281806Srpaulo const u8 *p2p_dev_addr); 334214501Srpauloint wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth, 335214501Srpaulo struct wpa_state_machine *sm); 336214501Srpaulovoid wpa_auth_sta_no_wpa(struct wpa_state_machine *sm); 337214501Srpaulovoid wpa_auth_sta_deinit(struct wpa_state_machine *sm); 338214501Srpaulovoid wpa_receive(struct wpa_authenticator *wpa_auth, 339214501Srpaulo struct wpa_state_machine *sm, 340214501Srpaulo u8 *data, size_t data_len); 341289549Srpauloenum wpa_event { 342214501Srpaulo WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH, 343346981Scy WPA_REAUTH_EAPOL, WPA_ASSOC_FT, WPA_ASSOC_FILS, WPA_DRV_STA_REMOVED 344289549Srpaulo}; 345214501Srpaulovoid wpa_remove_ptk(struct wpa_state_machine *sm); 346289549Srpauloint wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event); 347214501Srpaulovoid wpa_auth_sm_notify(struct wpa_state_machine *sm); 348214501Srpaulovoid wpa_gtk_rekey(struct wpa_authenticator *wpa_auth); 349214501Srpauloint wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen); 350214501Srpauloint wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen); 351214501Srpaulovoid wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth); 352214501Srpauloint wpa_auth_pairwise_set(struct wpa_state_machine *sm); 353214501Srpauloint wpa_auth_get_pairwise(struct wpa_state_machine *sm); 354346981Scyconst u8 * wpa_auth_get_pmk(struct wpa_state_machine *sm, int *len); 355214501Srpauloint wpa_auth_sta_key_mgmt(struct wpa_state_machine *sm); 356214501Srpauloint wpa_auth_sta_wpa_version(struct wpa_state_machine *sm); 357324697Sgordonint wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm); 358346981Scyint wpa_auth_sta_fils_tk_already_set(struct wpa_state_machine *sm); 359214501Srpauloint wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm, 360214501Srpaulo struct rsn_pmksa_cache_entry *entry); 361214501Srpaulostruct rsn_pmksa_cache_entry * 362214501Srpaulowpa_auth_sta_get_pmksa(struct wpa_state_machine *sm); 363214501Srpaulovoid wpa_auth_sta_local_mic_failure_report(struct wpa_state_machine *sm); 364214501Srpauloconst u8 * wpa_auth_get_wpa_ie(struct wpa_authenticator *wpa_auth, 365214501Srpaulo size_t *len); 366214501Srpauloint wpa_auth_pmksa_add(struct wpa_state_machine *sm, const u8 *pmk, 367337817Scy unsigned int pmk_len, 368214501Srpaulo int session_timeout, struct eapol_state_machine *eapol); 369214501Srpauloint wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth, 370214501Srpaulo const u8 *pmk, size_t len, const u8 *sta_addr, 371214501Srpaulo int session_timeout, 372214501Srpaulo struct eapol_state_machine *eapol); 373281806Srpauloint wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr, 374337817Scy const u8 *pmk, const u8 *pmkid); 375346981Scyvoid wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid); 376346981Scyint wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr, 377346981Scy const u8 *pmk, size_t pmk_len, const u8 *pmkid, 378346981Scy int session_timeout, int akmp); 379281806Srpaulovoid wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth, 380281806Srpaulo const u8 *sta_addr); 381337817Scyint wpa_auth_pmksa_list(struct wpa_authenticator *wpa_auth, char *buf, 382337817Scy size_t len); 383337817Scyvoid wpa_auth_pmksa_flush(struct wpa_authenticator *wpa_auth); 384346981Scyint wpa_auth_pmksa_list_mesh(struct wpa_authenticator *wpa_auth, const u8 *addr, 385346981Scy char *buf, size_t len); 386337817Scystruct rsn_pmksa_cache_entry * 387346981Scywpa_auth_pmksa_create_entry(const u8 *aa, const u8 *spa, const u8 *pmk, 388346981Scy const u8 *pmkid, int expiration); 389346981Scyint wpa_auth_pmksa_add_entry(struct wpa_authenticator *wpa_auth, 390346981Scy struct rsn_pmksa_cache_entry *entry); 391346981Scystruct rsn_pmksa_cache_entry * 392346981Scywpa_auth_pmksa_get(struct wpa_authenticator *wpa_auth, const u8 *sta_addr, 393346981Scy const u8 *pmkid); 394346981Scystruct rsn_pmksa_cache_entry * 395346981Scywpa_auth_pmksa_get_fils_cache_id(struct wpa_authenticator *wpa_auth, 396346981Scy const u8 *sta_addr, const u8 *pmkid); 397337817Scyvoid wpa_auth_pmksa_set_to_sm(struct rsn_pmksa_cache_entry *pmksa, 398337817Scy struct wpa_state_machine *sm, 399337817Scy struct wpa_authenticator *wpa_auth, 400337817Scy u8 *pmkid, u8 *pmk); 401214501Srpauloint wpa_auth_sta_set_vlan(struct wpa_state_machine *sm, int vlan_id); 402252726Srpaulovoid wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth, 403252726Srpaulo struct wpa_state_machine *sm, int ack); 404214501Srpaulo 405346981Scy#ifdef CONFIG_IEEE80211R_AP 406214501Srpaulou8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos, 407214501Srpaulo size_t max_len, int auth_alg, 408214501Srpaulo const u8 *req_ies, size_t req_ies_len); 409214501Srpaulovoid wpa_ft_process_auth(struct wpa_state_machine *sm, const u8 *bssid, 410214501Srpaulo u16 auth_transaction, const u8 *ies, size_t ies_len, 411214501Srpaulo void (*cb)(void *ctx, const u8 *dst, const u8 *bssid, 412214501Srpaulo u16 auth_transaction, u16 resp, 413214501Srpaulo const u8 *ies, size_t ies_len), 414214501Srpaulo void *ctx); 415214501Srpaulou16 wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies, 416214501Srpaulo size_t ies_len); 417214501Srpauloint wpa_ft_action_rx(struct wpa_state_machine *sm, const u8 *data, size_t len); 418214501Srpauloint wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, 419214501Srpaulo const u8 *data, size_t data_len); 420346981Scyvoid wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, 421346981Scy const u8 *dst_addr, u8 oui_suffix, const u8 *data, 422346981Scy size_t data_len); 423214501Srpaulovoid wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr); 424346981Scyvoid wpa_ft_deinit(struct wpa_authenticator *wpa_auth); 425346981Scyvoid wpa_ft_sta_deinit(struct wpa_state_machine *sm); 426346981Scy#endif /* CONFIG_IEEE80211R_AP */ 427214501Srpaulo 428252726Srpaulovoid wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm); 429252726Srpaulovoid wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag); 430252726Srpauloint wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos); 431252726Srpauloint wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos); 432252726Srpaulo 433252726Srpauloint wpa_auth_uses_sae(struct wpa_state_machine *sm); 434281806Srpauloint wpa_auth_uses_ft_sae(struct wpa_state_machine *sm); 435252726Srpaulo 436281806Srpauloint wpa_auth_get_ip_addr(struct wpa_state_machine *sm, u8 *addr); 437281806Srpaulo 438281806Srpaulostruct radius_das_attrs; 439281806Srpauloint wpa_auth_radius_das_disconnect_pmksa(struct wpa_authenticator *wpa_auth, 440281806Srpaulo struct radius_das_attrs *attr); 441281806Srpaulovoid wpa_auth_reconfig_group_keys(struct wpa_authenticator *wpa_auth); 442281806Srpaulo 443337817Scyint wpa_auth_ensure_group(struct wpa_authenticator *wpa_auth, int vlan_id); 444337817Scyint wpa_auth_release_group(struct wpa_authenticator *wpa_auth, int vlan_id); 445346981Scyint fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk, 446346981Scy size_t pmk_len, const u8 *snonce, const u8 *anonce, 447346981Scy const u8 *dhss, size_t dhss_len, 448346981Scy struct wpabuf *g_sta, struct wpabuf *g_ap); 449346981Scyint fils_decrypt_assoc(struct wpa_state_machine *sm, const u8 *fils_session, 450346981Scy const struct ieee80211_mgmt *mgmt, size_t frame_len, 451346981Scy u8 *pos, size_t left); 452346981Scyint fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf, 453346981Scy size_t current_len, size_t max_len, 454346981Scy const struct wpabuf *hlp); 455346981Scyint fils_set_tk(struct wpa_state_machine *sm); 456346981Scyu8 * hostapd_eid_assoc_fils_session(struct wpa_state_machine *sm, u8 *eid, 457346981Scy const u8 *fils_session, 458346981Scy struct wpabuf *fils_hlp_resp); 459346981Scyconst u8 * wpa_fils_validate_fils_session(struct wpa_state_machine *sm, 460346981Scy const u8 *ies, size_t ies_len, 461346981Scy const u8 *fils_session); 462346981Scyint wpa_fils_validate_key_confirm(struct wpa_state_machine *sm, const u8 *ies, 463346981Scy size_t ies_len); 464337817Scy 465346981Scyint get_sta_tx_parameters(struct wpa_state_machine *sm, int ap_max_chanwidth, 466346981Scy int ap_seg1_idx, int *bandwidth, int *seg1_idx); 467346981Scy 468346981Scyint wpa_auth_write_fte(struct wpa_authenticator *wpa_auth, int use_sha384, 469346981Scy u8 *buf, size_t len); 470346981Scyvoid wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm, 471346981Scy u8 *fils_anonce, u8 *fils_snonce, 472346981Scy u8 *fils_kek, size_t *fils_kek_len); 473346981Scyvoid wpa_auth_add_fils_pmk_pmkid(struct wpa_state_machine *sm, const u8 *pmk, 474346981Scy size_t pmk_len, const u8 *pmkid); 475346981Scyu8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm, 476346981Scy u8 *pos, size_t max_len, 477346981Scy const u8 *req_ies, size_t req_ies_len); 478351611Scyu8 * wpa_auth_write_assoc_resp_fils(struct wpa_state_machine *sm, 479351611Scy u8 *pos, size_t max_len, 480351611Scy const u8 *req_ies, size_t req_ies_len); 481346981Scyvoid wpa_auth_set_auth_alg(struct wpa_state_machine *sm, u16 auth_alg); 482346981Scyvoid wpa_auth_set_dpp_z(struct wpa_state_machine *sm, const struct wpabuf *z); 483346981Scy 484346981Scyint wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce, 485346981Scy void (*cb)(void *ctx1, void *ctx2), 486346981Scy void *ctx1, void *ctx2); 487346981Scyint wpa_auth_resend_m3(struct wpa_state_machine *sm, 488346981Scy void (*cb)(void *ctx1, void *ctx2), 489346981Scy void *ctx1, void *ctx2); 490346981Scyint wpa_auth_resend_group_m1(struct wpa_state_machine *sm, 491346981Scy void (*cb)(void *ctx1, void *ctx2), 492346981Scy void *ctx1, void *ctx2); 493346981Scyint wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth); 494346981Scyvoid wpa_auth_set_ptk_rekey_timer(struct wpa_state_machine *sm); 495346981Scy 496214501Srpaulo#endif /* WPA_AUTH_H */ 497