Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * hostapd - IEEE 802.11i-2004 / WPA Authenticator |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame] | 3 | * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi> |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 4 | * |
Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 7 | */ |
| 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 Shmidt | 9d9e602 | 2015-04-23 10:34:55 -0700 | [diff] [blame] | 15 | #include "common/ieee802_11_defs.h" |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 16 | |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 17 | struct vlan_description; |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 18 | struct mld_info; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 19 | |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 20 | #define MAX_OWN_IE_OVERRIDE 256 |
| 21 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 22 | #ifdef _MSC_VER |
| 23 | #pragma pack(push, 1) |
| 24 | #endif /* _MSC_VER */ |
| 25 | |
| 26 | /* IEEE Std 802.11r-2008, 11A.10.3 - Remote request/response frame definition |
| 27 | */ |
| 28 | struct ft_rrb_frame { |
| 29 | u8 frame_type; /* RSN_REMOTE_FRAME_TYPE_FT_RRB */ |
| 30 | u8 packet_type; /* FT_PACKET_REQUEST/FT_PACKET_RESPONSE */ |
| 31 | le16 action_length; /* little endian length of action_frame */ |
| 32 | u8 ap_address[ETH_ALEN]; |
| 33 | /* |
| 34 | * Followed by action_length bytes of FT Action frame (from Category |
| 35 | * field to the end of Action Frame body. |
| 36 | */ |
| 37 | } STRUCT_PACKED; |
| 38 | |
| 39 | #define RSN_REMOTE_FRAME_TYPE_FT_RRB 1 |
| 40 | |
| 41 | #define FT_PACKET_REQUEST 0 |
| 42 | #define FT_PACKET_RESPONSE 1 |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 43 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 44 | /* Vendor-specific types for R0KH-R1KH protocol; not defined in 802.11r. These |
| 45 | * use OUI Extended EtherType as the encapsulating format. */ |
| 46 | #define FT_PACKET_R0KH_R1KH_PULL 0x01 |
| 47 | #define FT_PACKET_R0KH_R1KH_RESP 0x02 |
| 48 | #define FT_PACKET_R0KH_R1KH_PUSH 0x03 |
| 49 | #define FT_PACKET_R0KH_R1KH_SEQ_REQ 0x04 |
| 50 | #define FT_PACKET_R0KH_R1KH_SEQ_RESP 0x05 |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 51 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 52 | /* packet layout |
| 53 | * IEEE 802 extended OUI ethertype frame header |
| 54 | * u16 authlen (little endian) |
| 55 | * multiple of struct ft_rrb_tlv (authenticated only, length = authlen) |
| 56 | * multiple of struct ft_rrb_tlv (AES-SIV encrypted, AES-SIV needs an extra |
| 57 | * blocksize length) |
| 58 | * |
| 59 | * AES-SIV AAD; |
| 60 | * source MAC address (6) |
| 61 | * authenticated-only TLVs (authlen) |
| 62 | * subtype (1; FT_PACKET_*) |
| 63 | */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 64 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 65 | #define FT_RRB_NONCE_LEN 16 |
| 66 | |
| 67 | #define FT_RRB_LAST_EMPTY 0 /* placeholder or padding */ |
| 68 | |
| 69 | #define FT_RRB_SEQ 1 /* struct ft_rrb_seq */ |
| 70 | #define FT_RRB_NONCE 2 /* size FT_RRB_NONCE_LEN */ |
| 71 | #define FT_RRB_TIMESTAMP 3 /* le32 unix seconds */ |
| 72 | |
| 73 | #define FT_RRB_R0KH_ID 4 /* FT_R0KH_ID_MAX_LEN */ |
| 74 | #define FT_RRB_R1KH_ID 5 /* FT_R1KH_ID_LEN */ |
| 75 | #define FT_RRB_S1KH_ID 6 /* ETH_ALEN */ |
| 76 | |
| 77 | #define FT_RRB_PMK_R0_NAME 7 /* WPA_PMK_NAME_LEN */ |
| 78 | #define FT_RRB_PMK_R0 8 /* PMK_LEN */ |
| 79 | #define FT_RRB_PMK_R1_NAME 9 /* WPA_PMK_NAME_LEN */ |
| 80 | #define FT_RRB_PMK_R1 10 /* PMK_LEN */ |
| 81 | |
| 82 | #define FT_RRB_PAIRWISE 11 /* le16 */ |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 83 | #define FT_RRB_EXPIRES_IN 12 /* le16 seconds */ |
| 84 | |
| 85 | #define FT_RRB_VLAN_UNTAGGED 13 /* le16 */ |
| 86 | #define FT_RRB_VLAN_TAGGED 14 /* n times le16 */ |
| 87 | |
| 88 | #define FT_RRB_IDENTITY 15 |
| 89 | #define FT_RRB_RADIUS_CUI 16 |
| 90 | #define FT_RRB_SESSION_TIMEOUT 17 /* le32 seconds */ |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 91 | |
| 92 | struct ft_rrb_tlv { |
| 93 | le16 type; |
| 94 | le16 len; |
| 95 | /* followed by data of length len */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 96 | } STRUCT_PACKED; |
| 97 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 98 | struct ft_rrb_seq { |
| 99 | le32 dom; |
| 100 | le32 seq; |
| 101 | le32 ts; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 102 | } STRUCT_PACKED; |
| 103 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 104 | /* session TLVs: |
| 105 | * required: PMK_R1, PMK_R1_NAME, PAIRWISE |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 106 | * optional: VLAN_UNTAGGED, VLAN_TAGGED, EXPIRES_IN, IDENTITY, RADIUS_CUI, |
| 107 | * SESSION_TIMEOUT |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 108 | * |
| 109 | * pull frame TLVs: |
| 110 | * auth: |
| 111 | * required: SEQ, NONCE, R0KH_ID, R1KH_ID |
| 112 | * encrypted: |
| 113 | * required: PMK_R0_NAME, S1KH_ID |
| 114 | * |
| 115 | * response frame TLVs: |
| 116 | * auth: |
| 117 | * required: SEQ, NONCE, R0KH_ID, R1KH_ID |
| 118 | * encrypted: |
| 119 | * required: S1KH_ID |
| 120 | * optional: session TLVs |
| 121 | * |
| 122 | * push frame TLVs: |
| 123 | * auth: |
| 124 | * required: SEQ, R0KH_ID, R1KH_ID |
| 125 | * encrypted: |
| 126 | * required: S1KH_ID, PMK_R0_NAME, session TLVs |
| 127 | * |
| 128 | * sequence number request frame TLVs: |
| 129 | * auth: |
| 130 | * required: R0KH_ID, R1KH_ID, NONCE |
| 131 | * |
| 132 | * sequence number response frame TLVs: |
| 133 | * auth: |
| 134 | * required: SEQ, NONCE, R0KH_ID, R1KH_ID |
| 135 | */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 136 | |
| 137 | #ifdef _MSC_VER |
| 138 | #pragma pack(pop) |
| 139 | #endif /* _MSC_VER */ |
| 140 | |
| 141 | |
| 142 | /* per STA state machine data */ |
| 143 | |
| 144 | struct wpa_authenticator; |
| 145 | struct wpa_state_machine; |
| 146 | struct rsn_pmksa_cache_entry; |
| 147 | struct eapol_state_machine; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 148 | struct ft_remote_seq; |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 149 | struct wpa_channel_info; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 150 | |
| 151 | |
| 152 | struct ft_remote_r0kh { |
| 153 | struct ft_remote_r0kh *next; |
| 154 | u8 addr[ETH_ALEN]; |
| 155 | u8 id[FT_R0KH_ID_MAX_LEN]; |
| 156 | size_t id_len; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 157 | u8 key[32]; |
| 158 | struct ft_remote_seq *seq; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 159 | }; |
| 160 | |
| 161 | |
| 162 | struct ft_remote_r1kh { |
| 163 | struct ft_remote_r1kh *next; |
| 164 | u8 addr[ETH_ALEN]; |
| 165 | u8 id[FT_R1KH_ID_LEN]; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 166 | u8 key[32]; |
| 167 | struct ft_remote_seq *seq; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | |
| 171 | struct wpa_auth_config { |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 172 | void *msg_ctx; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 173 | int wpa; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 174 | int extended_key_id; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 175 | int wpa_key_mgmt; |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 176 | int rsn_override_key_mgmt; |
| 177 | int rsn_override_key_mgmt_2; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 178 | int wpa_pairwise; |
| 179 | int wpa_group; |
| 180 | int wpa_group_rekey; |
| 181 | int wpa_strict_rekey; |
| 182 | int wpa_gmk_rekey; |
| 183 | int wpa_ptk_rekey; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 184 | int wpa_deny_ptk0_rekey; |
Dmitry Shmidt | ebd93af | 2017-02-21 13:40:44 -0800 | [diff] [blame] | 185 | u32 wpa_group_update_count; |
| 186 | u32 wpa_pairwise_update_count; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 187 | int wpa_disable_eapol_key_retries; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 188 | int rsn_pairwise; |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 189 | int rsn_override_pairwise; |
| 190 | int rsn_override_pairwise_2; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 191 | int rsn_preauth; |
| 192 | int eapol_version; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 193 | int wmm_enabled; |
| 194 | int wmm_uapsd; |
Dmitry Shmidt | c55524a | 2011-07-07 11:18:38 -0700 | [diff] [blame] | 195 | int disable_pmksa_caching; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 196 | int okc; |
| 197 | int tx_status; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 198 | enum mfp_options ieee80211w; |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 199 | enum mfp_options rsn_override_mfp; |
| 200 | enum mfp_options rsn_override_mfp_2; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 201 | int beacon_prot; |
Dmitry Shmidt | b36ed7c | 2014-03-17 10:57:26 -0700 | [diff] [blame] | 202 | int group_mgmt_cipher; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 203 | int sae_require_mfp; |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 204 | #ifdef CONFIG_OCV |
| 205 | int ocv; /* Operating Channel Validation */ |
| 206 | #endif /* CONFIG_OCV */ |
Dmitry Shmidt | 9d9e602 | 2015-04-23 10:34:55 -0700 | [diff] [blame] | 207 | u8 ssid[SSID_MAX_LEN]; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 208 | size_t ssid_len; |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 209 | #ifdef CONFIG_IEEE80211R_AP |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 210 | u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN]; |
| 211 | u8 r0_key_holder[FT_R0KH_ID_MAX_LEN]; |
| 212 | size_t r0_key_holder_len; |
| 213 | u8 r1_key_holder[FT_R1KH_ID_LEN]; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 214 | u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */ |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 215 | int rkh_pos_timeout; |
| 216 | int rkh_neg_timeout; |
| 217 | int rkh_pull_timeout; /* ms */ |
| 218 | int rkh_pull_retries; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 219 | int r1_max_key_lifetime; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 220 | u32 reassociation_deadline; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 221 | struct ft_remote_r0kh **r0kh_list; |
| 222 | struct ft_remote_r1kh **r1kh_list; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 223 | int pmk_r1_push; |
| 224 | int ft_over_ds; |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 225 | int ft_psk_generate_local; |
| 226 | #endif /* CONFIG_IEEE80211R_AP */ |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 227 | int disable_gtk; |
| 228 | int ap_mlme; |
Dmitry Shmidt | 51b6ea8 | 2013-05-08 10:42:09 -0700 | [diff] [blame] | 229 | #ifdef CONFIG_TESTING_OPTIONS |
| 230 | double corrupt_gtk_rekey_mic_probability; |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 231 | u8 own_ie_override[MAX_OWN_IE_OVERRIDE]; |
| 232 | size_t own_ie_override_len; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 233 | u8 rsne_override_eapol[MAX_OWN_IE_OVERRIDE]; |
| 234 | size_t rsne_override_eapol_len; |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 235 | u8 rsnxe_override_eapol[MAX_OWN_IE_OVERRIDE]; |
| 236 | size_t rsnxe_override_eapol_len; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 237 | u8 rsne_override_ft[MAX_OWN_IE_OVERRIDE]; |
| 238 | size_t rsne_override_ft_len; |
| 239 | u8 rsnxe_override_ft[MAX_OWN_IE_OVERRIDE]; |
| 240 | size_t rsnxe_override_ft_len; |
| 241 | u8 gtk_rsc_override[WPA_KEY_RSC_LEN]; |
| 242 | u8 igtk_rsc_override[WPA_KEY_RSC_LEN]; |
| 243 | unsigned int rsne_override_eapol_set:1; |
| 244 | unsigned int rsnxe_override_eapol_set:1; |
| 245 | unsigned int rsne_override_ft_set:1; |
| 246 | unsigned int rsnxe_override_ft_set:1; |
| 247 | unsigned int gtk_rsc_override_set:1; |
| 248 | unsigned int igtk_rsc_override_set:1; |
Hai Shalom | b755a2a | 2020-04-23 21:49:02 -0700 | [diff] [blame] | 249 | int ft_rsnxe_used; |
Kai Shi | e75b065 | 2020-11-24 20:31:29 -0800 | [diff] [blame] | 250 | unsigned int skip_send_eapol:1; |
| 251 | unsigned int enable_eapol_large_timeout:1; |
Sunil Ravi | 38ad1ed | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 252 | bool delay_eapol_tx; |
Sunil Ravi | b0ac25f | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 253 | struct wpabuf *eapol_m1_elements; |
| 254 | struct wpabuf *eapol_m3_elements; |
| 255 | bool eapol_m3_no_encrypt; |
Dmitry Shmidt | 51b6ea8 | 2013-05-08 10:42:09 -0700 | [diff] [blame] | 256 | #endif /* CONFIG_TESTING_OPTIONS */ |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 257 | unsigned int oci_freq_override_eapol_m3; |
| 258 | unsigned int oci_freq_override_eapol_g1; |
| 259 | unsigned int oci_freq_override_ft_assoc; |
| 260 | unsigned int oci_freq_override_fils_assoc; |
Dmitry Shmidt | cf32e60 | 2014-01-28 10:57:39 -0800 | [diff] [blame] | 261 | #ifdef CONFIG_P2P |
| 262 | u8 ip_addr_go[4]; |
| 263 | u8 ip_addr_mask[4]; |
| 264 | u8 ip_addr_start[4]; |
| 265 | u8 ip_addr_end[4]; |
| 266 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 267 | #ifdef CONFIG_FILS |
| 268 | unsigned int fils_cache_id_set:1; |
| 269 | u8 fils_cache_id[FILS_CACHE_ID_LEN]; |
| 270 | #endif /* CONFIG_FILS */ |
Sunil Ravi | 38ad1ed | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 271 | enum sae_pwe sae_pwe; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 272 | bool sae_pk; |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 273 | |
| 274 | unsigned int secure_ltf:1; |
| 275 | unsigned int secure_rtt:1; |
| 276 | unsigned int prot_range_neg:1; |
| 277 | |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 278 | int owe_ptk_workaround; |
| 279 | u8 transition_disable; |
| 280 | #ifdef CONFIG_DPP2 |
| 281 | int dpp_pfs; |
| 282 | #endif /* CONFIG_DPP2 */ |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 283 | |
| 284 | /* |
| 285 | * If set Key Derivation Key should be derived as part of PMK to |
| 286 | * PTK derivation regardless of advertised capabilities. |
| 287 | */ |
| 288 | bool force_kdk_derivation; |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame] | 289 | |
| 290 | bool radius_psk; |
Sunil Ravi | b0ac25f | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 291 | |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 292 | bool no_disconnect_on_group_keyerror; |
| 293 | |
Sunil Ravi | b0ac25f | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 294 | /* Pointer to Multi-BSSID transmitted BSS authenticator instance. |
| 295 | * Set only in nontransmitted BSSs, i.e., is NULL for transmitted BSS |
| 296 | * and in BSSs that are not part of a Multi-BSSID set. */ |
| 297 | struct wpa_authenticator *tx_bss_auth; |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 298 | |
| 299 | #ifdef CONFIG_IEEE80211BE |
| 300 | const u8 *mld_addr; |
| 301 | int link_id; |
| 302 | struct wpa_authenticator *first_link_auth; |
| 303 | #endif /* CONFIG_IEEE80211BE */ |
| 304 | |
| 305 | bool ssid_protection; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 306 | }; |
| 307 | |
| 308 | typedef enum { |
| 309 | LOGGER_DEBUG, LOGGER_INFO, LOGGER_WARNING |
| 310 | } logger_level; |
| 311 | |
| 312 | typedef enum { |
| 313 | WPA_EAPOL_portEnabled, WPA_EAPOL_portValid, WPA_EAPOL_authorized, |
| 314 | WPA_EAPOL_portControl_Auto, WPA_EAPOL_keyRun, WPA_EAPOL_keyAvailable, |
| 315 | WPA_EAPOL_keyDone, WPA_EAPOL_inc_EapolFramesTx |
| 316 | } wpa_eapol_variable; |
| 317 | |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 318 | struct wpa_auth_ml_key_info { |
| 319 | unsigned int n_mld_links; |
| 320 | bool mgmt_frame_prot; |
| 321 | bool beacon_prot; |
| 322 | |
| 323 | struct wpa_auth_ml_link_key_info { |
| 324 | u8 link_id; |
| 325 | |
| 326 | u8 gtkidx; |
| 327 | u8 gtk_len; |
| 328 | u8 pn[6]; |
| 329 | const u8 *gtk; |
| 330 | |
| 331 | u8 igtkidx; |
| 332 | u8 igtk_len; |
| 333 | const u8 *igtk; |
| 334 | u8 ipn[6]; |
| 335 | |
| 336 | u8 bigtkidx; |
| 337 | const u8 *bigtk; |
| 338 | u8 bipn[6]; |
| 339 | } links[MAX_NUM_MLD_LINKS]; |
| 340 | }; |
| 341 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 342 | struct wpa_auth_callbacks { |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 343 | void (*logger)(void *ctx, const u8 *addr, logger_level level, |
| 344 | const char *txt); |
| 345 | void (*disconnect)(void *ctx, const u8 *addr, u16 reason); |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 346 | int (*mic_failure_report)(void *ctx, const u8 *addr); |
Dmitry Shmidt | dda10c2 | 2015-03-24 16:05:01 -0700 | [diff] [blame] | 347 | void (*psk_failure_report)(void *ctx, const u8 *addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 348 | void (*set_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var, |
| 349 | int value); |
| 350 | int (*get_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var); |
Dmitry Shmidt | 391c59f | 2013-09-03 12:16:28 -0700 | [diff] [blame] | 351 | const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *p2p_dev_addr, |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 352 | const u8 *prev_psk, size_t *psk_len, |
| 353 | int *vlan_id); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 354 | int (*get_msk)(void *ctx, const u8 *addr, u8 *msk, size_t *len); |
| 355 | int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg, |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 356 | const u8 *addr, int idx, u8 *key, size_t key_len, |
| 357 | enum key_flag key_flag); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 358 | int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq); |
| 359 | int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data, |
| 360 | size_t data_len, int encrypt); |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 361 | int (*get_sta_count)(void *ctx); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 362 | int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm, |
| 363 | void *ctx), void *cb_ctx); |
| 364 | int (*for_each_auth)(void *ctx, int (*cb)(struct wpa_authenticator *a, |
| 365 | void *ctx), void *cb_ctx); |
| 366 | int (*send_ether)(void *ctx, const u8 *dst, u16 proto, const u8 *data, |
| 367 | size_t data_len); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 368 | int (*send_oui)(void *ctx, const u8 *dst, u8 oui_suffix, const u8 *data, |
| 369 | size_t data_len); |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 370 | int (*channel_info)(void *ctx, struct wpa_channel_info *ci); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 371 | int (*update_vlan)(void *ctx, const u8 *addr, int vlan_id); |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 372 | int (*get_sta_tx_params)(void *ctx, const u8 *addr, |
| 373 | int ap_max_chanwidth, int ap_seg1_idx, |
| 374 | int *bandwidth, int *seg1_idx); |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 375 | void (*store_ptksa)(void *ctx, const u8 *addr, int cipher, |
| 376 | u32 life_time, const struct wpa_ptk *ptk); |
| 377 | void (*clear_ptksa)(void *ctx, const u8 *addr, int cipher); |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame] | 378 | void (*request_radius_psk)(void *ctx, const u8 *addr, int key_mgmt, |
| 379 | const u8 *anonce, |
| 380 | const u8 *eapol, size_t eapol_len); |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 381 | #ifdef CONFIG_IEEE80211R_AP |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 382 | struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr); |
Hai Shalom | b755a2a | 2020-04-23 21:49:02 -0700 | [diff] [blame] | 383 | int (*add_sta_ft)(void *ctx, const u8 *sta_addr); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 384 | int (*set_vlan)(void *ctx, const u8 *sta_addr, |
| 385 | struct vlan_description *vlan); |
| 386 | int (*get_vlan)(void *ctx, const u8 *sta_addr, |
| 387 | struct vlan_description *vlan); |
| 388 | int (*set_identity)(void *ctx, const u8 *sta_addr, |
| 389 | const u8 *identity, size_t identity_len); |
| 390 | size_t (*get_identity)(void *ctx, const u8 *sta_addr, const u8 **buf); |
| 391 | int (*set_radius_cui)(void *ctx, const u8 *sta_addr, |
| 392 | const u8 *radius_cui, size_t radius_cui_len); |
| 393 | size_t (*get_radius_cui)(void *ctx, const u8 *sta_addr, const u8 **buf); |
| 394 | void (*set_session_timeout)(void *ctx, const u8 *sta_addr, |
| 395 | int session_timeout); |
| 396 | int (*get_session_timeout)(void *ctx, const u8 *sta_addr); |
| 397 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 398 | int (*send_ft_action)(void *ctx, const u8 *dst, |
| 399 | const u8 *data, size_t data_len); |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 400 | int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie, |
Dmitry Shmidt | fb79edc | 2014-01-10 10:45:54 -0800 | [diff] [blame] | 401 | size_t tspec_ielen); |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 402 | #endif /* CONFIG_IEEE80211R_AP */ |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 403 | #ifdef CONFIG_MESH |
| 404 | int (*start_ampe)(void *ctx, const u8 *sta_addr); |
| 405 | #endif /* CONFIG_MESH */ |
Sunil Ravi | 89eba10 | 2022-09-13 21:04:37 -0700 | [diff] [blame] | 406 | #ifdef CONFIG_PASN |
| 407 | int (*set_ltf_keyseed)(void *ctx, const u8 *addr, const u8 *ltf_keyseed, |
| 408 | size_t ltf_keyseed_len); |
| 409 | #endif /* CONFIG_PASN */ |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 410 | #ifdef CONFIG_IEEE80211BE |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 411 | int (*get_ml_key_info)(void *ctx, struct wpa_auth_ml_key_info *info); |
| 412 | #endif /* CONFIG_IEEE80211BE */ |
| 413 | int (*get_drv_flags)(void *ctx, u64 *drv_flags, u64 *drv_flags2); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 414 | }; |
| 415 | |
| 416 | struct wpa_authenticator * wpa_init(const u8 *addr, |
| 417 | struct wpa_auth_config *conf, |
Paul Stewart | 092955c | 2017-02-06 09:13:09 -0800 | [diff] [blame] | 418 | const struct wpa_auth_callbacks *cb, |
| 419 | void *cb_ctx); |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 420 | int wpa_init_keys(struct wpa_authenticator *wpa_auth); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 421 | void wpa_deinit(struct wpa_authenticator *wpa_auth); |
| 422 | int wpa_reconfig(struct wpa_authenticator *wpa_auth, |
| 423 | struct wpa_auth_config *conf); |
| 424 | |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 425 | enum wpa_validate_result { |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 426 | WPA_IE_OK, WPA_INVALID_IE, WPA_INVALID_GROUP, WPA_INVALID_PAIRWISE, |
| 427 | WPA_INVALID_AKMP, WPA_NOT_ENABLED, WPA_ALLOC_FAIL, |
| 428 | WPA_MGMT_FRAME_PROTECTION_VIOLATION, WPA_INVALID_MGMT_GROUP_CIPHER, |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 429 | WPA_INVALID_MDIE, WPA_INVALID_PROTO, WPA_INVALID_PMKID, |
| 430 | WPA_DENIED_OTHER_REASON |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 431 | }; |
Dmitry Shmidt | ebd93af | 2017-02-21 13:40:44 -0800 | [diff] [blame] | 432 | |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 433 | enum wpa_validate_result |
| 434 | wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth, |
| 435 | struct wpa_state_machine *sm, int freq, |
| 436 | const u8 *wpa_ie, size_t wpa_ie_len, |
| 437 | const u8 *rsnxe, size_t rsnxe_len, |
| 438 | const u8 *mdie, size_t mdie_len, |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 439 | const u8 *owe_dh, size_t owe_dh_len, |
| 440 | struct wpa_state_machine *assoc_sm); |
Dmitry Shmidt | f21452a | 2014-02-26 10:55:25 -0800 | [diff] [blame] | 441 | int wpa_validate_osen(struct wpa_authenticator *wpa_auth, |
| 442 | struct wpa_state_machine *sm, |
| 443 | const u8 *osen_ie, size_t osen_ie_len); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 444 | int wpa_auth_uses_mfp(struct wpa_state_machine *sm); |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 445 | void wpa_auth_set_ocv(struct wpa_state_machine *sm, int ocv); |
| 446 | int wpa_auth_uses_ocv(struct wpa_state_machine *sm); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 447 | struct wpa_state_machine * |
Dmitry Shmidt | 391c59f | 2013-09-03 12:16:28 -0700 | [diff] [blame] | 448 | wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr, |
| 449 | const u8 *p2p_dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 450 | int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth, |
| 451 | struct wpa_state_machine *sm); |
| 452 | void wpa_auth_sta_no_wpa(struct wpa_state_machine *sm); |
| 453 | void wpa_auth_sta_deinit(struct wpa_state_machine *sm); |
| 454 | void wpa_receive(struct wpa_authenticator *wpa_auth, |
| 455 | struct wpa_state_machine *sm, |
| 456 | u8 *data, size_t data_len); |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 457 | enum wpa_event { |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 458 | WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 459 | WPA_REAUTH_EAPOL, WPA_ASSOC_FT, WPA_ASSOC_FILS, WPA_DRV_STA_REMOVED |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 460 | }; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 461 | void wpa_remove_ptk(struct wpa_state_machine *sm); |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 462 | int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 463 | void wpa_auth_sm_notify(struct wpa_state_machine *sm); |
| 464 | void wpa_gtk_rekey(struct wpa_authenticator *wpa_auth); |
| 465 | int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen); |
| 466 | int wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen); |
| 467 | void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth); |
| 468 | int wpa_auth_pairwise_set(struct wpa_state_machine *sm); |
| 469 | int wpa_auth_get_pairwise(struct wpa_state_machine *sm); |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 470 | const u8 * wpa_auth_get_pmk(struct wpa_state_machine *sm, int *len); |
Sunil Ravi | 38ad1ed | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 471 | const u8 * wpa_auth_get_dpp_pkhash(struct wpa_state_machine *sm); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 472 | int wpa_auth_sta_key_mgmt(struct wpa_state_machine *sm); |
| 473 | int wpa_auth_sta_wpa_version(struct wpa_state_machine *sm); |
Mathy Vanhoef | f6e1f66 | 2017-07-14 15:15:35 +0200 | [diff] [blame] | 474 | int wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 475 | int wpa_auth_sta_fils_tk_already_set(struct wpa_state_machine *sm); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 476 | int wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm, |
| 477 | struct rsn_pmksa_cache_entry *entry); |
| 478 | struct rsn_pmksa_cache_entry * |
| 479 | wpa_auth_sta_get_pmksa(struct wpa_state_machine *sm); |
| 480 | void wpa_auth_sta_local_mic_failure_report(struct wpa_state_machine *sm); |
| 481 | const u8 * wpa_auth_get_wpa_ie(struct wpa_authenticator *wpa_auth, |
| 482 | size_t *len); |
| 483 | int wpa_auth_pmksa_add(struct wpa_state_machine *sm, const u8 *pmk, |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 484 | unsigned int pmk_len, |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 485 | int session_timeout, struct eapol_state_machine *eapol); |
| 486 | int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth, |
| 487 | const u8 *pmk, size_t len, const u8 *sta_addr, |
| 488 | int session_timeout, |
| 489 | struct eapol_state_machine *eapol); |
Dmitry Shmidt | 6c0da2b | 2015-01-05 13:08:17 -0800 | [diff] [blame] | 490 | int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr, |
Sunil Ravi | 89eba10 | 2022-09-13 21:04:37 -0700 | [diff] [blame] | 491 | const u8 *pmk, size_t pmk_len, const u8 *pmkid, |
| 492 | int akmp); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 493 | void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 494 | int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr, |
| 495 | const u8 *pmk, size_t pmk_len, const u8 *pmkid, |
Sunil Ravi | 38ad1ed | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 496 | int session_timeout, int akmp, const u8 *dpp_pkhash); |
Dmitry Shmidt | f7e0a99 | 2013-05-23 11:03:10 -0700 | [diff] [blame] | 497 | void wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth, |
| 498 | const u8 *sta_addr); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 499 | int wpa_auth_pmksa_list(struct wpa_authenticator *wpa_auth, char *buf, |
| 500 | size_t len); |
| 501 | void wpa_auth_pmksa_flush(struct wpa_authenticator *wpa_auth); |
Paul Stewart | 092955c | 2017-02-06 09:13:09 -0800 | [diff] [blame] | 502 | int wpa_auth_pmksa_list_mesh(struct wpa_authenticator *wpa_auth, const u8 *addr, |
| 503 | char *buf, size_t len); |
| 504 | struct rsn_pmksa_cache_entry * |
| 505 | wpa_auth_pmksa_create_entry(const u8 *aa, const u8 *spa, const u8 *pmk, |
Sunil Ravi | 89eba10 | 2022-09-13 21:04:37 -0700 | [diff] [blame] | 506 | size_t pmk_len, int akmp, |
Paul Stewart | 092955c | 2017-02-06 09:13:09 -0800 | [diff] [blame] | 507 | const u8 *pmkid, int expiration); |
| 508 | int wpa_auth_pmksa_add_entry(struct wpa_authenticator *wpa_auth, |
| 509 | struct rsn_pmksa_cache_entry *entry); |
Sunil Ravi | 38ad1ed | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 510 | struct rsn_pmksa_cache * |
| 511 | wpa_auth_get_pmksa_cache(struct wpa_authenticator *wpa_auth); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 512 | struct rsn_pmksa_cache_entry * |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 513 | wpa_auth_pmksa_get(struct wpa_authenticator *wpa_auth, const u8 *sta_addr, |
| 514 | const u8 *pmkid); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 515 | struct rsn_pmksa_cache_entry * |
| 516 | wpa_auth_pmksa_get_fils_cache_id(struct wpa_authenticator *wpa_auth, |
| 517 | const u8 *sta_addr, const u8 *pmkid); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 518 | void wpa_auth_pmksa_set_to_sm(struct rsn_pmksa_cache_entry *pmksa, |
| 519 | struct wpa_state_machine *sm, |
| 520 | struct wpa_authenticator *wpa_auth, |
Sunil Ravi | b0ac25f | 2024-07-12 01:42:03 +0000 | [diff] [blame] | 521 | u8 *pmkid, u8 *pmk, size_t *pmk_len); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 522 | int wpa_auth_sta_set_vlan(struct wpa_state_machine *sm, int vlan_id); |
| 523 | void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth, |
| 524 | struct wpa_state_machine *sm, int ack); |
| 525 | |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 526 | #ifdef CONFIG_IEEE80211R_AP |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 527 | u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos, |
| 528 | size_t max_len, int auth_alg, |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 529 | const u8 *req_ies, size_t req_ies_len, |
| 530 | int omit_rsnxe); |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 531 | void wpa_ft_process_auth(struct wpa_state_machine *sm, |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 532 | u16 auth_transaction, const u8 *ies, size_t ies_len, |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 533 | void (*cb)(void *ctx, const u8 *dst, |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 534 | u16 auth_transaction, u16 resp, |
| 535 | const u8 *ies, size_t ies_len), |
| 536 | void *ctx); |
Hai Shalom | b755a2a | 2020-04-23 21:49:02 -0700 | [diff] [blame] | 537 | int wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies, |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 538 | size_t ies_len); |
| 539 | int wpa_ft_action_rx(struct wpa_state_machine *sm, const u8 *data, size_t len); |
| 540 | int wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, |
| 541 | const u8 *data, size_t data_len); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 542 | void wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, |
| 543 | const u8 *dst_addr, u8 oui_suffix, const u8 *data, |
| 544 | size_t data_len); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 545 | void wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 546 | void wpa_ft_deinit(struct wpa_authenticator *wpa_auth); |
| 547 | void wpa_ft_sta_deinit(struct wpa_state_machine *sm); |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 548 | int wpa_ft_fetch_pmk_r1(struct wpa_authenticator *wpa_auth, |
| 549 | const u8 *spa, const u8 *pmk_r1_name, |
| 550 | u8 *pmk_r1, size_t *pmk_r1_len, int *pairwise, |
| 551 | struct vlan_description *vlan, |
| 552 | const u8 **identity, size_t *identity_len, |
| 553 | const u8 **radius_cui, size_t *radius_cui_len, |
| 554 | int *session_timeout); |
| 555 | |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 556 | #endif /* CONFIG_IEEE80211R_AP */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 557 | |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 558 | void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm); |
| 559 | void wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag); |
| 560 | int wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos); |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 561 | int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 562 | int wpa_wnmsleep_bigtk_subelem(struct wpa_state_machine *sm, u8 *pos); |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 563 | |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 564 | int wpa_auth_uses_sae(struct wpa_state_machine *sm); |
Dmitry Shmidt | fb79edc | 2014-01-10 10:45:54 -0800 | [diff] [blame] | 565 | int wpa_auth_uses_ft_sae(struct wpa_state_machine *sm); |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 566 | |
Dmitry Shmidt | cf32e60 | 2014-01-28 10:57:39 -0800 | [diff] [blame] | 567 | int wpa_auth_get_ip_addr(struct wpa_state_machine *sm, u8 *addr); |
| 568 | |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 569 | struct radius_das_attrs; |
| 570 | int wpa_auth_radius_das_disconnect_pmksa(struct wpa_authenticator *wpa_auth, |
| 571 | struct radius_das_attrs *attr); |
Dmitry Shmidt | 7f65602 | 2015-02-25 14:36:37 -0800 | [diff] [blame] | 572 | void wpa_auth_reconfig_group_keys(struct wpa_authenticator *wpa_auth); |
Dmitry Shmidt | 2f74e36 | 2015-01-21 13:19:05 -0800 | [diff] [blame] | 573 | |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 574 | int wpa_auth_ensure_group(struct wpa_authenticator *wpa_auth, int vlan_id); |
| 575 | int wpa_auth_release_group(struct wpa_authenticator *wpa_auth, int vlan_id); |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 576 | int fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 577 | size_t pmk_len, const u8 *snonce, const u8 *anonce, |
| 578 | const u8 *dhss, size_t dhss_len, |
| 579 | struct wpabuf *g_sta, struct wpabuf *g_ap); |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 580 | int fils_decrypt_assoc(struct wpa_state_machine *sm, const u8 *fils_session, |
| 581 | const struct ieee80211_mgmt *mgmt, size_t frame_len, |
| 582 | u8 *pos, size_t left); |
| 583 | int fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf, |
Dmitry Shmidt | ebd93af | 2017-02-21 13:40:44 -0800 | [diff] [blame] | 584 | size_t current_len, size_t max_len, |
| 585 | const struct wpabuf *hlp); |
Dmitry Shmidt | 9839ecd | 2016-11-07 11:05:47 -0800 | [diff] [blame] | 586 | int fils_set_tk(struct wpa_state_machine *sm); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 587 | u8 * hostapd_eid_assoc_fils_session(struct wpa_state_machine *sm, u8 *eid, |
| 588 | const u8 *fils_session, |
| 589 | struct wpabuf *fils_hlp_resp); |
| 590 | const u8 * wpa_fils_validate_fils_session(struct wpa_state_machine *sm, |
| 591 | const u8 *ies, size_t ies_len, |
| 592 | const u8 *fils_session); |
| 593 | int wpa_fils_validate_key_confirm(struct wpa_state_machine *sm, const u8 *ies, |
| 594 | size_t ies_len); |
| 595 | |
Hai Shalom | 74f70d4 | 2019-02-11 14:42:39 -0800 | [diff] [blame] | 596 | int get_sta_tx_parameters(struct wpa_state_machine *sm, int ap_max_chanwidth, |
| 597 | int ap_seg1_idx, int *bandwidth, int *seg1_idx); |
| 598 | |
Sunil Ravi | 38ad1ed | 2023-01-17 23:58:31 +0000 | [diff] [blame] | 599 | int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth, |
| 600 | struct wpa_state_machine *sm, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 601 | u8 *buf, size_t len); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 602 | void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm, |
| 603 | u8 *fils_anonce, u8 *fils_snonce, |
| 604 | u8 *fils_kek, size_t *fils_kek_len); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 605 | void wpa_auth_add_fils_pmk_pmkid(struct wpa_state_machine *sm, const u8 *pmk, |
| 606 | size_t pmk_len, const u8 *pmkid); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 607 | u8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm, |
| 608 | u8 *pos, size_t max_len, |
| 609 | const u8 *req_ies, size_t req_ies_len); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 610 | u8 * wpa_auth_write_assoc_resp_fils(struct wpa_state_machine *sm, |
| 611 | u8 *pos, size_t max_len, |
| 612 | const u8 *req_ies, size_t req_ies_len); |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 613 | bool wpa_auth_write_fd_rsn_info(struct wpa_authenticator *wpa_auth, |
| 614 | u8 *fd_rsn_info); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 615 | void wpa_auth_set_auth_alg(struct wpa_state_machine *sm, u16 auth_alg); |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 616 | void wpa_auth_set_rsn_override(struct wpa_state_machine *sm, bool val); |
| 617 | void wpa_auth_set_rsn_override_2(struct wpa_state_machine *sm, bool val); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 618 | void wpa_auth_set_dpp_z(struct wpa_state_machine *sm, const struct wpabuf *z); |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 619 | void wpa_auth_set_ssid_protection(struct wpa_state_machine *sm, bool val); |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 620 | void wpa_auth_set_transition_disable(struct wpa_authenticator *wpa_auth, |
| 621 | u8 val); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 622 | |
| 623 | int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce, |
| 624 | void (*cb)(void *ctx1, void *ctx2), |
| 625 | void *ctx1, void *ctx2); |
| 626 | int wpa_auth_resend_m3(struct wpa_state_machine *sm, |
| 627 | void (*cb)(void *ctx1, void *ctx2), |
| 628 | void *ctx1, void *ctx2); |
| 629 | int wpa_auth_resend_group_m1(struct wpa_state_machine *sm, |
| 630 | void (*cb)(void *ctx1, void *ctx2), |
| 631 | void *ctx1, void *ctx2); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 632 | int wpa_auth_rekey_ptk(struct wpa_authenticator *wpa_auth, |
| 633 | struct wpa_state_machine *sm); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 634 | int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 635 | int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr, |
| 636 | const u8 *data, size_t data_len, |
| 637 | int encrypt); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 638 | void wpa_auth_set_ptk_rekey_timer(struct wpa_state_machine *sm); |
Hai Shalom | b755a2a | 2020-04-23 21:49:02 -0700 | [diff] [blame] | 639 | void wpa_auth_set_ft_rsnxe_used(struct wpa_authenticator *wpa_auth, int val); |
Dmitry Shmidt | d80a401 | 2015-11-05 16:35:40 -0800 | [diff] [blame] | 640 | |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 641 | enum wpa_auth_ocv_override_frame { |
| 642 | WPA_AUTH_OCV_OVERRIDE_EAPOL_M3, |
| 643 | WPA_AUTH_OCV_OVERRIDE_EAPOL_G1, |
| 644 | WPA_AUTH_OCV_OVERRIDE_FT_ASSOC, |
| 645 | WPA_AUTH_OCV_OVERRIDE_FILS_ASSOC, |
| 646 | }; |
| 647 | void wpa_auth_set_ocv_override_freq(struct wpa_authenticator *wpa_auth, |
| 648 | enum wpa_auth_ocv_override_frame frame, |
| 649 | unsigned int freq); |
Kai Shi | e75b065 | 2020-11-24 20:31:29 -0800 | [diff] [blame] | 650 | void wpa_auth_set_skip_send_eapol(struct wpa_authenticator *wpa_auth, |
| 651 | u8 val); |
| 652 | void wpa_auth_set_enable_eapol_large_timeout(struct wpa_authenticator *wpa_auth, |
| 653 | u8 val); |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 654 | |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame] | 655 | void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success); |
| 656 | |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 657 | void wpa_auth_set_ml_info(struct wpa_state_machine *sm, |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 658 | u8 mld_assoc_link_id, struct mld_info *info); |
Sunil Ravi | 2a14cf1 | 2023-11-21 00:54:38 +0000 | [diff] [blame] | 659 | void wpa_auth_ml_get_key_info(struct wpa_authenticator *a, |
| 660 | struct wpa_auth_ml_link_key_info *info, |
| 661 | bool mgmt_frame_prot, bool beacon_prot); |
| 662 | |
Sunil Ravi | 7f76929 | 2024-07-23 22:21:32 +0000 | [diff] [blame] | 663 | void wpa_release_link_auth_ref(struct wpa_state_machine *sm, |
| 664 | int release_link_id); |
| 665 | |
| 666 | #define for_each_sm_auth(sm, link_id) \ |
| 667 | for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) \ |
| 668 | if (sm->mld_links[link_id].valid && \ |
| 669 | sm->mld_links[link_id].wpa_auth && \ |
| 670 | sm->wpa_auth != sm->mld_links[link_id].wpa_auth) |
| 671 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 672 | #endif /* WPA_AUTH_H */ |