1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 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  * DOC: Declare various struct, macros which shall be used in the DISA
21  * component.
22  *
23  * Note: This file shall not contain public API's prototype/declarations.
24  *
25  */
26 
27 #ifndef _WLAN_DISA_PUBLIC_STRUCT_H_
28 #define _WLAN_DISA_PUBLIC_STRUCT_H_
29 
30 #include <qdf_types.h>
31 
32 #define MAC_MAX_KEY_LENGTH 32
33 #define MAC_PN_LENGTH 8
34 #define MAX_MAC_HEADER_LEN 32
35 #define MIN_MAC_HEADER_LEN 24
36 
37 /**
38  * struct disa_encrypt_decrypt_req_params - disa encrypt request
39  * @vdev_id: virtual device id
40  * @key_flag: This indicates firmware to encrypt/decrypt payload
41  *    see ENCRYPT_DECRYPT_FLAG
42  * @key_idx: Index used in storing key
43  * @key_cipher: cipher used for encryption/decryption
44  *    Eg: see WMI_CIPHER_AES_CCM for CCMP
45  * @key_len: length of key data
46  * @key_txmic_len: length of Tx MIC
47  * @key_rxmic_len: length of Rx MIC
48  * @key_data: Key
49  * @pn: packet number
50  * @mac_header: MAC header
51  * @data_len: length of data
52  * @data: pointer to payload
53  */
54 struct disa_encrypt_decrypt_req_params {
55 	uint32_t vdev_id;
56 	uint8_t key_flag;
57 	uint32_t key_idx;
58 	uint32_t key_cipher;
59 	uint32_t key_len;
60 	uint32_t key_txmic_len;
61 	uint32_t key_rxmic_len;
62 	uint8_t key_data[MAC_MAX_KEY_LENGTH];
63 	uint8_t pn[MAC_PN_LENGTH];
64 	uint8_t mac_header[MAX_MAC_HEADER_LEN];
65 	uint32_t data_len;
66 	uint8_t *data;
67 };
68 
69 /**
70  * struct disa_encrypt_decrypt_resp_params - disa encrypt response
71  * @vdev_id: vdev id
72  * @status: status
73  * @data_len: data length
74  * @data: data pointer
75  */
76 struct disa_encrypt_decrypt_resp_params {
77 	uint32_t vdev_id;
78 	int32_t status;
79 	uint32_t data_len;
80 	uint8_t *data;
81 };
82 
83 /**
84  * typedef encrypt_decrypt_resp_callback() - DISA callback function
85  * @cookie: cookie passed in the DISA request
86  * @resp: the DISA response
87  */
88 typedef void (*encrypt_decrypt_resp_callback)(void *cookie,
89 	struct disa_encrypt_decrypt_resp_params *resp);
90 #endif /* end  of _WLAN_DISA_PUBLIC_STRUCT_H_ */
91 
92