• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __HMAC_11I_H__
20 #define __HMAC_11I_H__
21 
22 /* ****************************************************************************
23   1 头文件包含
24 **************************************************************************** */
25 #include "mac_resource.h"
26 #include "hmac_vap.h"
27 #include "hmac_user.h"
28 
29 #ifdef __cplusplus
30 #if __cplusplus
31 extern "C" {
32 #endif
33 #endif
34 
35 /* ****************************************************************************
36   2 宏定义
37 **************************************************************************** */
38 #define DMAC_WPA_802_11I  BIT0 /* 安全加密: bss_info中记录AP能力标识,WPA or WPA2 */
39 #define DMAC_RSNA_802_11I BIT1
40 
41 /* ****************************************************************************
42   3 枚举定义
43 **************************************************************************** */
44 /* 芯片密钥类型定义 */
45 typedef enum {
46     HAL_KEY_TYPE_TX_GTK              = 0,       /* Hi1131:HAL_KEY_TYPE_TX_IGTK */
47     HAL_KEY_TYPE_PTK                 = 1,
48     HAL_KEY_TYPE_RX_GTK              = 2,
49     HAL_KEY_TYPE_RX_GTK2             = 3,       /* 02使用 */
50     HAL_KEY_TYPE_BUTT
51 } hal_cipher_key_type_enum;
52 typedef hi_u8 hal_cipher_key_type_enum_uint8;
53 
54 typedef struct hmac_cap_supplicant_info_stru {
55     hi_u8 *puc_grp_policy_match;
56     hi_u8 *puc_pcip_policy_match;
57     hi_u8 *puc_auth_policy_match;
58 } hmac_cap_supplicant_info_stru;
59 
60 /* ****************************************************************************
61   4 函数声明
62 **************************************************************************** */
63 hi_u32 hmac_init_security(mac_vap_stru *mac_vap, hi_u8 *mac_addr, hi_u16 addr_len);
64 
65 hi_u8 hmac_check_pcip_wpa_policy(const wlan_mib_ieee802dot11_stru *mib_info, hi_u8 policy);
66 hi_u8 hmac_check_pcip_wpa2_policy(const wlan_mib_ieee802dot11_stru *mib_info, hi_u8 policy);
67 hi_u32 hmac_check_pcip_policy(const wlan_mib_ieee802dot11_stru *mib_info, hi_u8 policy, hi_u8 is_80211i_mode);
68 hi_u32 hmac_get_security_oui(hi_u8 is_80211i_mode, hi_u8 *auc_oui);
69 hi_u8 hmac_get_pcip_policy_auth(const hi_u8 *puc_frame, hi_u8 *puc_len);
70 hi_u8 hmac_get_auth_policy_auth(const hi_u8 *puc_frame, hi_u8 *len);
71 hi_u32 hmac_check_join_req_parewise_cipher_supplicant(const wlan_mib_ieee802dot11_stru *mib_info,
72     hi_u8 *puc_pcip_policy_match, hi_u8 is_802_11i_mode, const hi_u8 *puc_pcip_policy);
73 hi_u8 hmac_check_bss_cap_info(hi_u16 us_cap_info, mac_vap_stru *mac_vap);
74 hi_u32 hmac_update_current_join_req_parms_11i(mac_vap_stru *mac_vap, const mac_bss_80211i_info_stru *is_11i);
75 hi_void hmac_update_pcip_policy_prot_supplicant(mac_vap_stru *mac_vap, hi_u8 pcip_policy_match);
76 hi_u32 hmac_check_rsn_capability(const mac_vap_stru *mac_vap, const hi_u8 *puc_rsn_ie,
77     mac_status_code_enum_uint16 *pen_status_code);
78 hi_u32 hmac_en_mic(const hmac_user_stru *hmac_user, oal_netbuf_stru *netbuf, hi_u8 *puc_iv_len);
79 hi_u32 hmac_de_mic(const hmac_user_stru *hmac_user, oal_netbuf_stru *netbuf);
80 hi_u32 hmac_rx_tkip_mic_failure_process(frw_event_mem_stru *event_mem);
81 hi_u32 hmac_11i_ether_type_filter(const hmac_vap_stru *hmac_vap, const hi_u8 *mac_addr, hi_u16 us_ether_type);
82 hi_u32 hmac_config_11i_add_key(mac_vap_stru *mac_vap, hi_u16 us_len, const hi_u8 *puc_param);
83 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
84 hi_u32 hmac_config_11i_get_key(mac_vap_stru *mac_vap, hi_u16 us_len, const hi_u8 *puc_param);
85 #endif
86 hi_u32 hmac_config_11i_remove_key(mac_vap_stru *mac_vap, hi_u16 us_len, const hi_u8 *puc_param);
87 hi_u32 hmac_config_11i_set_default_key(mac_vap_stru *mac_vap, hi_u16 us_len, const hi_u8 *puc_param);
88 hi_u32 hmac_config_11i_add_wep_entry(mac_vap_stru *mac_vap, hi_u16 us_len, const hi_u8 *puc_param);
89 hi_u32 hmac_check_capability_mac_phy_supplicant(mac_vap_stru *mac_vap, mac_bss_dscr_stru *bss_dscr);
90 
91 #ifdef __cplusplus
92 #if __cplusplus
93 }
94 #endif
95 #endif
96 #endif
97