xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/mvl88w8977/mlan/esa/KeyApiStaDefs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /** @file KeyApiStaDefs.h
2  *
3  *  @brief This file Contains data structures and defines related to key material.
4  *
5  * Copyright (C) 2014-2017, Marvell International Ltd.
6  *
7  * This software file (the "File") is distributed by Marvell International
8  * Ltd. under the terms of the GNU General Public License Version 2, June 1991
9  * (the "License").  You may use, redistribute and/or modify this File in
10  * accordance with the terms and conditions of the License, a copy of which
11  * is available by writing to the Free Software Foundation, Inc.,
12  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
13  * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14  *
15  * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17  * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
18  * this warranty disclaimer.
19  */
20 
21 /******************************************************
22 Change log:
23     03/07/2014: Initial version
24 ******************************************************/
25 #ifndef _KEY_API_STA_DEFS_H
26 #define _KEY_API_STA_DEFS_H
27 /******************************************************************/
28 /*!
29  *  \ingroup wpa_supplicant
30  *  \file   keyApiStaDefs.h
31  *  \brief  Contains data structures and defines related to key material
32  *
33  *******************************************************************/
34 
35 /* Key Material for TKIP type key */
36 #define CRYPTO_TKIP_KEY_LEN_MAX     16
37 #define CRYPTO_KEY_LEN_MAX          16
38 #define MIC_KEY_LEN_MAX             8
39 
40 /* Key Material for AES type key */
41 #define CRYPTO_AES_KEY_LEN_MAX      16
42 
43 #define WAPI_KEY_LEN               16
44 #define WAPI_MIC_LEN               16
45 #define WAPI_PN_LEN                16
46 
47 #define CRYPTO_AES_CMAC_KEY_LEN		16
48 #define CRYPTO_AES_CMAC_IPN_LEN		6
49 #define CRYPTO_WEP_KEY_LEN_MAX     13
50 
51 /*
52   WIN7 softAP (uAP) :
53   BIT14 and BIT15 of keyInfo is used to pass keyID for broadcast frame
54 */
55 
56 #define KEYDATA_KEY_ID_MASK   (BIT14 | BIT15)
57 #define KEYDATA_KEY_ID_OFFSET 14
58 
59 #define KEY_INFO_MULTICAST      0x1
60 #define KEY_INFO_UNICAST        0x2
61 #define KEY_INFO_ENABLED        0x4
62 #define KEY_INFO_DEFAULT        0x8
63 #define KEY_INFO_TX             0x10
64 #define KEY_INFO_RX             0x20
65 #define KEY_INFO_MULTICAST_IGTK	0x400
66 
67 typedef MLAN_PACK_START struct {
68 	UINT8 key[CRYPTO_TKIP_KEY_LEN_MAX];
69 	UINT8 txMicKey[MIC_KEY_LEN_MAX];
70 	UINT8 rxMicKey[MIC_KEY_LEN_MAX];
71 } MLAN_PACK_END key_Type_TKIP_t;
72 
73 /* This struct is used in ROM and existing fields should not be changed.
74   * New fields can be added at the end.
75   */
76 typedef MLAN_PACK_START struct {
77 	UINT8 keyIndex;
78 	UINT8 isDefaultTx;
79 	UINT8 key[CRYPTO_WEP_KEY_LEN_MAX];
80 } MLAN_PACK_END key_Type_WEP_t;
81 
82 typedef MLAN_PACK_START struct {
83 	UINT8 key[CRYPTO_AES_KEY_LEN_MAX];
84 } MLAN_PACK_END key_Type_AES_t;
85 
86 typedef MLAN_PACK_START struct {
87 	UINT8 keyIndex;
88 	UINT8 isDefKey;
89 	UINT8 key[WAPI_KEY_LEN];
90 	UINT8 mickey[WAPI_MIC_LEN];
91 	UINT8 rxPN[WAPI_PN_LEN];
92 } MLAN_PACK_END key_Type_WAPI_t;
93 
94 typedef MLAN_PACK_START struct {
95 	UINT8 ipn[CRYPTO_AES_CMAC_IPN_LEN];
96 	UINT8 reserved[2];
97 	UINT8 key[CRYPTO_AES_CMAC_KEY_LEN];
98 } MLAN_PACK_END key_Type_AES_CMAC_t;
99 
100 typedef MLAN_PACK_START struct {
101 	UINT16 keyType;
102 	UINT16 keyInfo;
103 	UINT16 keyLen;
104 	MLAN_PACK_START union {
105 		key_Type_TKIP_t TKIP;
106 		key_Type_AES_t AES;
107 		key_Type_WEP_t WEP;
108 
109 //#if defined(WAPI_HW_SUPPORT) || defined(WAPI_FW_SUPPORT)
110 //        key_Type_WAPI_t     WAPI;
111 //#endif
112 		key_Type_AES_CMAC_t iGTK;
113 
114 	} MLAN_PACK_END keyEncypt;
115 } MLAN_PACK_END key_MgtMaterial_t;
116 
117 /* deprecated but still around for backwards compatibility */
118 #define KEY_INFO_TKIP_MULTICAST     0x1
119 #define KEY_INFO_TKIP_UNICAST       0x2
120 #define KEY_INFO_TKIP_ENABLED       0x4
121 
122 #define KEY_INFO_AES_MULTICAST      0x1
123 #define KEY_INFO_AES_UNICAST        0x2
124 #define KEY_INFO_AES_ENABLED        0x4
125 
126 #endif
127