1 /* 2 * Fundamental types and constants relating to WPA 3 * 4 * Copyright (C) 1999-2012, Broadcom Corporation 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $Id: wpa.h 261155 2011-05-23 23:51:32Z $ 19 */ 20 21 22 #ifndef _proto_wpa_h_ 23 #define _proto_wpa_h_ 24 25 #include <typedefs.h> 26 #include <proto/ethernet.h> 27 28 29 30 #include <packed_section_start.h> 31 32 33 34 35 #define DOT11_RC_INVALID_WPA_IE 13 36 #define DOT11_RC_MIC_FAILURE 14 37 #define DOT11_RC_4WH_TIMEOUT 15 38 #define DOT11_RC_GTK_UPDATE_TIMEOUT 16 39 #define DOT11_RC_WPA_IE_MISMATCH 17 40 #define DOT11_RC_INVALID_MC_CIPHER 18 41 #define DOT11_RC_INVALID_UC_CIPHER 19 42 #define DOT11_RC_INVALID_AKMP 20 43 #define DOT11_RC_BAD_WPA_VERSION 21 44 #define DOT11_RC_INVALID_WPA_CAP 22 45 #define DOT11_RC_8021X_AUTH_FAIL 23 46 47 #define WPA2_PMKID_LEN 16 48 49 50 typedef BWL_PRE_PACKED_STRUCT struct 51 { 52 uint8 tag; 53 uint8 length; 54 uint8 oui[3]; 55 uint8 oui_type; 56 BWL_PRE_PACKED_STRUCT struct { 57 uint8 low; 58 uint8 high; 59 } BWL_POST_PACKED_STRUCT version; 60 } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t; 61 #define WPA_IE_OUITYPE_LEN 4 62 #define WPA_IE_FIXED_LEN 8 63 #define WPA_IE_TAG_FIXED_LEN 6 64 65 typedef BWL_PRE_PACKED_STRUCT struct { 66 uint8 tag; 67 uint8 length; 68 BWL_PRE_PACKED_STRUCT struct { 69 uint8 low; 70 uint8 high; 71 } BWL_POST_PACKED_STRUCT version; 72 } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t; 73 #define WPA_RSN_IE_FIXED_LEN 4 74 #define WPA_RSN_IE_TAG_FIXED_LEN 2 75 typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN]; 76 77 78 typedef BWL_PRE_PACKED_STRUCT struct 79 { 80 uint8 oui[3]; 81 uint8 type; 82 } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t; 83 #define WPA_SUITE_LEN 4 84 85 86 typedef BWL_PRE_PACKED_STRUCT struct 87 { 88 BWL_PRE_PACKED_STRUCT struct { 89 uint8 low; 90 uint8 high; 91 } BWL_POST_PACKED_STRUCT count; 92 wpa_suite_t list[1]; 93 } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t; 94 #define WPA_IE_SUITE_COUNT_LEN 2 95 typedef BWL_PRE_PACKED_STRUCT struct 96 { 97 BWL_PRE_PACKED_STRUCT struct { 98 uint8 low; 99 uint8 high; 100 } BWL_POST_PACKED_STRUCT count; 101 wpa_pmkid_t list[1]; 102 } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t; 103 104 105 #define WPA_CIPHER_NONE 0 106 #define WPA_CIPHER_WEP_40 1 107 #define WPA_CIPHER_TKIP 2 108 #define WPA_CIPHER_AES_OCB 3 109 #define WPA_CIPHER_AES_CCM 4 110 #define WPA_CIPHER_WEP_104 5 111 #define WPA_CIPHER_BIP 6 112 #define WPA_CIPHER_TPK 7 113 114 #ifdef BCMWAPI_WAI 115 #define WAPI_CIPHER_NONE WPA_CIPHER_NONE 116 #define WAPI_CIPHER_SMS4 11 117 118 #define WAPI_CSE_WPI_SMS4 1 119 #endif 120 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 129 130 #define WPA_TKIP_CM_DETECT 60 131 #define WPA_TKIP_CM_BLOCK 60 132 133 134 #define RSN_CAP_LEN 2 135 136 137 #define RSN_CAP_PREAUTH 0x0001 138 #define RSN_CAP_NOPAIRWISE 0x0002 139 #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C 140 #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2 141 #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030 142 #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4 143 #define RSN_CAP_1_REPLAY_CNTR 0 144 #define RSN_CAP_2_REPLAY_CNTRS 1 145 #define RSN_CAP_4_REPLAY_CNTRS 2 146 #define RSN_CAP_16_REPLAY_CNTRS 3 147 148 149 #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS 150 #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS 151 #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT 152 #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK 153 154 155 #define WPA_CAP_LEN RSN_CAP_LEN 156 157 #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH 158 159 160 161 #include <packed_section_end.h> 162 163 #endif 164