1 /* 2 * Fundamental types and constants relating to WPA 3 * 4 * Copyright (C) 1999-2011, 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,v 1.19 2009-07-13 08:29:58 Exp $ 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 112 113 #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \ 114 (cipher) == WPA_CIPHER_WEP_40 || \ 115 (cipher) == WPA_CIPHER_WEP_104 || \ 116 (cipher) == WPA_CIPHER_TKIP || \ 117 (cipher) == WPA_CIPHER_AES_OCB || \ 118 (cipher) == WPA_CIPHER_AES_CCM) 119 120 121 #define WPA_TKIP_CM_DETECT 60 122 #define WPA_TKIP_CM_BLOCK 60 123 124 125 #define RSN_CAP_LEN 2 126 127 128 #define RSN_CAP_PREAUTH 0x0001 129 #define RSN_CAP_NOPAIRWISE 0x0002 130 #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C 131 #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2 132 #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030 133 #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4 134 #define RSN_CAP_1_REPLAY_CNTR 0 135 #define RSN_CAP_2_REPLAY_CNTRS 1 136 #define RSN_CAP_4_REPLAY_CNTRS 2 137 #define RSN_CAP_16_REPLAY_CNTRS 3 138 139 140 #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS 141 #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS 142 #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT 143 #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK 144 145 146 #define WPA_CAP_LEN RSN_CAP_LEN 147 148 #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH 149 150 151 152 #include <packed_section_end.h> 153 154 #endif 155