wpa_common.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. /*
  2. * WPA definitions shared between hostapd and wpa_supplicant
  3. * Copyright (c) 2002-2015, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef WPA_COMMON_H
  9. #define WPA_COMMON_H
  10. /* IEEE 802.11i */
  11. #define PMKID_LEN 16
  12. #define PMK_LEN 32
  13. #define PMK_LEN_SUITE_B_192 48
  14. #define PMK_LEN_MAX 48
  15. #define WPA_REPLAY_COUNTER_LEN 8
  16. #define WPA_NONCE_LEN 32
  17. #define WPA_KEY_RSC_LEN 8
  18. #define WPA_GMK_LEN 32
  19. #define WPA_GTK_MAX_LEN 32
  20. #define WPA_ALLOWED_PAIRWISE_CIPHERS \
  21. (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP | WPA_CIPHER_TKIP | WPA_CIPHER_NONE | \
  22. WPA_CIPHER_GCMP_256 | WPA_CIPHER_CCMP_256)
  23. #define WPA_ALLOWED_GROUP_CIPHERS \
  24. (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP | WPA_CIPHER_TKIP | \
  25. WPA_CIPHER_GCMP_256 | WPA_CIPHER_CCMP_256 | \
  26. WPA_CIPHER_GTK_NOT_USED)
  27. #define WPA_SELECTOR_LEN 4
  28. #define WPA_VERSION 1
  29. #define RSN_SELECTOR_LEN 4
  30. #define RSN_VERSION 1
  31. #define RSN_SELECTOR(a, b, c, d) \
  32. ((((u32) (a)) << 24) | (((u32) (b)) << 16) | (((u32) (c)) << 8) | \
  33. (u32) (d))
  34. #define WPA_AUTH_KEY_MGMT_NONE RSN_SELECTOR(0x00, 0x50, 0xf2, 0)
  35. #define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X RSN_SELECTOR(0x00, 0x50, 0xf2, 1)
  36. #define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X RSN_SELECTOR(0x00, 0x50, 0xf2, 2)
  37. #define WPA_AUTH_KEY_MGMT_CCKM RSN_SELECTOR(0x00, 0x40, 0x96, 0)
  38. #define WPA_CIPHER_SUITE_NONE RSN_SELECTOR(0x00, 0x50, 0xf2, 0)
  39. #define WPA_CIPHER_SUITE_TKIP RSN_SELECTOR(0x00, 0x50, 0xf2, 2)
  40. #define WPA_CIPHER_SUITE_CCMP RSN_SELECTOR(0x00, 0x50, 0xf2, 4)
  41. #define RSN_AUTH_KEY_MGMT_UNSPEC_802_1X RSN_SELECTOR(0x00, 0x0f, 0xac, 1)
  42. #define RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X RSN_SELECTOR(0x00, 0x0f, 0xac, 2)
  43. #ifdef CONFIG_IEEE80211R
  44. #define RSN_AUTH_KEY_MGMT_FT_802_1X RSN_SELECTOR(0x00, 0x0f, 0xac, 3)
  45. #define RSN_AUTH_KEY_MGMT_FT_PSK RSN_SELECTOR(0x00, 0x0f, 0xac, 4)
  46. #endif /* CONFIG_IEEE80211R */
  47. #define RSN_AUTH_KEY_MGMT_802_1X_SHA256 RSN_SELECTOR(0x00, 0x0f, 0xac, 5)
  48. #define RSN_AUTH_KEY_MGMT_PSK_SHA256 RSN_SELECTOR(0x00, 0x0f, 0xac, 6)
  49. #define RSN_AUTH_KEY_MGMT_TPK_HANDSHAKE RSN_SELECTOR(0x00, 0x0f, 0xac, 7)
  50. #define RSN_AUTH_KEY_MGMT_SAE RSN_SELECTOR(0x00, 0x0f, 0xac, 8)
  51. #define RSN_AUTH_KEY_MGMT_FT_SAE RSN_SELECTOR(0x00, 0x0f, 0xac, 9)
  52. #define RSN_AUTH_KEY_MGMT_802_1X_SUITE_B RSN_SELECTOR(0x00, 0x0f, 0xac, 11)
  53. #define RSN_AUTH_KEY_MGMT_802_1X_SUITE_B_192 RSN_SELECTOR(0x00, 0x0f, 0xac, 12)
  54. #define RSN_AUTH_KEY_MGMT_FT_802_1X_SUITE_B_192 \
  55. RSN_SELECTOR(0x00, 0x0f, 0xac, 13)
  56. #define RSN_AUTH_KEY_MGMT_FILS_SHA256 RSN_SELECTOR(0x00, 0x0f, 0xac, 14)
  57. #define RSN_AUTH_KEY_MGMT_FILS_SHA384 RSN_SELECTOR(0x00, 0x0f, 0xac, 15)
  58. #define RSN_AUTH_KEY_MGMT_FT_FILS_SHA256 RSN_SELECTOR(0x00, 0x0f, 0xac, 16)
  59. #define RSN_AUTH_KEY_MGMT_FT_FILS_SHA384 RSN_SELECTOR(0x00, 0x0f, 0xac, 17)
  60. #define RSN_AUTH_KEY_MGMT_CCKM RSN_SELECTOR(0x00, 0x40, 0x96, 0x00)
  61. #define RSN_AUTH_KEY_MGMT_OSEN RSN_SELECTOR(0x50, 0x6f, 0x9a, 0x01)
  62. #define RSN_CIPHER_SUITE_NONE RSN_SELECTOR(0x00, 0x0f, 0xac, 0)
  63. #define RSN_CIPHER_SUITE_TKIP RSN_SELECTOR(0x00, 0x0f, 0xac, 2)
  64. #if 0
  65. #define RSN_CIPHER_SUITE_WRAP RSN_SELECTOR(0x00, 0x0f, 0xac, 3)
  66. #endif
  67. #define RSN_CIPHER_SUITE_CCMP RSN_SELECTOR(0x00, 0x0f, 0xac, 4)
  68. #define RSN_CIPHER_SUITE_AES_128_CMAC RSN_SELECTOR(0x00, 0x0f, 0xac, 6)
  69. #define RSN_CIPHER_SUITE_NO_GROUP_ADDRESSED RSN_SELECTOR(0x00, 0x0f, 0xac, 7)
  70. #define RSN_CIPHER_SUITE_GCMP RSN_SELECTOR(0x00, 0x0f, 0xac, 8)
  71. #define RSN_CIPHER_SUITE_GCMP_256 RSN_SELECTOR(0x00, 0x0f, 0xac, 9)
  72. #define RSN_CIPHER_SUITE_CCMP_256 RSN_SELECTOR(0x00, 0x0f, 0xac, 10)
  73. #define RSN_CIPHER_SUITE_BIP_GMAC_128 RSN_SELECTOR(0x00, 0x0f, 0xac, 11)
  74. #define RSN_CIPHER_SUITE_BIP_GMAC_256 RSN_SELECTOR(0x00, 0x0f, 0xac, 12)
  75. #define RSN_CIPHER_SUITE_BIP_CMAC_256 RSN_SELECTOR(0x00, 0x0f, 0xac, 13)
  76. /* EAPOL-Key Key Data Encapsulation
  77. * GroupKey and PeerKey require encryption, otherwise, encryption is optional.
  78. */
  79. #define RSN_KEY_DATA_GROUPKEY RSN_SELECTOR(0x00, 0x0f, 0xac, 1)
  80. #if 0
  81. #define RSN_KEY_DATA_STAKEY RSN_SELECTOR(0x00, 0x0f, 0xac, 2)
  82. #endif
  83. #define RSN_KEY_DATA_MAC_ADDR RSN_SELECTOR(0x00, 0x0f, 0xac, 3)
  84. #define RSN_KEY_DATA_PMKID RSN_SELECTOR(0x00, 0x0f, 0xac, 4)
  85. #ifdef CONFIG_PEERKEY
  86. #define RSN_KEY_DATA_SMK RSN_SELECTOR(0x00, 0x0f, 0xac, 5)
  87. #define RSN_KEY_DATA_NONCE RSN_SELECTOR(0x00, 0x0f, 0xac, 6)
  88. #define RSN_KEY_DATA_LIFETIME RSN_SELECTOR(0x00, 0x0f, 0xac, 7)
  89. #define RSN_KEY_DATA_ERROR RSN_SELECTOR(0x00, 0x0f, 0xac, 8)
  90. #endif /* CONFIG_PEERKEY */
  91. #ifdef CONFIG_IEEE80211W
  92. #define RSN_KEY_DATA_IGTK RSN_SELECTOR(0x00, 0x0f, 0xac, 9)
  93. #endif /* CONFIG_IEEE80211W */
  94. #define RSN_KEY_DATA_KEYID RSN_SELECTOR(0x00, 0x0f, 0xac, 10)
  95. #define RSN_KEY_DATA_MULTIBAND_GTK RSN_SELECTOR(0x00, 0x0f, 0xac, 11)
  96. #define RSN_KEY_DATA_MULTIBAND_KEYID RSN_SELECTOR(0x00, 0x0f, 0xac, 12)
  97. #define WFA_KEY_DATA_IP_ADDR_REQ RSN_SELECTOR(0x50, 0x6f, 0x9a, 4)
  98. #define WFA_KEY_DATA_IP_ADDR_ALLOC RSN_SELECTOR(0x50, 0x6f, 0x9a, 5)
  99. #define WPA_OUI_TYPE RSN_SELECTOR(0x00, 0x50, 0xf2, 1)
  100. #define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
  101. #define RSN_SELECTOR_GET(a) WPA_GET_BE32((const u8 *) (a))
  102. #define RSN_NUM_REPLAY_COUNTERS_1 0
  103. #define RSN_NUM_REPLAY_COUNTERS_2 1
  104. #define RSN_NUM_REPLAY_COUNTERS_4 2
  105. #define RSN_NUM_REPLAY_COUNTERS_16 3
  106. #ifdef _MSC_VER
  107. #pragma pack(push, 1)
  108. #endif /* _MSC_VER */
  109. #ifdef CONFIG_IEEE80211W
  110. #define WPA_IGTK_LEN 16
  111. #define WPA_IGTK_MAX_LEN 32
  112. #endif /* CONFIG_IEEE80211W */
  113. /* IEEE 802.11, 7.3.2.25.3 RSN Capabilities */
  114. #define WPA_CAPABILITY_PREAUTH BIT(0)
  115. #define WPA_CAPABILITY_NO_PAIRWISE BIT(1)
  116. /* B2-B3: PTKSA Replay Counter */
  117. /* B4-B5: GTKSA Replay Counter */
  118. #define WPA_CAPABILITY_MFPR BIT(6)
  119. #define WPA_CAPABILITY_MFPC BIT(7)
  120. /* B8: Reserved */
  121. #define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
  122. #define WPA_CAPABILITY_SPP_A_MSDU_CAPABLE BIT(10)
  123. #define WPA_CAPABILITY_SPP_A_MSDU_REQUIRED BIT(11)
  124. #define WPA_CAPABILITY_PBAC BIT(12)
  125. #define WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST BIT(13)
  126. /* B14-B15: Reserved */
  127. /* IEEE 802.11r */
  128. #define MOBILITY_DOMAIN_ID_LEN 2
  129. #define FT_R0KH_ID_MAX_LEN 48
  130. #define FT_R1KH_ID_LEN 6
  131. #define WPA_PMK_NAME_LEN 16
  132. /* IEEE 802.11, 8.5.2 EAPOL-Key frames */
  133. #define WPA_KEY_INFO_TYPE_MASK ((u16) (BIT(0) | BIT(1) | BIT(2)))
  134. #define WPA_KEY_INFO_TYPE_AKM_DEFINED 0
  135. #define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 BIT(0)
  136. #define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES BIT(1)
  137. #define WPA_KEY_INFO_TYPE_AES_128_CMAC 3
  138. #define WPA_KEY_INFO_KEY_TYPE BIT(3) /* 1 = Pairwise, 0 = Group key */
  139. /* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */
  140. #define WPA_KEY_INFO_KEY_INDEX_MASK (BIT(4) | BIT(5))
  141. #define WPA_KEY_INFO_KEY_INDEX_SHIFT 4
  142. #define WPA_KEY_INFO_INSTALL BIT(6) /* pairwise */
  143. #define WPA_KEY_INFO_TXRX BIT(6) /* group */
  144. #define WPA_KEY_INFO_ACK BIT(7)
  145. #define WPA_KEY_INFO_MIC BIT(8)
  146. #define WPA_KEY_INFO_SECURE BIT(9)
  147. #define WPA_KEY_INFO_ERROR BIT(10)
  148. #define WPA_KEY_INFO_REQUEST BIT(11)
  149. #define WPA_KEY_INFO_ENCR_KEY_DATA BIT(12) /* IEEE 802.11i/RSN only */
  150. #define WPA_KEY_INFO_SMK_MESSAGE BIT(13)
  151. struct wpa_eapol_key {
  152. u8 type;
  153. /* Note: key_info, key_length, and key_data_length are unaligned */
  154. u8 key_info[2]; /* big endian */
  155. u8 key_length[2]; /* big endian */
  156. u8 replay_counter[WPA_REPLAY_COUNTER_LEN];
  157. u8 key_nonce[WPA_NONCE_LEN];
  158. u8 key_iv[16];
  159. u8 key_rsc[WPA_KEY_RSC_LEN];
  160. u8 key_id[8]; /* Reserved in IEEE 802.11i/RSN */
  161. u8 key_mic[16];
  162. u8 key_data_length[2]; /* big endian */
  163. /* followed by key_data_length bytes of key_data */
  164. } STRUCT_PACKED;
  165. struct wpa_eapol_key_192 {
  166. u8 type;
  167. /* Note: key_info, key_length, and key_data_length are unaligned */
  168. u8 key_info[2]; /* big endian */
  169. u8 key_length[2]; /* big endian */
  170. u8 replay_counter[WPA_REPLAY_COUNTER_LEN];
  171. u8 key_nonce[WPA_NONCE_LEN];
  172. u8 key_iv[16];
  173. u8 key_rsc[WPA_KEY_RSC_LEN];
  174. u8 key_id[8]; /* Reserved in IEEE 802.11i/RSN */
  175. u8 key_mic[24];
  176. u8 key_data_length[2]; /* big endian */
  177. /* followed by key_data_length bytes of key_data */
  178. } STRUCT_PACKED;
  179. #define WPA_EAPOL_KEY_MIC_MAX_LEN 24
  180. #define WPA_KCK_MAX_LEN 24
  181. #define WPA_KEK_MAX_LEN 64
  182. #define WPA_TK_MAX_LEN 32
  183. /**
  184. * struct wpa_ptk - WPA Pairwise Transient Key
  185. * IEEE Std 802.11i-2004 - 8.5.1.2 Pairwise key hierarchy
  186. */
  187. struct wpa_ptk {
  188. u8 kck[WPA_KCK_MAX_LEN]; /* EAPOL-Key Key Confirmation Key (KCK) */
  189. u8 kek[WPA_KEK_MAX_LEN]; /* EAPOL-Key Key Encryption Key (KEK) */
  190. u8 tk[WPA_TK_MAX_LEN]; /* Temporal Key (TK) */
  191. size_t kck_len;
  192. size_t kek_len;
  193. size_t tk_len;
  194. };
  195. /* WPA IE version 1
  196. * 00-50-f2:1 (OUI:OUI type)
  197. * 0x01 0x00 (version; little endian)
  198. * (all following fields are optional:)
  199. * Group Suite Selector (4 octets) (default: TKIP)
  200. * Pairwise Suite Count (2 octets, little endian) (default: 1)
  201. * Pairwise Suite List (4 * n octets) (default: TKIP)
  202. * Authenticated Key Management Suite Count (2 octets, little endian)
  203. * (default: 1)
  204. * Authenticated Key Management Suite List (4 * n octets)
  205. * (default: unspec 802.1X)
  206. * WPA Capabilities (2 octets, little endian) (default: 0)
  207. */
  208. struct wpa_ie_hdr {
  209. u8 elem_id;
  210. u8 len;
  211. u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
  212. u8 version[2]; /* little endian */
  213. } STRUCT_PACKED;
  214. /* 1/4: PMKID
  215. * 2/4: RSN IE
  216. * 3/4: one or two RSN IEs + GTK IE (encrypted)
  217. * 4/4: empty
  218. * 1/2: GTK IE (encrypted)
  219. * 2/2: empty
  220. */
  221. /* RSN IE version 1
  222. * 0x01 0x00 (version; little endian)
  223. * (all following fields are optional:)
  224. * Group Suite Selector (4 octets) (default: CCMP)
  225. * Pairwise Suite Count (2 octets, little endian) (default: 1)
  226. * Pairwise Suite List (4 * n octets) (default: CCMP)
  227. * Authenticated Key Management Suite Count (2 octets, little endian)
  228. * (default: 1)
  229. * Authenticated Key Management Suite List (4 * n octets)
  230. * (default: unspec 802.1X)
  231. * RSN Capabilities (2 octets, little endian) (default: 0)
  232. * PMKID Count (2 octets) (default: 0)
  233. * PMKID List (16 * n octets)
  234. * Management Group Cipher Suite (4 octets) (default: AES-128-CMAC)
  235. */
  236. struct rsn_ie_hdr {
  237. u8 elem_id; /* WLAN_EID_RSN */
  238. u8 len;
  239. u8 version[2]; /* little endian */
  240. } STRUCT_PACKED;
  241. #ifdef CONFIG_PEERKEY
  242. enum {
  243. STK_MUI_4WAY_STA_AP = 1,
  244. STK_MUI_4WAY_STAT_STA = 2,
  245. STK_MUI_GTK = 3,
  246. STK_MUI_SMK = 4
  247. };
  248. enum {
  249. STK_ERR_STA_NR = 1,
  250. STK_ERR_STA_NRSN = 2,
  251. STK_ERR_CPHR_NS = 3,
  252. STK_ERR_NO_STSL = 4
  253. };
  254. #endif /* CONFIG_PEERKEY */
  255. struct rsn_error_kde {
  256. be16 mui;
  257. be16 error_type;
  258. } STRUCT_PACKED;
  259. #ifdef CONFIG_IEEE80211W
  260. #define WPA_IGTK_KDE_PREFIX_LEN (2 + 6)
  261. struct wpa_igtk_kde {
  262. u8 keyid[2];
  263. u8 pn[6];
  264. u8 igtk[WPA_IGTK_MAX_LEN];
  265. } STRUCT_PACKED;
  266. #endif /* CONFIG_IEEE80211W */
  267. struct rsn_mdie {
  268. u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
  269. u8 ft_capab;
  270. } STRUCT_PACKED;
  271. #define RSN_FT_CAPAB_FT_OVER_DS BIT(0)
  272. #define RSN_FT_CAPAB_FT_RESOURCE_REQ_SUPP BIT(1)
  273. struct rsn_ftie {
  274. u8 mic_control[2];
  275. u8 mic[16];
  276. u8 anonce[WPA_NONCE_LEN];
  277. u8 snonce[WPA_NONCE_LEN];
  278. /* followed by optional parameters */
  279. } STRUCT_PACKED;
  280. #define FTIE_SUBELEM_R1KH_ID 1
  281. #define FTIE_SUBELEM_GTK 2
  282. #define FTIE_SUBELEM_R0KH_ID 3
  283. #define FTIE_SUBELEM_IGTK 4
  284. struct rsn_rdie {
  285. u8 id;
  286. u8 descr_count;
  287. le16 status_code;
  288. } STRUCT_PACKED;
  289. #ifdef _MSC_VER
  290. #pragma pack(pop)
  291. #endif /* _MSC_VER */
  292. int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver,
  293. const u8 *buf, size_t len, u8 *mic);
  294. int wpa_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const char *label,
  295. const u8 *addr1, const u8 *addr2,
  296. const u8 *nonce1, const u8 *nonce2,
  297. struct wpa_ptk *ptk, int akmp, int cipher);
  298. #ifdef CONFIG_IEEE80211R
  299. int wpa_ft_mic(const u8 *kck, size_t kck_len, const u8 *sta_addr,
  300. const u8 *ap_addr, u8 transaction_seqnum,
  301. const u8 *mdie, size_t mdie_len,
  302. const u8 *ftie, size_t ftie_len,
  303. const u8 *rsnie, size_t rsnie_len,
  304. const u8 *ric, size_t ric_len, u8 *mic);
  305. void wpa_derive_pmk_r0(const u8 *xxkey, size_t xxkey_len,
  306. const u8 *ssid, size_t ssid_len,
  307. const u8 *mdid, const u8 *r0kh_id, size_t r0kh_id_len,
  308. const u8 *s0kh_id, u8 *pmk_r0, u8 *pmk_r0_name);
  309. void wpa_derive_pmk_r1_name(const u8 *pmk_r0_name, const u8 *r1kh_id,
  310. const u8 *s1kh_id, u8 *pmk_r1_name);
  311. void wpa_derive_pmk_r1(const u8 *pmk_r0, const u8 *pmk_r0_name,
  312. const u8 *r1kh_id, const u8 *s1kh_id,
  313. u8 *pmk_r1, u8 *pmk_r1_name);
  314. int wpa_pmk_r1_to_ptk(const u8 *pmk_r1, const u8 *snonce, const u8 *anonce,
  315. const u8 *sta_addr, const u8 *bssid,
  316. const u8 *pmk_r1_name,
  317. struct wpa_ptk *ptk, u8 *ptk_name, int akmp, int cipher);
  318. #endif /* CONFIG_IEEE80211R */
  319. struct wpa_ie_data {
  320. int proto;
  321. int pairwise_cipher;
  322. int group_cipher;
  323. int key_mgmt;
  324. int capabilities;
  325. size_t num_pmkid;
  326. const u8 *pmkid;
  327. int mgmt_group_cipher;
  328. };
  329. int wpa_parse_wpa_ie_rsn(const u8 *rsn_ie, size_t rsn_ie_len,
  330. struct wpa_ie_data *data);
  331. int wpa_parse_wpa_ie_wpa(const u8 *wpa_ie, size_t wpa_ie_len,
  332. struct wpa_ie_data *data);
  333. void rsn_pmkid(const u8 *pmk, size_t pmk_len, const u8 *aa, const u8 *spa,
  334. u8 *pmkid, int use_sha256);
  335. #ifdef CONFIG_SUITEB
  336. int rsn_pmkid_suite_b(const u8 *kck, size_t kck_len, const u8 *aa,
  337. const u8 *spa, u8 *pmkid);
  338. #else /* CONFIG_SUITEB */
  339. static inline int rsn_pmkid_suite_b(const u8 *kck, size_t kck_len, const u8 *aa,
  340. const u8 *spa, u8 *pmkid)
  341. {
  342. return -1;
  343. }
  344. #endif /* CONFIG_SUITEB */
  345. #ifdef CONFIG_SUITEB192
  346. int rsn_pmkid_suite_b_192(const u8 *kck, size_t kck_len, const u8 *aa,
  347. const u8 *spa, u8 *pmkid);
  348. #else /* CONFIG_SUITEB192 */
  349. static inline int rsn_pmkid_suite_b_192(const u8 *kck, size_t kck_len,
  350. const u8 *aa, const u8 *spa, u8 *pmkid)
  351. {
  352. return -1;
  353. }
  354. #endif /* CONFIG_SUITEB192 */
  355. const char * wpa_cipher_txt(int cipher);
  356. const char * wpa_key_mgmt_txt(int key_mgmt, int proto);
  357. u32 wpa_akm_to_suite(int akm);
  358. int wpa_compare_rsn_ie(int ft_initial_assoc,
  359. const u8 *ie1, size_t ie1len,
  360. const u8 *ie2, size_t ie2len);
  361. int wpa_insert_pmkid(u8 *ies, size_t *ies_len, const u8 *pmkid);
  362. struct wpa_ft_ies {
  363. const u8 *mdie;
  364. size_t mdie_len;
  365. const u8 *ftie;
  366. size_t ftie_len;
  367. const u8 *r1kh_id;
  368. const u8 *gtk;
  369. size_t gtk_len;
  370. const u8 *r0kh_id;
  371. size_t r0kh_id_len;
  372. const u8 *rsn;
  373. size_t rsn_len;
  374. const u8 *rsn_pmkid;
  375. const u8 *tie;
  376. size_t tie_len;
  377. const u8 *igtk;
  378. size_t igtk_len;
  379. const u8 *ric;
  380. size_t ric_len;
  381. int key_mgmt;
  382. int pairwise_cipher;
  383. };
  384. int wpa_ft_parse_ies(const u8 *ies, size_t ies_len, struct wpa_ft_ies *parse);
  385. int wpa_cipher_key_len(int cipher);
  386. int wpa_cipher_rsc_len(int cipher);
  387. int wpa_cipher_to_alg(int cipher);
  388. int wpa_cipher_valid_group(int cipher);
  389. int wpa_cipher_valid_pairwise(int cipher);
  390. int wpa_cipher_valid_mgmt_group(int cipher);
  391. u32 wpa_cipher_to_suite(int proto, int cipher);
  392. int rsn_cipher_put_suites(u8 *pos, int ciphers);
  393. int wpa_cipher_put_suites(u8 *pos, int ciphers);
  394. int wpa_pick_pairwise_cipher(int ciphers, int none_allowed);
  395. int wpa_pick_group_cipher(int ciphers);
  396. int wpa_parse_cipher(const char *value);
  397. int wpa_write_ciphers(char *start, char *end, int ciphers, const char *delim);
  398. int wpa_select_ap_group_cipher(int wpa, int wpa_pairwise, int rsn_pairwise);
  399. unsigned int wpa_mic_len(int akmp);
  400. u16 fils_domain_name_hash(const char *domain);
  401. #endif /* WPA_COMMON_H */