1 /*
2  * Copyright (c) 2011-2019, 2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /*
21  *
22  * This file ani_system_defs.h contains definitions used by
23  * various ANI entities
24  * Author:    Chandra Modumudi
25  * Date:      09/18/2002
26  * History:-
27  * Date       Modified by    Modification Information
28  * --------------------------------------------------------------------
29  */
30 
31 #ifndef __ANI_SYSTEM_DEFS_H
32 #define __ANI_SYSTEM_DEFS_H
33 
34 #include "sir_types.h"
35 #include "sir_mac_prot_def.h"
36 #include "wlan_crypto_global_def.h"
37 
38 /* This is to force compiler to use the maximum of an int for enum */
39 #define SIR_MAX_ENUM_SIZE    0x7FFFFFFF
40 
41 #ifndef false
42 #undef false
43 #define false   0
44 #endif
45 #ifndef true
46 #undef true
47 #define true    1
48 #endif
49 
50 /* / Authentication type enum used with peer */
51 typedef enum eAniAuthType {
52 	eSIR_OPEN_SYSTEM,
53 	eSIR_SHARED_KEY,
54 	eSIR_FT_AUTH,
55 	eSIR_AUTH_TYPE_SAE = 3,
56 #if defined FEATURE_WLAN_ESE
57 	eSIR_LEAP_AUTH = 0x80,
58 #endif
59 	SIR_FILS_SK_WITHOUT_PFS = 4,
60 	SIR_FILS_SK_WITH_PFS = 5,
61 	SIR_FILS_PK_AUTH = 6,
62 	eSIR_AUTH_TYPE_PASN = 7,
63 	eSIR_AUTH_TYPE_OWE,
64 	eSIR_AUTO_SWITCH,
65 	eSIR_DONOT_USE_AUTH_TYPE = SIR_MAX_ENUM_SIZE
66 } tAniAuthType;
67 
68 enum ani_akm_type {
69 	ANI_AKM_TYPE_NONE,
70 	ANI_AKM_TYPE_RSN,
71 	ANI_AKM_TYPE_RSN_PSK,
72 	ANI_AKM_TYPE_FT_RSN,
73 	ANI_AKM_TYPE_FT_RSN_PSK,
74 	ANI_AKM_TYPE_RSN_PSK_SHA256,
75 	ANI_AKM_TYPE_RSN_8021X_SHA256,
76 	ANI_AKM_TYPE_SAE,
77 	ANI_AKM_TYPE_FT_SAE,
78 	ANI_AKM_TYPE_SUITEB_EAP_SHA256,
79 	ANI_AKM_TYPE_SUITEB_EAP_SHA384,
80 	ANI_AKM_TYPE_FT_SUITEB_EAP_SHA384,
81 	ANI_AKM_TYPE_FILS_SHA256,
82 	ANI_AKM_TYPE_FILS_SHA384,
83 	ANI_AKM_TYPE_FT_FILS_SHA256,
84 	ANI_AKM_TYPE_FT_FILS_SHA384,
85 	ANI_AKM_TYPE_OWE,
86 	ANI_AKM_TYPE_CCKM,
87 	ANI_AKM_TYPE_OSEN,
88 	ANI_AKM_TYPE_DPP_RSN,
89 	ANI_AKM_TYPE_WPA,
90 	ANI_AKM_TYPE_WPA_PSK,
91 	ANI_AKM_TYPE_SAE_EXT_KEY,
92 	ANI_AKM_TYPE_FT_SAE_EXT_KEY,
93 	ANI_NUM_OF_SUPPORT_AKM_TYPE,
94 	ANI_AKM_TYPE_UNKNOWN = 0xff,
95 };
96 
97 /* / Encryption type enum used with peer */
98 typedef enum eAniEdType {
99 	eSIR_ED_NONE,
100 	eSIR_ED_WEP40,
101 	eSIR_ED_WEP104,
102 	eSIR_ED_TKIP,
103 	eSIR_ED_CCMP,
104 #if defined(FEATURE_WLAN_WAPI)
105 	eSIR_ED_WPI,
106 #endif
107 	/*DPU HW treats encryption mode 4 plus RMF bit set in TX BD as BIP.
108 	   Thus while setting BIP encryption mode in corresponding DPU Desc
109 	   eSIR_ED_AES_128_CMAC should be set to eSIR_ED_CCMP */
110 	eSIR_ED_AES_128_CMAC,
111 	/* Firmware uses key length to find GCMP 128 or 256 */
112 	eSIR_ED_GCMP,
113 	eSIR_ED_GCMP_256,
114 	eSIR_ED_AES_GMAC_128,
115 	eSIR_ED_AES_GMAC_256,
116 	eSIR_ED_NOT_IMPLEMENTED = SIR_MAX_ENUM_SIZE
117 } tAniEdType;
118 
119 typedef struct sAniSSID {
120 	uint8_t length;
121 	uint8_t ssId[WLAN_SSID_MAX_LEN];
122 } tAniSSID, *tpAniSSID;
123 
124 /* / RSN IE information */
125 typedef struct sSirRSNie {
126 	uint16_t length;
127 	uint8_t rsnIEdata[WLAN_MAX_IE_LEN + 2];
128 } tSirRSNie, *tpSirRSNie;
129 
130 typedef struct sSirWAPIie {
131 	uint16_t length;
132 	uint8_t wapiIEdata[WLAN_MAX_IE_LEN + 2];
133 } tSirWAPIie, *tpSirWAPIie;
134 /* / Additional IE information : */
135 /* / This can include WSC IE, P2P IE, and/or FTIE from upper layer. */
136 /* / MAC layer transparently convey these IE info between peer STA and upper layer, */
137 /* / but never requires to parse it. */
138 typedef struct sSirAddie {
139 	uint16_t length;
140 	uint8_t addIEdata[SIR_MAC_MAX_ADD_IE_LENGTH + 2];
141 } tSirAddie, *tpSirAddie;
142 
143 #define SIR_CIPHER_SEQ_CTR_SIZE 6
144 /* / Definition for MIC failure indication */
145 typedef struct sSirMicFailureInfo {
146 	tSirMacAddr srcMacAddr; /* address used to compute MIC */
147 	tSirMacAddr taMacAddr;  /* transmitter address */
148 	tSirMacAddr dstMacAddr;
149 	bool multicast;
150 	uint8_t IV1;            /* first byte of IV */
151 	uint8_t keyId;          /* second byte of IV */
152 	uint8_t TSC[SIR_CIPHER_SEQ_CTR_SIZE];   /* sequence number */
153 	tSirMacAddr rxMacAddr;  /* receive address */
154 
155 } tSirMicFailureInfo, *tpSirMicFailureInfo;
156 
157 typedef struct sTrafStrmMetrics {
158 	uint8_t RoamingCount;
159 	uint16_t RoamingDly;
160 } qdf_packed tTrafStrmMetrics, *tpTrafStrmMetrics;
161 
162 typedef struct sBcnReportFields {
163 	uint8_t ChanNum;
164 	uint8_t Spare;
165 	uint16_t MeasDuration;
166 	uint8_t PhyType;
167 	uint8_t RecvSigPower;
168 	tSirMacAddr Bssid;
169 	uint32_t ParentTsf;
170 	uint32_t TargetTsf[2];
171 	uint16_t BcnInterval;
172 	uint16_t CapabilityInfo;
173 } qdf_packed tBcnReportFields, *tpBcnReportFields;
174 
175 #endif /* __ANI_SYSTEM_DEFS_H */
176