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_CRYPTO_FRAME_H__ 20 #define __HMAC_CRYPTO_FRAME_H__ 21 22 /* **************************************************************************** 23 1 其他头文件包含 24 **************************************************************************** */ 25 #include "oal_ext_if.h" 26 #include "mac_vap.h" 27 28 #ifdef __cplusplus 29 #if __cplusplus 30 extern "C" { 31 #endif 32 #endif 33 34 /* **************************************************************************** 35 2 宏定义 36 **************************************************************************** */ 37 #define michael_block(l, r) do { \ 38 r ^= rotl32(l, 17); \ 39 l += r; \ 40 r ^= xswap(l); \ 41 l += r; \ 42 r ^= rotl32(l, 3); \ 43 l += r; \ 44 r ^= rotr32(l, 2); \ 45 l += r; \ 46 } while (0) 47 #define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 48 49 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 50 #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 51 #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 52 #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 53 54 #define WEP_IV_FIELD_SIZE 4 /* wep IV field size */ 55 #define EXT_IV_FIELD_SIZE 4 /* ext IV field size */ 56 #define AUC_HDR_SIZE 16 57 58 typedef struct hmac_michael_mic_info_stru { 59 hi_u32 offset; 60 hi_u32 data_len; 61 hi_u8 *puc_mic; 62 } hmac_michael_mic_info_stru; 63 64 /* **************************************************************************** 65 10 函数声明 66 **************************************************************************** */ 67 hi_u32 hmac_crypto_tkip_enmic(wlan_priv_key_param_stru *key, oal_netbuf_stru *netbuf); 68 hi_u32 hmac_crypto_tkip_demic(wlan_priv_key_param_stru *key, oal_netbuf_stru *netbuf); 69 70 #ifdef __cplusplus 71 #if __cplusplus 72 } 73 #endif 74 #endif 75 76 #endif /* __HMAC_CRYPTO_FRAME_H__ */ 77