xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19  /**
20  * DOC: Public definations  for crypto service
21  */
22 
23 #ifndef _WLAN_CRYPTO_GLOBAL_DEF_H_
24 #define _WLAN_CRYPTO_GLOBAL_DEF_H_
25 
26 #include <wlan_cmn.h>
27 #ifdef WLAN_CRYPTO_SUPPORT_FILS
28 #include "wlan_crypto_fils_def.h"
29 #endif
30 #include <wlan_objmgr_cmn.h>
31 #include <wlan_cmn_ieee80211.h>
32 
33 #define WLAN_CRYPTO_TID_SIZE         (17)
34 #define WLAN_CRYPTO_RSC_SIZE         (16)
35 #define WLAN_CRYPTO_KEYBUF_SIZE      (32)
36 #define WLAN_CRYPTO_MICBUF_SIZE      (16)
37 #define WLAN_CRYPTO_MIC_LEN          (8)
38 #define WLAN_CRYPTO_IV_SIZE          (16)
39 #define WLAN_CRYPTO_MIC256_LEN       (16)
40 #define WLAN_CRYPTO_TXMIC_OFFSET     (0)
41 #define WLAN_CRYPTO_RXMIC_OFFSET     (WLAN_CRYPTO_TXMIC_OFFSET + \
42 					WLAN_CRYPTO_MIC_LEN)
43 #define WLAN_CRYPTO_WAPI_IV_SIZE     (16)
44 #define WLAN_CRYPTO_CRC_LEN          (4)
45 #define WLAN_CRYPTO_IV_LEN           (3)
46 #define WLAN_CRYPTO_KEYID_LEN        (1)
47 #define WLAN_CRYPTO_EXT_IV_LEN       (4)
48 #define WLAN_CRYPTO_EXT_IV_BIT       (0x20)
49 #define WLAN_CRYPTO_KEYIX_NONE       ((uint16_t)-1)
50 #define WLAN_CRYPTO_MAXKEYIDX        (4)
51 #define WLAN_CRYPTO_MAXIGTKKEYIDX    (2)
52 #define WLAN_CRYPTO_MAXBIGTKKEYIDX   (2)
53 #ifndef WLAN_CRYPTO_MAX_VLANKEYIX
54 #define WLAN_CRYPTO_MAX_VLANKEYIX    WLAN_CRYPTO_MAXKEYIDX
55 #endif
56 #define WLAN_CRYPTO_MAX_PMKID        (16)
57 
58 /* 40 bit wep key len */
59 #define WLAN_CRYPTO_KEY_WEP40_LEN    (5)
60 /* 104 bit wep key len */
61 #define WLAN_CRYPTO_KEY_WEP104_LEN   (13)
62 /* 128 bit wep key len */
63 #define WLAN_CRYPTO_KEY_WEP128_LEN   (16)
64 
65 #define WLAN_CRYPTO_KEY_TKIP_LEN     (32)
66 #define WLAN_CRYPTO_KEY_CCMP_LEN     (16)
67 #define WLAN_CRYPTO_KEY_CCMP_256_LEN (32)
68 #define WLAN_CRYPTO_KEY_GCMP_LEN     (16)
69 #define WLAN_CRYPTO_KEY_GCMP_256_LEN (32)
70 #define WLAN_CRYPTO_KEY_WAPI_LEN     (32)
71 #define WLAN_CRYPTO_KEY_GMAC_LEN     (16)
72 #define WLAN_CRYPTO_KEY_GMAC_256_LEN (32)
73 #define WLAN_CRYPTO_WPI_SMS4_IVLEN   (16)
74 #define WLAN_CRYPTO_WPI_SMS4_KIDLEN  (1)
75 #define WLAN_CRYPTO_WPI_SMS4_PADLEN  (1)
76 #define WLAN_CRYPTO_WPI_SMS4_MICLEN  (16)
77 
78 /* FILS definitions */
79 #define WLAN_CRYPTO_FILS_OPTIONAL_DATA_LEN 3
80 #define WLAN_CRYPTO_FILS_RIK_LABEL "Re-authentication Integrity Key@ietf.org"
81 
82 /* key used for xmit */
83 #define WLAN_CRYPTO_KEY_XMIT         (0x01)
84 /* key used for recv */
85 #define WLAN_CRYPTO_KEY_RECV         (0x02)
86 /* key used for WPA group operation */
87 #define WLAN_CRYPTO_KEY_GROUP        (0x04)
88 /* key also used for management frames */
89 #define WLAN_CRYPTO_KEY_MFP          (0x08)
90 /* host-based encryption */
91 #define WLAN_CRYPTO_KEY_SWENCRYPT    (0x10)
92 /* host-based enmic */
93 #define WLAN_CRYPTO_KEY_SWENMIC      (0x20)
94 /* do not remove unless OS commands us to do so */
95 #define WLAN_CRYPTO_KEY_PERSISTENT   (0x40)
96 /* per STA default key */
97 #define WLAN_CRYPTO_KEY_DEFAULT      (0x80)
98 /* host-based decryption */
99 #define WLAN_CRYPTO_KEY_SWDECRYPT    (0x100)
100 /* host-based demic */
101 #define WLAN_CRYPTO_KEY_SWDEMIC      (0x200)
102 /* get pn from fw for key */
103 #define WLAN_CRYPTO_KEY_GET_PN       (0x400)
104 
105 #define WLAN_CRYPTO_KEY_SWCRYPT      (WLAN_CRYPTO_KEY_SWENCRYPT \
106 						| WLAN_CRYPTO_KEY_SWDECRYPT)
107 
108 #define WLAN_CRYPTO_KEY_SWMIC        (WLAN_CRYPTO_KEY_SWENMIC \
109 						| WLAN_CRYPTO_KEY_SWDEMIC)
110 
111 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
112 #define WLAN_AKM_SUITE_FT_8021X         0x000FAC03
113 #define WLAN_AKM_SUITE_FT_PSK           0x000FAC04
114 #endif
115 
116 /* Maximum lifetime for a PMKID entry - 12 Hrs */
117 #define WLAN_CRYPTO_MAX_PMKID_LIFETIME 43200
118 #define WLAN_CRYPTO_MAX_PMKID_LIFETIME_THRESHOLD 100
119 
120 /*
121  * Cipher types
122  */
123 typedef enum wlan_crypto_cipher_type {
124 	WLAN_CRYPTO_CIPHER_WEP             = 0,
125 	WLAN_CRYPTO_CIPHER_TKIP            = 1,
126 	WLAN_CRYPTO_CIPHER_AES_OCB         = 2,
127 	WLAN_CRYPTO_CIPHER_AES_CCM         = 3,
128 	WLAN_CRYPTO_CIPHER_WAPI_SMS4       = 4,
129 	WLAN_CRYPTO_CIPHER_CKIP            = 5,
130 	WLAN_CRYPTO_CIPHER_AES_CMAC        = 6,
131 	WLAN_CRYPTO_CIPHER_AES_CCM_256     = 7,
132 	WLAN_CRYPTO_CIPHER_AES_CMAC_256    = 8,
133 	WLAN_CRYPTO_CIPHER_AES_GCM         = 9,
134 	WLAN_CRYPTO_CIPHER_AES_GCM_256     = 10,
135 	WLAN_CRYPTO_CIPHER_AES_GMAC        = 11,
136 	WLAN_CRYPTO_CIPHER_AES_GMAC_256    = 12,
137 	WLAN_CRYPTO_CIPHER_WAPI_GCM4       = 13,
138 	WLAN_CRYPTO_CIPHER_FILS_AEAD       = 14,
139 	WLAN_CRYPTO_CIPHER_WEP_40          = 15,
140 	WLAN_CRYPTO_CIPHER_WEP_104         = 16,
141 	WLAN_CRYPTO_CIPHER_NONE            = 17,
142 	WLAN_CRYPTO_CIPHER_MAX             = (WLAN_CRYPTO_CIPHER_NONE + 1),
143 	WLAN_CRYPTO_CIPHER_INVALID,
144 } wlan_crypto_cipher_type;
145 
146 /* Auth types */
147 typedef enum wlan_crypto_auth_mode {
148 	WLAN_CRYPTO_AUTH_NONE     = 0,
149 	WLAN_CRYPTO_AUTH_OPEN     = 1,
150 	WLAN_CRYPTO_AUTH_SHARED   = 2,
151 	WLAN_CRYPTO_AUTH_8021X    = 3,
152 	WLAN_CRYPTO_AUTH_AUTO     = 4,
153 	WLAN_CRYPTO_AUTH_WPA      = 5,
154 	WLAN_CRYPTO_AUTH_RSNA     = 6,
155 	WLAN_CRYPTO_AUTH_CCKM     = 7,
156 	WLAN_CRYPTO_AUTH_WAPI     = 8,
157 	WLAN_CRYPTO_AUTH_SAE      = 9,
158 	WLAN_CRYPTO_AUTH_FILS_SK  = 10,
159 	/** Keep WLAN_CRYPTO_AUTH_MAX at the end. */
160 	WLAN_CRYPTO_AUTH_MAX      = WLAN_CRYPTO_AUTH_FILS_SK,
161 } wlan_crypto_auth_mode;
162 
163 /* crypto capabilities */
164 typedef enum wlan_crypto_cap {
165 	WLAN_CRYPTO_CAP_PRIVACY          = 0,
166 	WLAN_CRYPTO_CAP_WPA1             = 1,
167 	WLAN_CRYPTO_CAP_WPA2             = 2,
168 	WLAN_CRYPTO_CAP_WPA              = 3,
169 	WLAN_CRYPTO_CAP_AES              = 4,
170 	WLAN_CRYPTO_CAP_WEP              = 5,
171 	WLAN_CRYPTO_CAP_CKIP             = 6,
172 	WLAN_CRYPTO_CAP_TKIP_MIC         = 7,
173 	WLAN_CRYPTO_CAP_CCM256           = 8,
174 	WLAN_CRYPTO_CAP_GCM              = 9,
175 	WLAN_CRYPTO_CAP_GCM_256          = 10,
176 	WLAN_CRYPTO_CAP_WAPI_SMS4        = 11,
177 	WLAN_CRYPTO_CAP_WAPI_GCM4        = 12,
178 	WLAN_CRYPTO_CAP_KEY_MGMT_OFFLOAD = 13,
179 	WLAN_CRYPTO_CAP_PMF_OFFLOAD      = 14,
180 	WLAN_CRYPTO_CAP_PN_TID_BASED     = 15,
181 	WLAN_CRYPTO_CAP_FILS_AEAD        = 16,
182 } wlan_crypto_cap;
183 
184 typedef enum wlan_crypto_rsn_cap {
185 	WLAN_CRYPTO_RSN_CAP_PREAUTH       = 0x01,
186 	WLAN_CRYPTO_RSN_CAP_MFP_ENABLED   = 0x80,
187 	WLAN_CRYPTO_RSN_CAP_MFP_REQUIRED  = 0x40,
188 	WLAN_CRYPTO_RSN_CAP_OCV_SUPPORTED  = 0x4000,
189 } wlan_crypto_rsn_cap;
190 
191 enum wlan_crypto_rsnx_cap {
192 	WLAN_CRYPTO_RSNX_CAP_PROTECTED_TWT = 0x10,
193 	WLAN_CRYPTO_RSNX_CAP_SAE_H2E = 0x20,
194 	WLAN_CRYPTO_RSNX_CAP_SAE_PK = 0x40,
195 };
196 
197 typedef enum wlan_crypto_key_mgmt {
198 	WLAN_CRYPTO_KEY_MGMT_IEEE8021X             = 0,
199 	WLAN_CRYPTO_KEY_MGMT_PSK                   = 1,
200 	WLAN_CRYPTO_KEY_MGMT_NONE                  = 2,
201 	WLAN_CRYPTO_KEY_MGMT_IEEE8021X_NO_WPA      = 3,
202 	WLAN_CRYPTO_KEY_MGMT_WPA_NONE              = 4,
203 	WLAN_CRYPTO_KEY_MGMT_FT_IEEE8021X          = 5,
204 	WLAN_CRYPTO_KEY_MGMT_FT_PSK                = 6,
205 	WLAN_CRYPTO_KEY_MGMT_IEEE8021X_SHA256      = 7,
206 	WLAN_CRYPTO_KEY_MGMT_PSK_SHA256            = 8,
207 	WLAN_CRYPTO_KEY_MGMT_WPS                   = 9,
208 	WLAN_CRYPTO_KEY_MGMT_SAE                   = 10,
209 	WLAN_CRYPTO_KEY_MGMT_FT_SAE                = 11,
210 	WLAN_CRYPTO_KEY_MGMT_WAPI_PSK              = 12,
211 	WLAN_CRYPTO_KEY_MGMT_WAPI_CERT             = 13,
212 	WLAN_CRYPTO_KEY_MGMT_CCKM                  = 14,
213 	WLAN_CRYPTO_KEY_MGMT_OSEN                  = 15,
214 	WLAN_CRYPTO_KEY_MGMT_IEEE8021X_SUITE_B     = 16,
215 	WLAN_CRYPTO_KEY_MGMT_IEEE8021X_SUITE_B_192 = 17,
216 	WLAN_CRYPTO_KEY_MGMT_FILS_SHA256           = 18,
217 	WLAN_CRYPTO_KEY_MGMT_FILS_SHA384           = 19,
218 	WLAN_CRYPTO_KEY_MGMT_FT_FILS_SHA256        = 20,
219 	WLAN_CRYPTO_KEY_MGMT_FT_FILS_SHA384        = 21,
220 	WLAN_CRYPTO_KEY_MGMT_OWE                   = 22,
221 	WLAN_CRYPTO_KEY_MGMT_DPP                   = 23,
222 	WLAN_CRYPTO_KEY_MGMT_FT_IEEE8021X_SHA384   = 24,
223 	WLAN_CRYPTO_KEY_MGMT_FT_PSK_SHA384         = 25,
224 	WLAN_CRYPTO_KEY_MGMT_PSK_SHA384            = 26,
225 	/** Keep WLAN_CRYPTO_KEY_MGMT_MAX at the end. */
226 	WLAN_CRYPTO_KEY_MGMT_MAX   = WLAN_CRYPTO_KEY_MGMT_FT_IEEE8021X_SHA384,
227 } wlan_crypto_key_mgmt;
228 
229 enum wlan_crypto_key_type {
230 	WLAN_CRYPTO_KEY_TYPE_UNICAST,
231 	WLAN_CRYPTO_KEY_TYPE_GROUP,
232 };
233 
234 #define IS_WEP_CIPHER(_c)      ((_c == WLAN_CRYPTO_CIPHER_WEP) || \
235 				(_c == WLAN_CRYPTO_CIPHER_WEP_40) || \
236 				(_c == WLAN_CRYPTO_CIPHER_WEP_104))
237 
238 #define DEFAULT_KEYMGMT_6G_MASK 0xFFFFFFFF
239 
240 /* AKM wlan_crypto_key_mgmt 1, 6, 8, 25 and 26 are not allowed. */
241 #define ALLOWED_KEYMGMT_6G_MASK 0x01FFFEBD
242 
243 /*
244  * enum fils_erp_cryptosuite: this enum defines the cryptosuites used
245  * to calculate auth tag and auth tag length as defined by RFC 6696 5.3.1
246  * @HMAC_SHA256_64: sha256 with auth tag len as 64 bits
247  * @HMAC_SHA256_128: sha256 with auth tag len as 128 bits
248  * @HMAC_SHA256_256: sha256 with auth tag len as 256 bits
249  */
250 enum fils_erp_cryptosuite {
251 	INVALID_CRYPTO = 0, /* reserved */
252 	HMAC_SHA256_64,
253 	HMAC_SHA256_128,
254 	HMAC_SHA256_256,
255 };
256 
257 /**
258  * struct mobility_domain_params - structure containing
259  *				   mobility domain info
260  * @mdie_present: mobility domain present or not
261  * @mobility_domain: mobility domain
262  */
263 struct mobility_domain_params {
264 	uint8_t mdie_present;
265 	uint16_t mobility_domain;
266 };
267 
268 /**
269  * struct wlan_crypto_pmksa - structure of crypto to contain pmkid
270  * @bssid: bssid for which pmkid is saved
271  * @pmkid: pmkid info
272  * @pmk: pmk info
273  * @pmk_len: pmk len
274  * @ssid_len: ssid length
275  * @ssid: ssid information
276  * @cache_id: cache id
277  * @pmk_lifetime: Duration in seconds for which the pmk is valid
278  * @pmk_lifetime_threshold: Percentage of pmk liftime within which
279  * full authentication is expected to avoid disconnection.
280  * @pmk_entry_ts: System timestamp at which the PMK entry was created.
281  * @single_pmk_supported: SAE single pmk supported BSS
282  * @mdid: structure to contain mobility domain parameters
283  */
284 struct wlan_crypto_pmksa {
285 	struct qdf_mac_addr bssid;
286 	uint8_t    pmkid[PMKID_LEN];
287 	uint8_t    pmk[MAX_PMK_LEN];
288 	uint8_t    pmk_len;
289 	uint8_t    ssid_len;
290 	uint8_t    ssid[WLAN_SSID_MAX_LEN];
291 	uint8_t    cache_id[WLAN_CACHE_ID_LEN];
292 	uint32_t   pmk_lifetime;
293 	uint8_t    pmk_lifetime_threshold;
294 	qdf_time_t pmk_entry_ts;
295 #if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
296 	bool       single_pmk_supported;
297 #endif
298 	struct mobility_domain_params mdid;
299 };
300 
301 /**
302  * struct wlan_crypto_params - holds crypto params
303  * @authmodeset:        authentication mode
304  * @ucastcipherset:     unicast ciphers
305  * @mcastcipherset:     multicast cipher
306  * @mgmtcipherset:      mgmt cipher
307  * @cipher_caps:        cipher capability
308  * @key_mgmt:           key mgmt
309  * @pmksa:              pmksa
310  * @rsn_caps:           rsn_capability
311  *
312  * This structure holds crypto params for peer or vdev
313  */
314 struct wlan_crypto_params {
315 	uint32_t authmodeset;
316 	uint32_t ucastcipherset;
317 	uint32_t mcastcipherset;
318 	uint32_t mgmtcipherset;
319 	uint32_t cipher_caps;
320 	uint32_t key_mgmt;
321 	struct   wlan_crypto_pmksa *pmksa[WLAN_CRYPTO_MAX_PMKID];
322 	uint16_t rsn_caps;
323 };
324 
325 typedef enum wlan_crypto_param_type {
326 	WLAN_CRYPTO_PARAM_AUTH_MODE,
327 	WLAN_CRYPTO_PARAM_UCAST_CIPHER,
328 	WLAN_CRYPTO_PARAM_MCAST_CIPHER,
329 	WLAN_CRYPTO_PARAM_MGMT_CIPHER,
330 	WLAN_CRYPTO_PARAM_CIPHER_CAP,
331 	WLAN_CRYPTO_PARAM_RSN_CAP,
332 	WLAN_CRYPTO_PARAM_KEY_MGMT,
333 	WLAN_CRYPTO_PARAM_PMKSA,
334 } wlan_crypto_param_type;
335 
336 /**
337  * struct wlan_crypto_key - key structure
338  * @keylen:         length of the key
339  * @valid:          is key valid or not
340  * @flags:          key flags
341  * @keyix:          key id
342  * @cipher_type:    cipher type being used for this key
343  * @mac_addr:       MAC address of the peer
344  * @cipher_table:   table which stores cipher related info
345  * @private:        private pointer to save cipher context
346  * @keylock:        spin lock
347  * @recviv:         WAPI key receive sequence counter
348  * @txiv:           WAPI key transmit sequence counter
349  * @keytsc:         key transmit sequence counter
350  * @keyrsc:         key receive sequence counter
351  * @keyrsc_suspect: key receive sequence counter under
352  *                  suspect when pN jump is detected
353  * @keyglobal:      key receive global sequence counter used with suspect
354  * @keyval:         key value buffer
355  *
356  * This key structure to key related details.
357  */
358 struct wlan_crypto_key {
359 	uint8_t     keylen;
360 	bool        valid;
361 	uint16_t    flags;
362 	uint16_t    keyix;
363 	enum wlan_crypto_cipher_type cipher_type;
364 	uint8_t     macaddr[QDF_MAC_ADDR_SIZE];
365 	void        *cipher_table;
366 	void        *private;
367 	qdf_spinlock_t	keylock;
368 	uint8_t     recviv[WLAN_CRYPTO_WAPI_IV_SIZE];
369 	uint8_t     txiv[WLAN_CRYPTO_WAPI_IV_SIZE];
370 	uint64_t    keytsc;
371 	uint64_t    keyrsc[WLAN_CRYPTO_TID_SIZE];
372 	uint64_t    keyrsc_suspect[WLAN_CRYPTO_TID_SIZE];
373 	uint64_t    keyglobal;
374 	uint8_t     keyval[WLAN_CRYPTO_KEYBUF_SIZE
375 				+ WLAN_CRYPTO_MICBUF_SIZE];
376 #define txmic    (keyval + WLAN_CRYPTO_KEYBUF_SIZE \
377 				+ WLAN_CRYPTO_TXMIC_OFFSET)
378 #define rxmic    (keyval + WLAN_CRYPTO_KEYBUF_SIZE \
379 				+ WLAN_CRYPTO_RXMIC_OFFSET)
380 };
381 
382 /**
383  * struct wlan_crypto_req_key - key request structure
384  * @type:                       key/cipher type
385  * @pad:                        padding member
386  * @keyix:                      key index
387  * @keylen:                     length of the key value
388  * @flags:                      key flags
389  * @macaddr:                    macaddr of the key
390  * @keyrsc:                     key receive sequence counter
391  * @keytsc:                     key transmit sequence counter
392  * @keydata:                    key value
393  * @txiv:                       wapi key tx iv
394  * @rxiv:                       wapi key rx iv
395  * @filsaad:                    FILS AEAD data
396  *
397  * Key request structure used for setkey, getkey or delkey
398  */
399 struct wlan_crypto_req_key {
400 	uint8_t    type;
401 	uint8_t    pad;
402 	uint16_t   keyix;
403 	uint8_t    keylen;
404 	uint16_t    flags;
405 	uint8_t    macaddr[QDF_MAC_ADDR_SIZE];
406 	uint64_t   keyrsc;
407 	uint64_t   keytsc;
408 	uint8_t    keydata[WLAN_CRYPTO_KEYBUF_SIZE + WLAN_CRYPTO_MICBUF_SIZE];
409 	uint8_t    txiv[WLAN_CRYPTO_WAPI_IV_SIZE];
410 	uint8_t    recviv[WLAN_CRYPTO_WAPI_IV_SIZE];
411 #ifdef WLAN_CRYPTO_SUPPORT_FILS
412 	struct     wlan_crypto_fils_aad_key   filsaad;
413 #endif
414 };
415 
416 /**
417  * struct wlan_lmac_if_crypto_tx_ops - structure of crypto function
418  *                  pointers
419  * @allockey: function pointer to alloc key in hw
420  * @setkey:  function pointer to setkey in hw
421  * @delkey: function pointer to delkey in hw
422  * @defaultkey: function pointer to set default key
423  * @set_key: converged function pointer to set key in hw
424  * @getpn: function pointer to get current pn value of peer
425  * @register_events: function pointer to register wmi event handler
426  * @deregister_events: function pointer to deregister wmi event handler
427  */
428 
429 struct wlan_lmac_if_crypto_tx_ops {
430 	QDF_STATUS (*allockey)(struct wlan_objmgr_vdev *vdev,
431 			       struct wlan_crypto_key *key,
432 			       uint8_t *macaddr, uint32_t key_type);
433 	QDF_STATUS (*setkey)(struct wlan_objmgr_vdev *vdev,
434 			     struct wlan_crypto_key *key,
435 			     uint8_t *macaddr, uint32_t key_type);
436 	QDF_STATUS (*delkey)(struct wlan_objmgr_vdev *vdev,
437 			     struct wlan_crypto_key *key,
438 			     uint8_t *macaddr, uint32_t key_type);
439 	QDF_STATUS (*defaultkey)(struct wlan_objmgr_vdev *vdev,
440 				 uint8_t keyix, uint8_t *macaddr);
441 	QDF_STATUS (*set_key)(struct wlan_objmgr_vdev *vdev,
442 			      struct wlan_crypto_key *key,
443 			      enum wlan_crypto_key_type key_type);
444 	QDF_STATUS(*getpn)(struct wlan_objmgr_vdev *vdev,
445 			   uint8_t *macaddr, uint32_t key_type);
446 	QDF_STATUS (*register_events)(struct wlan_objmgr_psoc *psoc);
447 	QDF_STATUS (*deregister_events)(struct wlan_objmgr_psoc *psoc);
448 };
449 
450 /**
451  * struct wlan_lmac_if_crypto_rx_ops - structure of crypto rx  function
452  *                  pointers
453  * @encap: function pointer to encap tx frame
454  * @decap:  function pointer to decap rx frame in hw
455  * @enmic: function pointer to enmic tx frame
456  * @demic: function pointer to demic rx frame
457  */
458 
459 struct wlan_lmac_if_crypto_rx_ops {
460 	QDF_STATUS(*crypto_encap)(struct wlan_objmgr_vdev *vdev,
461 					qdf_nbuf_t wbuf, uint8_t *macaddr,
462 					uint8_t encapdone);
463 	QDF_STATUS(*crypto_decap)(struct wlan_objmgr_vdev *vdev,
464 					qdf_nbuf_t wbuf, uint8_t *macaddr,
465 					uint8_t tid);
466 	QDF_STATUS(*crypto_enmic)(struct wlan_objmgr_vdev *vdev,
467 					qdf_nbuf_t wbuf, uint8_t *macaddr,
468 					uint8_t encapdone);
469 	QDF_STATUS(*crypto_demic)(struct wlan_objmgr_vdev *vdev,
470 					qdf_nbuf_t wbuf, uint8_t *macaddr,
471 					uint8_t tid, uint8_t keyid);
472 	QDF_STATUS(*set_peer_wep_keys)(struct wlan_objmgr_vdev *vdev,
473 					struct wlan_objmgr_peer *peer);
474 };
475 
476 #define WLAN_CRYPTO_RX_OPS_ENCAP(crypto_rx_ops) \
477 				(crypto_rx_ops->crypto_encap)
478 #define WLAN_CRYPTO_RX_OPS_DECAP(crypto_rx_ops) \
479 				(crypto_rx_ops->crypto_decap)
480 #define WLAN_CRYPTO_RX_OPS_ENMIC(crypto_rx_ops) \
481 				(crypto_rx_ops->crypto_enmic)
482 #define WLAN_CRYPTO_RX_OPS_DEMIC(crypto_rx_ops) \
483 				(crypto_rx_ops->crypto_demic)
484 #define WLAN_CRYPTO_RX_OPS_SET_PEER_WEP_KEYS(crypto_rx_ops) \
485 				(crypto_rx_ops->set_peer_wep_keys)
486 
487 #endif /* end of _WLAN_CRYPTO_GLOBAL_DEF_H_ */
488