/linux-3.4/drivers/net/wireless/bcmdhd/include/proto/wpa.h

https://gitlab.com/hellrokr/orange-pi-plus · C Header · 194 lines · 139 code · 48 blank · 7 comment · 23 complexity · 8468fa81de161a3bbdda16b4625a510f MD5 · raw file

  1. /*
  2. * Fundamental types and constants relating to WPA
  3. *
  4. * $Copyright Open Broadcom Corporation$
  5. *
  6. * $Id: wpa.h 384536 2013-02-12 04:13:09Z $
  7. */
  8. #ifndef _proto_wpa_h_
  9. #define _proto_wpa_h_
  10. #include <typedefs.h>
  11. #include <proto/ethernet.h>
  12. #include <packed_section_start.h>
  13. #define DOT11_RC_INVALID_WPA_IE 13
  14. #define DOT11_RC_MIC_FAILURE 14
  15. #define DOT11_RC_4WH_TIMEOUT 15
  16. #define DOT11_RC_GTK_UPDATE_TIMEOUT 16
  17. #define DOT11_RC_WPA_IE_MISMATCH 17
  18. #define DOT11_RC_INVALID_MC_CIPHER 18
  19. #define DOT11_RC_INVALID_UC_CIPHER 19
  20. #define DOT11_RC_INVALID_AKMP 20
  21. #define DOT11_RC_BAD_WPA_VERSION 21
  22. #define DOT11_RC_INVALID_WPA_CAP 22
  23. #define DOT11_RC_8021X_AUTH_FAIL 23
  24. #define WPA2_PMKID_LEN 16
  25. typedef BWL_PRE_PACKED_STRUCT struct
  26. {
  27. uint8 tag;
  28. uint8 length;
  29. uint8 oui[3];
  30. uint8 oui_type;
  31. BWL_PRE_PACKED_STRUCT struct {
  32. uint8 low;
  33. uint8 high;
  34. } BWL_POST_PACKED_STRUCT version;
  35. } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
  36. #define WPA_IE_OUITYPE_LEN 4
  37. #define WPA_IE_FIXED_LEN 8
  38. #define WPA_IE_TAG_FIXED_LEN 6
  39. typedef BWL_PRE_PACKED_STRUCT struct {
  40. uint8 tag;
  41. uint8 length;
  42. BWL_PRE_PACKED_STRUCT struct {
  43. uint8 low;
  44. uint8 high;
  45. } BWL_POST_PACKED_STRUCT version;
  46. } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
  47. #define WPA_RSN_IE_FIXED_LEN 4
  48. #define WPA_RSN_IE_TAG_FIXED_LEN 2
  49. typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
  50. typedef BWL_PRE_PACKED_STRUCT struct
  51. {
  52. uint8 oui[3];
  53. uint8 type;
  54. } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
  55. #define WPA_SUITE_LEN 4
  56. typedef BWL_PRE_PACKED_STRUCT struct
  57. {
  58. BWL_PRE_PACKED_STRUCT struct {
  59. uint8 low;
  60. uint8 high;
  61. } BWL_POST_PACKED_STRUCT count;
  62. wpa_suite_t list[1];
  63. } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
  64. #define WPA_IE_SUITE_COUNT_LEN 2
  65. typedef BWL_PRE_PACKED_STRUCT struct
  66. {
  67. BWL_PRE_PACKED_STRUCT struct {
  68. uint8 low;
  69. uint8 high;
  70. } BWL_POST_PACKED_STRUCT count;
  71. wpa_pmkid_t list[1];
  72. } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
  73. #define WPA_CIPHER_NONE 0
  74. #define WPA_CIPHER_WEP_40 1
  75. #define WPA_CIPHER_TKIP 2
  76. #define WPA_CIPHER_AES_OCB 3
  77. #define WPA_CIPHER_AES_CCM 4
  78. #define WPA_CIPHER_WEP_104 5
  79. #define WPA_CIPHER_BIP 6
  80. #define WPA_CIPHER_TPK 7
  81. #ifdef BCMCCX
  82. #define WPA_CIPHER_CKIP 8
  83. #define WPA_CIPHER_CKIP_MMH 9
  84. #define WPA_CIPHER_WEP_MMH 10
  85. #define IS_CCX_CIPHER(cipher) ((cipher) == WPA_CIPHER_CKIP || \
  86. (cipher) == WPA_CIPHER_CKIP_MMH || \
  87. (cipher) == WPA_CIPHER_WEP_MMH)
  88. #endif
  89. #ifdef BCMWAPI_WAI
  90. #define WAPI_CIPHER_NONE WPA_CIPHER_NONE
  91. #define WAPI_CIPHER_SMS4 11
  92. #define WAPI_CSE_WPI_SMS4 1
  93. #endif
  94. #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
  95. (cipher) == WPA_CIPHER_WEP_40 || \
  96. (cipher) == WPA_CIPHER_WEP_104 || \
  97. (cipher) == WPA_CIPHER_TKIP || \
  98. (cipher) == WPA_CIPHER_AES_OCB || \
  99. (cipher) == WPA_CIPHER_AES_CCM || \
  100. (cipher) == WPA_CIPHER_TPK)
  101. #ifdef BCMWAPI_WAI
  102. #define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
  103. (cipher) == WAPI_CSE_WPI_SMS4)
  104. #define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \
  105. WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE)
  106. #define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \
  107. WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE)
  108. #endif
  109. #define WPA_TKIP_CM_DETECT 60
  110. #define WPA_TKIP_CM_BLOCK 60
  111. #define RSN_CAP_LEN 2
  112. #define RSN_CAP_PREAUTH 0x0001
  113. #define RSN_CAP_NOPAIRWISE 0x0002
  114. #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
  115. #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2
  116. #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030
  117. #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4
  118. #define RSN_CAP_1_REPLAY_CNTR 0
  119. #define RSN_CAP_2_REPLAY_CNTRS 1
  120. #define RSN_CAP_4_REPLAY_CNTRS 2
  121. #define RSN_CAP_16_REPLAY_CNTRS 3
  122. #define RSN_CAP_MFPR 0x0040
  123. #define RSN_CAP_MFPC 0x0080
  124. #define RSN_CAP_SPPC 0x0400
  125. #define RSN_CAP_SPPR 0x0800
  126. #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS
  127. #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS
  128. #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
  129. #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
  130. #define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1)
  131. #define WPA_CAP_LEN RSN_CAP_LEN
  132. #define WPA_PMKID_CNT_LEN 2
  133. #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
  134. #define WPA2_PMKID_COUNT_LEN 2
  135. #ifdef BCMWAPI_WAI
  136. #define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
  137. #define WAPI_WAI_REQUEST 0x00F1
  138. #define WAPI_UNICAST_REKEY 0x00F2
  139. #define WAPI_STA_AGING 0x00F3
  140. #define WAPI_MUTIL_REKEY 0x00F4
  141. #define WAPI_STA_STATS 0x00F5
  142. #define WAPI_USK_REKEY_COUNT 0x4000000
  143. #define WAPI_MSK_REKEY_COUNT 0x4000000
  144. #endif
  145. #include <packed_section_end.h>
  146. #endif