PageRenderTime 103ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/bcmdhd/src/include/proto/wpa.h

https://gitlab.com/SerenityS/msm8974_G2_render_kernel
C Header | 214 lines | 139 code | 32 blank | 43 comment | 23 complexity | b0da14643a140de97b92ef133697ad64 MD5 | raw file
  1. /*
  2. * Fundamental types and constants relating to WPA
  3. *
  4. * Copyright (C) 1999-2013, Broadcom Corporation
  5. *
  6. * Unless you and Broadcom execute a separate written software license
  7. * agreement governing use of this software, this software is licensed to you
  8. * under the terms of the GNU General Public License version 2 (the "GPL"),
  9. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  10. * following added to such license:
  11. *
  12. * As a special exception, the copyright holders of this software give you
  13. * permission to link this software with independent modules, and to copy and
  14. * distribute the resulting executable under terms of your choice, provided that
  15. * you also meet, for each linked independent module, the terms and conditions of
  16. * the license of that module. An independent module is a module which is not
  17. * derived from this software. The special exception does not apply to any
  18. * modifications of the software.
  19. *
  20. * Notwithstanding the above, under no circumstances may you combine this
  21. * software in any way with any other Broadcom software provided under a license
  22. * other than the GPL, without Broadcom's express prior written consent.
  23. *
  24. * $Id: wpa.h 384536 2013-02-12 04:13:09Z $
  25. */
  26. #ifndef _proto_wpa_h_
  27. #define _proto_wpa_h_
  28. #include <typedefs.h>
  29. #include <proto/ethernet.h>
  30. /* This marks the start of a packed structure section. */
  31. #include <packed_section_start.h>
  32. /* Reason Codes */
  33. /* 13 through 23 taken from IEEE Std 802.11i-2004 */
  34. #define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */
  35. #define DOT11_RC_MIC_FAILURE 14 /* Michael failure */
  36. #define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */
  37. #define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */
  38. #define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from
  39. * (re-)assoc. request/probe response
  40. */
  41. #define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */
  42. #define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */
  43. #define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */
  44. #define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */
  45. #define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */
  46. #define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */
  47. #define WPA2_PMKID_LEN 16
  48. /* WPA IE fixed portion */
  49. typedef BWL_PRE_PACKED_STRUCT struct
  50. {
  51. uint8 tag; /* TAG */
  52. uint8 length; /* TAG length */
  53. uint8 oui[3]; /* IE OUI */
  54. uint8 oui_type; /* OUI type */
  55. BWL_PRE_PACKED_STRUCT struct {
  56. uint8 low;
  57. uint8 high;
  58. } BWL_POST_PACKED_STRUCT version; /* IE version */
  59. } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
  60. #define WPA_IE_OUITYPE_LEN 4
  61. #define WPA_IE_FIXED_LEN 8
  62. #define WPA_IE_TAG_FIXED_LEN 6
  63. typedef BWL_PRE_PACKED_STRUCT struct {
  64. uint8 tag; /* TAG */
  65. uint8 length; /* TAG length */
  66. BWL_PRE_PACKED_STRUCT struct {
  67. uint8 low;
  68. uint8 high;
  69. } BWL_POST_PACKED_STRUCT version; /* IE version */
  70. } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
  71. #define WPA_RSN_IE_FIXED_LEN 4
  72. #define WPA_RSN_IE_TAG_FIXED_LEN 2
  73. typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
  74. /* WPA suite/multicast suite */
  75. typedef BWL_PRE_PACKED_STRUCT struct
  76. {
  77. uint8 oui[3];
  78. uint8 type;
  79. } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
  80. #define WPA_SUITE_LEN 4
  81. /* WPA unicast suite list/key management suite list */
  82. typedef BWL_PRE_PACKED_STRUCT struct
  83. {
  84. BWL_PRE_PACKED_STRUCT struct {
  85. uint8 low;
  86. uint8 high;
  87. } BWL_POST_PACKED_STRUCT count;
  88. wpa_suite_t list[1];
  89. } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
  90. #define WPA_IE_SUITE_COUNT_LEN 2
  91. typedef BWL_PRE_PACKED_STRUCT struct
  92. {
  93. BWL_PRE_PACKED_STRUCT struct {
  94. uint8 low;
  95. uint8 high;
  96. } BWL_POST_PACKED_STRUCT count;
  97. wpa_pmkid_t list[1];
  98. } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
  99. /* WPA cipher suites */
  100. #define WPA_CIPHER_NONE 0 /* None */
  101. #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
  102. #define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */
  103. #define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */
  104. #define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */
  105. #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
  106. #define WPA_CIPHER_BIP 6 /* WEP (104-bit) */
  107. #define WPA_CIPHER_TPK 7 /* Group addressed traffic not allowed */
  108. #ifdef BCMCCX
  109. #define WPA_CIPHER_CKIP 8 /* KP with no MIC */
  110. #define WPA_CIPHER_CKIP_MMH 9 /* KP with MIC ("CKIP/MMH", "CKIP+CMIC") */
  111. #define WPA_CIPHER_WEP_MMH 10 /* MIC with no KP ("WEP/MMH", "CMIC") */
  112. #define IS_CCX_CIPHER(cipher) ((cipher) == WPA_CIPHER_CKIP || \
  113. (cipher) == WPA_CIPHER_CKIP_MMH || \
  114. (cipher) == WPA_CIPHER_WEP_MMH)
  115. #endif
  116. #ifdef BCMWAPI_WAI
  117. #define WAPI_CIPHER_NONE WPA_CIPHER_NONE
  118. #define WAPI_CIPHER_SMS4 11
  119. #define WAPI_CSE_WPI_SMS4 1
  120. #endif /* BCMWAPI_WAI */
  121. #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
  122. (cipher) == WPA_CIPHER_WEP_40 || \
  123. (cipher) == WPA_CIPHER_WEP_104 || \
  124. (cipher) == WPA_CIPHER_TKIP || \
  125. (cipher) == WPA_CIPHER_AES_OCB || \
  126. (cipher) == WPA_CIPHER_AES_CCM || \
  127. (cipher) == WPA_CIPHER_TPK)
  128. #ifdef BCMWAPI_WAI
  129. #define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
  130. (cipher) == WAPI_CSE_WPI_SMS4)
  131. /* convert WAPI_CSE_WPI_XXX to WAPI_CIPHER_XXX */
  132. #define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \
  133. WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE)
  134. #define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \
  135. WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE)
  136. #endif /* BCMWAPI_WAI */
  137. /* WPA TKIP countermeasures parameters */
  138. #define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */
  139. #define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */
  140. /* RSN IE defines */
  141. #define RSN_CAP_LEN 2 /* Length of RSN capabilities field (2 octets) */
  142. /* RSN Capabilities defined in 802.11i */
  143. #define RSN_CAP_PREAUTH 0x0001
  144. #define RSN_CAP_NOPAIRWISE 0x0002
  145. #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
  146. #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2
  147. #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030
  148. #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4
  149. #define RSN_CAP_1_REPLAY_CNTR 0
  150. #define RSN_CAP_2_REPLAY_CNTRS 1
  151. #define RSN_CAP_4_REPLAY_CNTRS 2
  152. #define RSN_CAP_16_REPLAY_CNTRS 3
  153. #define RSN_CAP_MFPR 0x0040
  154. #define RSN_CAP_MFPC 0x0080
  155. #define RSN_CAP_SPPC 0x0400
  156. #define RSN_CAP_SPPR 0x0800
  157. /* WPA capabilities defined in 802.11i */
  158. #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS
  159. #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS
  160. #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
  161. #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
  162. /* WPA capabilities defined in 802.11zD9.0 */
  163. #define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1) /* bit 9 */
  164. /* WPA Specific defines */
  165. #define WPA_CAP_LEN RSN_CAP_LEN /* Length of RSN capabilities in RSN IE (2 octets) */
  166. #define WPA_PMKID_CNT_LEN 2 /* Length of RSN PMKID count (2 octests) */
  167. #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
  168. #define WPA2_PMKID_COUNT_LEN 2
  169. #ifdef BCMWAPI_WAI
  170. #define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
  171. /* Other WAI definition */
  172. #define WAPI_WAI_REQUEST 0x00F1
  173. #define WAPI_UNICAST_REKEY 0x00F2
  174. #define WAPI_STA_AGING 0x00F3
  175. #define WAPI_MUTIL_REKEY 0x00F4
  176. #define WAPI_STA_STATS 0x00F5
  177. #define WAPI_USK_REKEY_COUNT 0x4000000 /* 0xA00000 */
  178. #define WAPI_MSK_REKEY_COUNT 0x4000000 /* 0xA00000 */
  179. #endif /* BCMWAPI_WAI */
  180. /* This marks the end of a packed structure section. */
  181. #include <packed_section_end.h>
  182. #endif /* _proto_wpa_h_ */