xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8821cs/include/rtw_swcrypto.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 
17 #ifndef __RTW_SWCRYPTO_H_
18 #define __RTW_SWCRYPTO_H_
19 
20 #define NEW_CRYPTO 1
21 
22 int _rtw_ccmp_encrypt(u8 *key, u32 key_len, uint hdrlen, u8 *frame, uint plen);
23 int _rtw_ccmp_decrypt(u8 *key, u32 key_len, uint hdrlen, u8 *frame, uint plen);
24 
25 int _rtw_gcmp_encrypt(u8 *key, u32 key_len, uint hdrlen, u8 *frame, uint plen);
26 int _rtw_gcmp_decrypt(u8 *key, u32 key_len, uint hdrlen, u8 *frame, uint plen);
27 
28 #ifdef CONFIG_RTW_MESH_AEK
29 int _aes_siv_encrypt(const u8 *key, size_t key_len,
30 	const u8 *pw, size_t pwlen,
31 	size_t num_elem, const u8 *addr[], const size_t *len, u8 *out);
32 int _aes_siv_decrypt(const u8 *key, size_t key_len,
33 	const u8 *iv_crypt, size_t iv_c_len,
34 	size_t num_elem, const u8 *addr[], const size_t *len, u8 *out);
35 #endif
36 
37 #if defined(CONFIG_IEEE80211W) | defined(CONFIG_TDLS)
38 u8 _bip_ccmp_protect(const u8 *key, size_t key_len,
39 	const u8 *data, size_t data_len, u8 *mic);
40 u8 _bip_gcmp_protect(u8 *whdr_pos, size_t len,
41 	const u8 *key, size_t key_len,
42 	const u8 *data, size_t data_len, u8 *mic);
43 #endif /* CONFIG_IEEE80211W */
44 
45 #ifdef CONFIG_TDLS
46 void _tdls_generate_tpk(void *sta, const u8 *own_addr, const u8 *bssid);
47 #endif /* CONFIG_TDLS */
48 
49 #endif /* __RTW_SWCRYPTO_H_ */
50 
51