wpa_common.h 15 KB

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