1 /** @file KeyApiStaTypes.h 2 * 3 * @brief This file defines some of the macros and types 4 * Please do not change those macros and types. 5 * 6 * Copyright (C) 2014-2017, Marvell International Ltd. 7 * 8 * This software file (the "File") is distributed by Marvell International 9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 10 * (the "License"). You may use, redistribute and/or modify this File in 11 * accordance with the terms and conditions of the License, a copy of which 12 * is available by writing to the Free Software Foundation, Inc., 13 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 14 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 15 * 16 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 18 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 19 * this warranty disclaimer. 20 */ 21 22 /****************************************************** 23 Change log: 24 03/07/2014: Initial version 25 ******************************************************/ 26 #ifndef KEY_API_STA_TYPES_H__ 27 #define KEY_API_STA_TYPES_H__ 28 29 #include "KeyApiStaDefs.h" 30 #include "wl_mib.h" 31 #include "keyCommonDef.h" 32 33 /******************************** Pool ID 11 ********************************/ 34 #define POOL_ID11_BLOCK_POOL_CNT 1 35 #define POOL_ID11_BUF0_SZ CIPHER_KEYS_BUF_SIZE 36 #define POOL_ID11_BUF0_CNT CIPHER_KEYS_BUF_NUM 37 #define POOL_ID11_BUF0_REAL_SZ (POOL_ID11_BUF0_SZ) 38 #define POOL_ID11_BUF0_TOT_SZ (POOL_ID11_BUF0_REAL_SZ * POOL_ID11_BUF0_CNT) 39 #define POOL_ID11_SZ (POOL_ID11_BUF0_TOT_SZ) 40 #define POOL_ID11_OVERHEAD ((POOL_ID11_BUF0_CNT) * sizeof(uint32)) 41 42 #define KEY_STATE_ENABLE 0x01 43 #define KEY_STATE_FORCE_EAPOL_UNENCRYPTED 0x02 44 45 #define KEY_ACTION_ADD 0x01 46 #define KEY_ACTION_DELETE 0x02 47 #define KEY_ACTION_FLUSHALL 0xFF 48 49 #define KEY_DIRECTION_UNSPEC (0x0) 50 #define KEY_DIRECTION_RX (0x1) 51 #define KEY_DIRECTION_TX (0x2) 52 #define KEY_DIRECTION_RXTX (KEY_DIRECTION_RX \ 53 | KEY_DIRECTION_TX) 54 55 #define KEY_INFO_PWK (0x1) 56 #define KEY_INFO_GWK (0x2) 57 #define KEY_INFO_IGWK (0x40) 58 #define KEY_INFO_KEY_MAPPING_KEY (0x4) 59 #define KEY_INFO_WEP_SUBTYPE (0x8) 60 #define KEY_INFO_GLOBAL (0x10) 61 62 /* 63 we use BIT6 and BIT7 of 64 keyInfo field of cipher_key_hdr_t to pass keyID. 65 */ 66 67 #define CIPHERKEY_KEY_ID_MASK (BIT6 | BIT7) 68 #define CIPHERKEY_KEY_ID_OFFSET 6 69 70 #define KEY_INFO_DEFAULT_KEY (~KEY_INFO_KEY_MAPPING_KEY) 71 72 #define VERSION_0 0 73 #define VERSION_2 2 74 75 #define IS_KEY_INFO_WEP_SUBTYPE_104BIT(x) \ 76 ( (x) ? \ 77 ((x)->hdr.keyInfo & KEY_INFO_WEP_SUBTYPE) : 0 ) 78 79 #define IS_KEY_INFO_WEP_SUBTYPE_40BIT(x) \ 80 ( (x) ? \ 81 (!((x)->hdr.keyInfo & KEY_INFO_WEP_SUBTYPE)) : 0 ) 82 83 #define SET_KEY_INFO_WEP_SUBTYPE_104BIT(x) \ 84 ( (x) ? ((x)->hdr.keyInfo |= KEY_INFO_WEP_SUBTYPE) : 0 ) 85 86 #define SET_KEY_INFO_WEP_SUBTYPE_40BIT(x) \ 87 ( (x) ? ((x)->hdr.keyInfo &= ~KEY_INFO_WEP_SUBTYPE) : 0 ) 88 89 #define SET_KEY_INFO_PWKGWK(x) \ 90 ( (x) ? \ 91 ((x)->hdr.keyInfo |= KEY_INFO_PWK|KEY_INFO_GWK) : 0) 92 93 #define SET_KEY_INFO_PWK(x) \ 94 ( (x) ? ((x)->hdr.keyInfo |= KEY_INFO_PWK, \ 95 ((x)->hdr.keyInfo &= ~KEY_INFO_GWK)) : 0 ) 96 97 #define SET_KEY_INFO_GWK(x) \ 98 ( (x) ? ((x)->hdr.keyInfo |= KEY_INFO_GWK, \ 99 ((x)->hdr.keyInfo &= ~KEY_INFO_PWK)): 0 ) 100 101 #define SET_KEY_INFO_GLOBAL(x) \ 102 ( (x) ? ((x)->hdr.keyInfo |= KEY_INFO_GLOBAL) : 0 ) 103 104 #define IS_KEY_INFO_GLOBAL(x) \ 105 ( (x) ? ((x)->hdr.keyInfo & KEY_INFO_GLOBAL) : 0 ) 106 107 #define SET_KEY_STATE_ENABLED(x, state) (((state) == TRUE) ? \ 108 ((x)->hdr.keyState |= KEY_STATE_ENABLE) \ 109 : ((x)->hdr.keyState &= ~KEY_STATE_ENABLE) ) 110 111 #define IS_KEY_STATE_ENABLED(x) \ 112 ( (x) ? ((x)->hdr.keyState & KEY_STATE_ENABLE) : 0 ) 113 114 #define IS_KEY_STATE_FORCE_EAPOL_UNENCRYPTED(x) \ 115 ( (x) ? \ 116 ((x)->hdr.keyState & KEY_STATE_FORCE_EAPOL_UNENCRYPTED) : 0) 117 118 #define SET_KEY_STATE_FORCE_EAPOL_UNENCRYPTED(x,state) \ 119 (((state) == TRUE) ? \ 120 ((x)->hdr.keyState |= KEY_STATE_FORCE_EAPOL_UNENCRYPTED) \ 121 : ((x)->hdr.keyState &= ~KEY_STATE_FORCE_EAPOL_UNENCRYPTED) ) 122 123 typedef MLAN_PACK_START struct { 124 IEEEtypes_MacAddr_t macAddr; 125 UINT8 keyDirection; 126 UINT8 keyType; 127 UINT16 keyLen; 128 UINT8 keyAction; 129 UINT8 keyInfo; 130 } MLAN_PACK_END nwf_key_mgthdr_t; 131 132 /* host command for GET/SET Key Material */ 133 typedef MLAN_PACK_START struct { 134 UINT16 Action; 135 nwf_key_mgthdr_t key_material; 136 } MLAN_PACK_END host_802_11_NWF_Key_Material_t; 137 138 /* host command for set wep parameters in Vista uses different struct 139 from the one we use in FW */ 140 141 typedef MLAN_PACK_START struct host_802_11_wep_key { 142 UINT8 WepDefaultKeyIdx; /* 1 to 4 */ 143 UINT8 WepDefaultKeyValue[WEP_KEY_USER_INPUT]; /* 5 byte string */ 144 } MLAN_PACK_END host_802_11_wep_key_t; 145 146 typedef struct host_802_11_wep_key_data_t { 147 host_802_11_wep_key_t WepDefaultKeys[MAX_WEP_KEYS]; 148 UINT8 default_key_idx; 149 UINT8 Reserved1[3]; 150 } host_802_11_wep_key_data_t; 151 152 typedef UINT32 buffer_t; 153 154 typedef struct cipher_key_buf { 155 struct cipher_key_buf_t *prev; 156 struct cipher_key_buf_t *next; 157 158 cipher_key_t cipher_key; 159 } cipher_key_buf_t; 160 161 #define CIPHER_KEYS_BUF_SIZE (sizeof(cipher_key_buf_t)) 162 163 #define CIPHER_KEYS_BUF_NUM (CM_MAX_CONNECTIONS) 164 165 #endif /* KEY_API_STA_H__ end */ 166