1 /* 2 * Fundamental types and constants relating to FILS AUTHENTICATION 3 * Copyright (C) 1999-2019, Broadcom. 4 * 5 * Unless you and Broadcom execute a separate written software license 6 * agreement governing use of this software, this software is licensed to you 7 * under the terms of the GNU General Public License version 2 (the "GPL"), 8 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 9 * following added to such license: 10 * 11 * As a special exception, the copyright holders of this software give you 12 * permission to link this software with independent modules, and to copy and 13 * distribute the resulting executable under terms of your choice, provided that 14 * you also meet, for each linked independent module, the terms and conditions 15 * of the license of that module. An independent module is a module which is 16 * not derived from this software. The special exception does not apply to any 17 * modifications of the software. 18 * 19 * Notwithstanding the above, under no circumstances may you combine this 20 * software in any way with any other Broadcom software provided under a license 21 * other than the GPL, without Broadcom's express prior written consent. 22 * 23 * 24 * <<Broadcom-WL-IPTag/Open:>> 25 * 26 * $Id$ 27 */ 28 29 #ifndef _FILSAUTH_H_ 30 #define _FILSAUTH_H_ 31 32 /* This marks the start of a packed structure section. */ 33 #include <packed_section_start.h> 34 35 /* 11ai D6.0 8.6.8.36 FILS Discovery frame format 36 category 37 action 38 fils_discovery_info_field_t 39 fils_rnr_element_t 40 fils_indication_element_t 41 fils_vendor_specific_element_t 42 */ 43 44 /* 11revmc D4.0 8.4.2.25 Vendor Specific element */ 45 typedef BWL_PRE_PACKED_STRUCT struct fils_vendor_specific_element { 46 uint8 elementid; 47 uint8 length; 48 /* variable len info */ 49 uint8 orgid_vendorspecific_content[]; 50 } BWL_POST_PACKED_STRUCT fils_vendor_specific_element_t; 51 52 #define FILS_VS_ELEM_HDR_LEN (sizeof(fils_vendor_specific_element_t)) 53 54 /* 11ai D6.0 8.4.2.178 FILS Indication element */ 55 typedef BWL_PRE_PACKED_STRUCT struct fils_indication_element { 56 uint8 elementid; 57 uint8 length; 58 uint16 fils_info; 59 /* variable len info */ 60 uint8 cache_domain_publickey_id[]; 61 } BWL_POST_PACKED_STRUCT fils_indication_element_t; 62 63 #define FILS_INDICATION_ELEM_HDR_LEN (sizeof(fils_indication_element_t)) 64 65 #define FILS_INDICATION_IE_TAG_FIXED_LEN 2 66 67 #define FI_INFO_CACHE_IND_SUBFIELD_SIZE 2 68 69 /* FILS Indication Information field */ 70 #define FI_INFO_PUB_KEY_IDENTS_MASK (0x0007) 71 #define FI_INFO_REALM_IDENTS_MASK (0x0038) 72 #define FI_INFO_IP_ADDR_CFG_MASK (0x0040) 73 #define FI_INFO_CACHE_IDENT_MASK (0x0080) 74 #define FI_INFO_HESSID_MASK (0x0100) 75 #define FI_INFO_SHRKEY_AUTH_WOPFS_MASK (0x0200) 76 #define FI_INFO_SHRKEY_AUTH_WPFS_MASK (0x0400) 77 #define FI_INFO_PUBKEY_AUTH_MASK (0x0800) 78 79 #define FI_INFO_CACHE_IDENT(fc) ((fc & FI_INFO_CACHE_IDENT_MASK)) 80 #define FI_INFO_HESSID(fc) ((fc & FI_INFO_HESSID_MASK)) 81 #define FI_INFO_SHRKEY_AUTH_WOPFS(fc) ((fc & FI_INFO_SHRKEY_AUTH_WOPFS_MASK)) 82 #define FI_INFO_SHRKEY_AUTH_WPFS(fc) ((fc & FI_INFO_SHRKEY_AUTH_WPFS_MASK)) 83 84 /* 11ai D11.0 9.4.2.171.1 TBTT Information field */ 85 typedef BWL_PRE_PACKED_STRUCT struct tbtt_info_field { 86 uint8 tbtt_offset; 87 uint8 bssid[ETHER_ADDR_LEN]; 88 uint32 short_ssid; 89 } BWL_POST_PACKED_STRUCT tbtt_info_field_t; 90 91 #define TBTT_INFO_FIELD_HDR_LEN (sizeof(tbtt_info_field_t)) 92 93 /* 11ai D11.0 9.4.2.171.1 Neighbor AP Information field */ 94 typedef BWL_PRE_PACKED_STRUCT struct neighbor_ap_info_field { 95 uint16 tbtt_info_header; 96 uint8 op_class; 97 uint8 channel; 98 /* variable len info */ 99 uint8 tbtt_info_field[]; 100 } BWL_POST_PACKED_STRUCT neighbor_ap_info_field_t; 101 102 #define NEIGHBOR_AP_INFO_FIELD_HDR_LEN (sizeof(neighbor_ap_info_field_t)) 103 104 /* 11ai D11.0 9.4.2.171 Reduced Neighbor Report element */ 105 typedef BWL_PRE_PACKED_STRUCT struct fils_rnr_element { 106 uint8 elementid; 107 uint8 length; 108 /* variable len info */ 109 uint8 neighbor_ap_info[]; 110 } BWL_POST_PACKED_STRUCT fils_rnr_element_t; 111 112 #define FILS_RNR_ELEM_HDR_LEN (sizeof(fils_rnr_element_t)) 113 114 /* TBTT Info Header macros */ 115 #define TBTT_INFO_HDR_FIELD_TYPE_MASK (0x001f) 116 #define TBTT_INFO_HDR_FN_AP_MASK (0x0004) 117 #define TBTT_INFO_HDR_COUNT_MASK (0x00f0) 118 #define TBTT_INFO_HDR_LENGTH_MASK (0xff00) 119 120 #define TBTT_INFO_HDR_FIELD_TYPE(hdr) ((hdr)&TBTT_INFO_HDR_FIELD_TYPE_MASK) 121 #define TBTT_INFO_HDR_FN_AP(hdr) (((hdr)&TBTT_INFO_HDR_FN_AP_MASK) >> 2) 122 #define TBTT_INFO_HDR_COUNT(hdr) (((hdr)&TBTT_INFO_HDR_COUNT_MASK) >> 4) 123 #define TBTT_INFO_HDR_LENGTH(hdr) (((hdr)&TBTT_INFO_HDR_LENGTH_MASK) >> 8) 124 125 /* FILS Nonce element */ 126 #define FILS_NONCE_LENGTH 16u 127 128 typedef BWL_PRE_PACKED_STRUCT struct fils_nonce_element { 129 uint8 elementid; 130 uint8 length; 131 uint8 element_id_ext; 132 uint8 fils_nonce[FILS_NONCE_LENGTH]; 133 } BWL_POST_PACKED_STRUCT fils_nonce_element_t; 134 135 /* 11ai 9.4.2.186 FILS Key Delivery element */ 136 #define FILS_KEY_RSC_LENGTH 8u 137 138 typedef BWL_PRE_PACKED_STRUCT struct fils_key_delivery_element { 139 uint8 elementid; 140 uint8 length; 141 uint8 element_id_ext; 142 uint8 key_rsc[FILS_KEY_RSC_LENGTH]; 143 uint8 kde_list[]; /* Key Data Elements */ 144 } BWL_POST_PACKED_STRUCT fils_key_delivery_element_t; 145 146 /* 8.4.2.175 FILS Session element */ 147 #define FILS_SESSION_LENGTH 8u 148 149 typedef BWL_PRE_PACKED_STRUCT struct fils_session_element { 150 uint8 elementid; 151 uint8 length; 152 uint8 element_id_ext; 153 uint8 fils_session[FILS_SESSION_LENGTH]; 154 } BWL_POST_PACKED_STRUCT fils_session_element_t; 155 156 /* 9.4.2.179 FILS key confirmation element */ 157 #define FILS_KEY_CONFIRMATION_HEADER_LEN 3u 158 159 typedef BWL_PRE_PACKED_STRUCT struct fils_key_conf_element { 160 uint8 elementid; 161 uint8 length; 162 uint8 element_id_ext; 163 /* variable len info */ 164 uint8 key_auth[]; 165 } BWL_POST_PACKED_STRUCT fils_key_conf_element_t; 166 167 #define FILS_SESSION_ELEM_LEN (sizeof(fils_session_element_t)) 168 169 /* 8.4.2.174 FILS Key Confirmation element */ 170 typedef BWL_PRE_PACKED_STRUCT struct fils_key_confirm_element { 171 uint8 elementid; 172 uint8 length; 173 uint8 element_id_ext; 174 /* variable len info */ 175 uint8 keyauth[]; 176 } BWL_POST_PACKED_STRUCT fils_key_confirm_element_t; 177 178 #define FILS_CONFIRM_ELEM_HDR_LEN (sizeof(fils_key_confirm_element_t)) 179 180 /* 11ai D6.0 8.6.8.36 FILS Discovery frame format */ 181 typedef BWL_PRE_PACKED_STRUCT struct fils_discovery_info_field { 182 uint16 framecontrol; 183 uint32 timestamp[2]; 184 uint16 bcninterval; 185 /* variable len info */ 186 uint8 disc_info[]; 187 } BWL_POST_PACKED_STRUCT fils_discovery_info_field_t; 188 189 #define FD_INFO_FIELD_HDR_LEN (sizeof(fils_discovery_info_field_t)) 190 191 #define FD_INFO_CAP_SUBFIELD_SIZE 2 192 #define FD_INFO_LENGTH_FIELD_SIZE 2 193 194 /* FILS Discovery Information field */ 195 #define FD_INFO_SSID_LENGTH_MASK (0x001f) 196 #define FD_INFO_CAP_IND_MASK (0x0020) 197 #define FD_INFO_SHORT_SSID_IND_MASK (0x0040) 198 #define FD_INFO_APCSN_IND_MASK (0x0080) 199 #define FD_INFO_ANO_IND_MASK (0x0100) 200 #define FD_INFO_CH_CENTER_FR_IND_MASK (0x0200) 201 #define FD_INFO_PRIMARY_CH_IND_MASK (0x0400) 202 #define FD_INFO_RSN_IND_MASK (0x0800) 203 #define FD_INFO_LENGTH_IND_MASK (0x1000) 204 #define FD_INFO_MD_IND_MASK (0x2000) 205 206 #define FD_INFO_SET_SSID_LENGTH(fc, len) \ 207 (fc |= ((uint16)(len)&FD_INFO_SSID_LENGTH_MASK)) 208 #define FD_INFO_SET_CAP_PRESENT(fc) (fc |= FD_INFO_CAP_IND_MASK) 209 #define FD_INFO_SET_SHORT_SSID_PRESENT(fc) (fc |= FD_INFO_SHORT_SSID_IND_MASK) 210 #define FD_INFO_SET_APCSN_PRESENT(fc) ((fc |= FD_INFO_APCSN_IND_MASK) 211 #define FD_INFO_SET_ANO_PRESENT(fc) (fc |= FD_INFO_ANO_IND_MASK) 212 #define FD_INFO_SET_CH_CENTER_FR_PRESENT(fc) \ 213 (fc |= FD_INFO_CH_CENTER_FR_IND_MASK) 214 #define FD_INFO_SET_PRIMARY_CH_PRESENT(fc) (fc |= FD_INFO_PRIMARY_CH_IND_MASK) 215 #define FD_INFO_SET_RSN_PRESENT(fc) (fc |= FD_INFO_RSN_IND_MASK) 216 #define FD_INFO_SET_LENGTH_PRESENT(fc) (fc |= FD_INFO_LENGTH_IND_MASK) 217 #define FD_INFO_SET_MD_PRESENT(fc) (fc |= FD_INFO_MD_IND_MASK) 218 219 #define FD_INFO_SSID_LENGTH(fc) ((fc & FD_INFO_SSID_LENGTH_MASK)) 220 #define FD_INFO_IS_CAP_PRESENT(fc) ((fc & FD_INFO_CAP_IND_MASK) >> 5) 221 #define FD_INFO_IS_SHORT_SSID_PRESENT(fc) \ 222 ((fc & FD_INFO_SHORT_SSID_IND_MASK) >> 6) 223 #define FD_INFO_IS_APCSN_PRESENT(fc) ((fc & FD_INFO_APCSN_IND_MASK) >> 7) 224 #define FD_INFO_IS_ANO_PRESENT(fc) ((fc & FD_INFO_ANO_IND_MASK) >> 8) 225 #define FD_INFO_IS_CH_CENTER_FR_PRESENT(fc) \ 226 ((fc & FD_INFO_CH_CENTER_FR_IND_MASK) >> 9) 227 #define FD_INFO_IS_PRIMARY_CH_PRESENT(fc) \ 228 ((fc & FD_INFO_PRIMARY_CH_IND_MASK) >> 10) 229 #define FD_INFO_IS_RSN_PRESENT(fc) ((fc & FD_INFO_RSN_IND_MASK) >> 11) 230 #define FD_INFO_IS_LENGTH_PRESENT(fc) ((fc & FD_INFO_LENGTH_IND_MASK) >> 12) 231 #define FD_INFO_IS_MD_PRESENT(fc) ((fc & FD_INFO_MD_IND_MASK) >> 13) 232 233 /* FILS Discovery Capability subfield */ 234 #define FD_CAP_ESS_MASK (0x0001) 235 #define FD_CAP_PRIVACY_MASK (0x0002) 236 #define FD_CAP_BSS_CH_WIDTH_MASK (0x001c) 237 #define FD_CAP_MAX_NSS_MASK (0x00e0) 238 #define FD_CAP_MULTI_BSS_MASK (0x0200) 239 #define FD_CAP_PHY_INDEX_MASK (0x1c00) 240 #define FD_CAP_FILS_MIN_RATE_MASK (0xe000) 241 242 #define FD_CAP_ESS(cap) ((cap & FD_CAP_ESS_MASK)) 243 #define FD_CAP_PRIVACY(cap) ((cap & FD_CAP_PRIVACY_MASK) >> 1) 244 #define FD_CAP_BSS_CH_WIDTH(cap) ((cap & FD_CAP_BSS_CH_WIDTH_MASK) >> 2) 245 #define FD_CAP_MAX_NSS(cap) ((cap & FD_CAP_MAX_NSS_MASK) >> 5) 246 #define FD_CAP_MULTI_BSS(cap) ((cap & FD_CAP_MULTI_BSS_MASK) >> 9) 247 #define FD_CAP_PHY_INDEX(cap) ((cap & FD_CAP_PHY_INDEX_MASK) >> 10) 248 #define FD_CAP_FILS_MIN_RATE(cap) ((cap & FD_CAP_FILS_MIN_RATE_MASK) >> 13) 249 250 #define FD_CAP_SET_ESS(cap) ((cap |= FD_CAP_ESS_MASK)) 251 #define FD_CAP_SET_PRIVACY(cap) ((cap & FD_CAP_PRIVACY_MASK) >> 1) 252 #define FD_CAP_SET_BSS_CH_WIDTH(cap) ((cap & FD_CAP_BSS_CH_WIDTH_MASK) >> 2) 253 #define FD_CAP_SET_MAX_NSS(cap) ((cap & FD_CAP_MAX_NSS_MASK) >> 5) 254 #define FD_CAP_SET_MULTI_BSS(cap) ((cap & FD_CAP_MULTI_BSS_MASK) >> 9) 255 #define FD_CAP_SET_PHY_INDEX(cap) ((cap & FD_CAP_PHY_INDEX_MASK) >> 10) 256 #define FD_CAP_SET_FILS_MIN_RATE(cap) ((cap & FD_CAP_FILS_MIN_RATE_MASK) >> 13) 257 258 /* 11ai D6.0 8.4.2.173 FILS Request Parameters element */ 259 typedef BWL_PRE_PACKED_STRUCT struct fils_request_parameters_element { 260 uint8 elementid; 261 uint8 length; 262 uint8 element_id_ext; 263 uint8 params_bitmap; 264 /* variable len info */ 265 uint8 params_fields[]; 266 } BWL_POST_PACKED_STRUCT fils_request_parameters_element_t; 267 268 #define FILS_PARAM_MAX_CHANNEL_TIME (1 << 2) 269 270 /* 11ai 9.4.2.184 FILS HLP Container element */ 271 typedef BWL_PRE_PACKED_STRUCT struct fils_hlp_container_element { 272 uint8 elementid; 273 uint8 length; 274 uint8 element_id_ext; 275 uint8 dest_addr[ETHER_ADDR_LEN]; 276 uint8 src_addr[ETHER_ADDR_LEN]; 277 /* variable len hlp packet */ 278 uint8 hlp[]; 279 } BWL_POST_PACKED_STRUCT fils_hlp_container_element_t; 280 281 /* 11ai 9.4.2.184 FILS Wrapped Data element */ 282 typedef BWL_PRE_PACKED_STRUCT struct fils_wrapped_data_element { 283 uint8 elementid; 284 uint8 length; 285 uint8 element_id_ext; 286 /* variable len wrapped data packet */ 287 uint8 wrapped_data[]; 288 } BWL_POST_PACKED_STRUCT fils_wrapped_data_element_t; 289 290 #define FILS_HLP_CONTAINER_ELEM_LEN (sizeof(fils_hlp_container_element_t)) 291 292 /* This marks the end of a packed structure section. */ 293 #include <packed_section_end.h> 294 295 #endif /* __FILSAUTH_H__ */ 296